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/158012278 (6/05/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.
Merged-In: Ie60a84b3936efd0ea3d95d7c86bf96d2b1663030
Change-Id: If1fa394df2609f0d38b4f794c83f4db3f1006484
diff --git a/java/com/android/incallui/AnswerScreenPresenter.java b/java/com/android/incallui/AnswerScreenPresenter.java
index ddbe6cc..d530401 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 @@
/** 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 @@
}
@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 void onRejectCallWithMessage(String message) {
call.reject(true /* rejectWithMessage */, message);
onDismissDialog();
+ addTimeoutCheck();
}
@Override
@@ -100,6 +113,7 @@
call.answer();
}
}
+ addTimeoutCheck();
}
@Override
@@ -114,6 +128,7 @@
} else {
call.reject(false /* rejectWithMessage */, null);
}
+ addTimeoutCheck();
}
@Override
@@ -128,6 +143,7 @@
activeCall.addListener(new AnswerOnDisconnected(activeCall));
activeCall.disconnect();
}
+ addTimeoutCheck();
}
@Override
@@ -165,7 +181,7 @@
private final DialerCall disconnectingCall;
- public AnswerOnDisconnected(DialerCall disconnectingCall) {
+ AnswerOnDisconnected(DialerCall disconnectingCall) {
this.disconnectingCall = disconnectingCall;
}
@@ -209,4 +225,23 @@
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);
+ }
+ }
}