summaryrefslogtreecommitdiffstats
path: root/java/com/android/incallui/AnswerScreenPresenter.java
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-06-19 11:26:01 -0700
committerEric Erfanian <erfanian@google.com>2017-06-19 11:30:45 -0700
commit2f1c7586bcce334ca69022eb8dc6d8965ceb6a05 (patch)
treebf00ada449ee3de31ec983a14e84159200aa18c2 /java/com/android/incallui/AnswerScreenPresenter.java
parent3d0ca68e466482971a4cf46576c50cb2bd42bcb5 (diff)
downloadandroid_packages_apps_Dialer-2f1c7586bcce334ca69022eb8dc6d8965ceb6a05.tar.gz
android_packages_apps_Dialer-2f1c7586bcce334ca69022eb8dc6d8965ceb6a05.tar.bz2
android_packages_apps_Dialer-2f1c7586bcce334ca69022eb8dc6d8965ceb6a05.zip
Update AOSP Dialer source from internal google3 repository at
cl/159428781. Test: make, treehugger This CL updates the AOSP Dialer source with all the changes that have gone into the private google3 repository. This includes all the changes from cl/152373142 (4/06/2017) to cl/159428781 (6/19/2017). This goal of these drops is to keep the AOSP source in sync with the internal google3 repository. Currently these sync are done by hand with very minor modifications to the internal source code. See the Android.mk file for list of modifications. Our current goal is to do frequent drops (daily if possible) and eventually switched to an automated process. Change-Id: Ie60a84b3936efd0ea3d95d7c86bf96d2b1663030
Diffstat (limited to 'java/com/android/incallui/AnswerScreenPresenter.java')
-rw-r--r--java/com/android/incallui/AnswerScreenPresenter.java59
1 files changed, 57 insertions, 2 deletions
diff --git a/java/com/android/incallui/AnswerScreenPresenter.java b/java/com/android/incallui/AnswerScreenPresenter.java
index ca34aa6aa..d53040145 100644
--- a/java/com/android/incallui/AnswerScreenPresenter.java
+++ b/java/com/android/incallui/AnswerScreenPresenter.java
@@ -17,12 +17,14 @@
package com.android.incallui;
import android.content.Context;
+import android.os.SystemClock;
import android.support.annotation.FloatRange;
import android.support.annotation.NonNull;
import android.support.v4.os.UserManagerCompat;
import android.telecom.VideoProfile;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
+import com.android.dialer.common.concurrent.ThreadUtil;
import com.android.dialer.logging.DialerImpression;
import com.android.dialer.logging.Logger;
import com.android.incallui.answer.protocol.AnswerScreen;
@@ -36,11 +38,14 @@ import com.android.incallui.call.DialerCallListener;
/** Manages changes for an incoming call screen. */
public class AnswerScreenPresenter
implements AnswerScreenDelegate, DialerCall.CannedTextResponsesLoadedListener {
+ private static final int ACCEPT_REJECT_CALL_TIME_OUT_IN_MILLIS = 5000;
+
@NonNull private final Context context;
@NonNull private final AnswerScreen answerScreen;
@NonNull private final DialerCall call;
+ private long actionPerformedTimeMillis;
- public AnswerScreenPresenter(
+ AnswerScreenPresenter(
@NonNull Context context, @NonNull AnswerScreen answerScreen, @NonNull DialerCall call) {
LogUtil.i("AnswerScreenPresenter.constructor", null);
this.context = Assert.isNotNull(context);
@@ -60,6 +65,13 @@ public class AnswerScreenPresenter
}
@Override
+ public boolean isActionTimeout() {
+ return actionPerformedTimeMillis != 0
+ && SystemClock.elapsedRealtime() - actionPerformedTimeMillis
+ >= ACCEPT_REJECT_CALL_TIME_OUT_IN_MILLIS;
+ }
+
+ @Override
public void onAnswerScreenUnready() {
call.removeCannedTextResponsesLoadedListener(this);
}
@@ -73,6 +85,7 @@ public class AnswerScreenPresenter
public void onRejectCallWithMessage(String message) {
call.reject(true /* rejectWithMessage */, message);
onDismissDialog();
+ addTimeoutCheck();
}
@Override
@@ -100,6 +113,7 @@ public class AnswerScreenPresenter
call.answer();
}
}
+ addTimeoutCheck();
}
@Override
@@ -114,6 +128,7 @@ public class AnswerScreenPresenter
} else {
call.reject(false /* rejectWithMessage */, null);
}
+ addTimeoutCheck();
}
@Override
@@ -124,9 +139,27 @@ public class AnswerScreenPresenter
LogUtil.i("AnswerScreenPresenter.onAnswerAndReleaseCall", "activeCall == null");
onAnswer(false);
} else {
+ activeCall.setReleasedByAnsweringSecondCall(true);
activeCall.addListener(new AnswerOnDisconnected(activeCall));
activeCall.disconnect();
}
+ addTimeoutCheck();
+ }
+
+ @Override
+ public void onAnswerAndReleaseButtonDisabled() {
+ DialerCall activeCall = CallList.getInstance().getActiveCall();
+ if (activeCall != null) {
+ activeCall.increaseSecondCallWithoutAnswerAndReleasedButtonTimes();
+ }
+ }
+
+ @Override
+ public void onAnswerAndReleaseButtonEnabled() {
+ DialerCall activeCall = CallList.getInstance().getActiveCall();
+ if (activeCall != null) {
+ activeCall.increaseAnswerAndReleaseButtonDisplayedTimes();
+ }
}
@Override
@@ -148,7 +181,7 @@ public class AnswerScreenPresenter
private final DialerCall disconnectingCall;
- public AnswerOnDisconnected(DialerCall disconnectingCall) {
+ AnswerOnDisconnected(DialerCall disconnectingCall) {
this.disconnectingCall = disconnectingCall;
}
@@ -183,10 +216,32 @@ public class AnswerScreenPresenter
@Override
public void onInternationalCallOnWifi() {}
+
+ @Override
+ public void onEnrichedCallSessionUpdate() {}
}
private boolean isSmsResponseAllowed(DialerCall call) {
return UserManagerCompat.isUserUnlocked(context)
&& call.can(android.telecom.Call.Details.CAPABILITY_RESPOND_VIA_TEXT);
}
+
+ private void addTimeoutCheck() {
+ actionPerformedTimeMillis = SystemClock.elapsedRealtime();
+ if (answerScreen.getAnswerScreenFragment().isVisible()) {
+ ThreadUtil.postDelayedOnUiThread(
+ () -> {
+ if (!answerScreen.getAnswerScreenFragment().isVisible()) {
+ LogUtil.d(
+ "AnswerScreenPresenter.addTimeoutCheck",
+ "accept/reject call timed out, do nothing");
+ return;
+ }
+ LogUtil.i("AnswerScreenPresenter.addTimeoutCheck", "accept/reject call timed out");
+ // Force re-evaluate which fragment to show.
+ InCallPresenter.getInstance().refreshUi();
+ },
+ ACCEPT_REJECT_CALL_TIME_OUT_IN_MILLIS);
+ }
+ }
}