diff options
Diffstat (limited to 'java/com/android/incallui/InCallPresenter.java')
-rw-r--r-- | java/com/android/incallui/InCallPresenter.java | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java index 0dd654903..6c08c497b 100644 --- a/java/com/android/incallui/InCallPresenter.java +++ b/java/com/android/incallui/InCallPresenter.java @@ -21,6 +21,7 @@ import android.content.Intent; import android.graphics.Point; import android.os.Bundle; import android.os.Handler; +import android.os.Trace; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; @@ -41,6 +42,7 @@ import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler.OnCheckBlocke import com.android.dialer.blocking.FilteredNumberCompat; import com.android.dialer.blocking.FilteredNumbersUtil; import com.android.dialer.common.LogUtil; +import com.android.dialer.common.concurrent.DefaultDialerExecutorFactory; import com.android.dialer.enrichedcall.EnrichedCallComponent; import com.android.dialer.location.GeoUtil; import com.android.dialer.logging.InteractionEvent; @@ -189,6 +191,8 @@ public class InCallPresenter implements CallList.Listener { /** Determines if the InCall UI is in fullscreen mode or not. */ private boolean mIsFullScreen = false; + private boolean mScreenTimeoutEnabled = true; + private PhoneStateListener mPhoneStateListener = new PhoneStateListener() { @Override @@ -321,11 +325,13 @@ public class InCallPresenter implements CallList.Listener { ContactInfoCache contactInfoCache, ProximitySensor proximitySensor, FilteredNumberAsyncQueryHandler filteredNumberQueryHandler) { + Trace.beginSection("InCallPresenter.setUp"); if (mServiceConnected) { LogUtil.i("InCallPresenter.setUp", "New service connection replacing existing one."); if (context != mContext || callList != mCallList) { throw new IllegalStateException(); } + Trace.endSection(); return; } @@ -360,7 +366,7 @@ public class InCallPresenter implements CallList.Listener { mCallList.addListener(this); // Create spam call list listener and add it to the list of listeners - mSpamCallListListener = new SpamCallListListener(context); + mSpamCallListListener = new SpamCallListListener(context, new DefaultDialerExecutorFactory()); mCallList.addListener(mSpamCallListListener); VideoPauseController.getInstance().setUp(this); @@ -371,6 +377,7 @@ public class InCallPresenter implements CallList.Listener { .listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); LogUtil.d("InCallPresenter.setUp", "Finished InCallPresenter.setUp"); + Trace.endSection(); } /** @@ -395,6 +402,7 @@ public class InCallPresenter implements CallList.Listener { } private void attemptFinishActivity() { + mScreenTimeoutEnabled = true; final boolean doFinish = (mInCallActivity != null && isActivityStarted()); LogUtil.i("InCallPresenter.attemptFinishActivity", "Hide in call UI: " + doFinish); if (doFinish) { @@ -510,6 +518,7 @@ public class InCallPresenter implements CallList.Listener { } public void onCallAdded(final android.telecom.Call call) { + Trace.beginSection("InCallPresenter.onCallAdded"); LatencyReport latencyReport = new LatencyReport(call); if (shouldAttemptBlocking(call)) { maybeBlockCall(call, latencyReport); @@ -525,6 +534,7 @@ public class InCallPresenter implements CallList.Listener { // Since a call has been added we are no longer waiting for Telecom to send us a call. setBoundAndWaitingForOutgoingCall(false, null); call.registerCallback(mCallCallback); + Trace.endSection(); } private boolean shouldAttemptBlocking(android.telecom.Call call) { @@ -687,11 +697,14 @@ public class InCallPresenter implements CallList.Listener { */ @Override public void onCallListChange(CallList callList) { + Trace.beginSection("InCallPresenter.onCallListChange"); if (mInCallActivity != null && mInCallActivity.isInCallScreenAnimating()) { mAwaitingCallListUpdate = true; + Trace.endSection(); return; } if (callList == null) { + Trace.endSection(); return; } @@ -741,11 +754,13 @@ public class InCallPresenter implements CallList.Listener { callList.getActiveOrBackgroundCall() != null || callList.getOutgoingCall() != null; mInCallActivity.dismissKeyguard(hasCall); } + Trace.endSection(); } /** Called when there is a new incoming call. */ @Override public void onIncomingCall(DialerCall call) { + Trace.beginSection("InCallPresenter.onIncomingCall"); InCallState newState = startOrFinishUi(InCallState.INCOMING); InCallState oldState = mInCallState; @@ -761,6 +776,7 @@ public class InCallPresenter implements CallList.Listener { // Re-evaluate which fragment is being shown. mInCallActivity.onPrimaryCallStateChanged(); } + Trace.endSection(); } @Override @@ -1064,6 +1080,7 @@ public class InCallPresenter implements CallList.Listener { // TODO(maxwelb) - b/36649622: Investigate this redundant call mStatusBarNotifier.updateNotification(mCallList); } + applyScreenTimeout(); } /*package*/ @@ -1577,13 +1594,18 @@ public class InCallPresenter implements CallList.Listener { public void enableScreenTimeout(boolean enable) { LogUtil.v("InCallPresenter.enableScreenTimeout", "enableScreenTimeout: value=" + enable); + mScreenTimeoutEnabled = enable; + applyScreenTimeout(); + } + + private void applyScreenTimeout() { if (mInCallActivity == null) { - LogUtil.e("InCallPresenter.enableScreenTimeout", "InCallActivity is null."); + LogUtil.e("InCallPresenter.applyScreenTimeout", "InCallActivity is null."); return; } final Window window = mInCallActivity.getWindow(); - if (enable) { + if (mScreenTimeoutEnabled) { window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } else { window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); |