diff options
| author | wangqi <wangqi@google.com> | 2017-10-11 17:46:07 -0700 |
|---|---|---|
| committer | Eric Erfanian <erfanian@google.com> | 2017-10-12 14:30:51 -0700 |
| commit | 9982f0db5e9b74a66d22befa113073c9cfcd221e (patch) | |
| tree | b5307eb2e3ebbd1ac616441f3c562babcdbd84db /java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java | |
| parent | 2cec38000c225d15a7b895db28541f4be2f2df7b (diff) | |
Optimization for incoming call latency.
There are many binder call triggered by IPC on main thread. This change will try to reduce them by caching thing that's bound to a call. It reduce total binder transaction from 1002 to 664 and saves ~11% latency of incoming call on locked screen.
1. Cache isVoiceMailNumber in DialerCall
2. Cache call capable accounts in DialerCall
3. Cache current country iso in DialerCall
4. Don't set orientation change if it's not changed.
This change also add lots of trace info. It won't affect release build though since they are stripped out by proguard.
Bug: 64542087
Test: manual
PiperOrigin-RevId: 171901266
Change-Id: Iec48f030529aa59974212147276f6d0ae121872a
Diffstat (limited to 'java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java')
| -rw-r--r-- | java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java b/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java index 16fad8b17..113144b7f 100644 --- a/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java +++ b/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java @@ -19,6 +19,7 @@ package com.android.incallui.answerproximitysensor; import android.content.Context; import android.hardware.display.DisplayManager; import android.os.PowerManager; +import android.os.Trace; import android.view.Display; import com.android.dialer.common.LogUtil; import com.android.dialer.configprovider.ConfigProviderBindings; @@ -43,16 +44,19 @@ public class AnswerProximitySensor private final AnswerProximityWakeLock answerProximityWakeLock; public static boolean shouldUse(Context context, DialerCall call) { + Trace.beginSection("AnswerProximitySensor.shouldUse"); // Don't use the AnswerProximitySensor for call waiting and other states. Those states are // handled by the general ProximitySensor code. if (call.getState() != State.INCOMING) { LogUtil.i("AnswerProximitySensor.shouldUse", "call state is not incoming"); + Trace.endSection(); return false; } if (!ConfigProviderBindings.get(context) .getBoolean(CONFIG_ANSWER_PROXIMITY_SENSOR_ENABLED, true)) { LogUtil.i("AnswerProximitySensor.shouldUse", "disabled by config"); + Trace.endSection(); return false; } @@ -60,19 +64,23 @@ public class AnswerProximitySensor .getSystemService(PowerManager.class) .isWakeLockLevelSupported(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK)) { LogUtil.i("AnswerProximitySensor.shouldUse", "wake lock level not supported"); + Trace.endSection(); return false; } if (isDefaultDisplayOn(context)) { LogUtil.i("AnswerProximitySensor.shouldUse", "display is already on"); + Trace.endSection(); return false; } + Trace.endSection(); return true; } public AnswerProximitySensor( Context context, DialerCall call, PseudoScreenState pseudoScreenState) { + Trace.beginSection("AnswerProximitySensor Constructor"); this.call = call; LogUtil.i("AnswerProximitySensor.constructor", "acquiring lock"); @@ -90,11 +98,14 @@ public class AnswerProximitySensor answerProximityWakeLock.acquire(); call.addListener(this); + Trace.endSection(); } private void cleanup() { + Trace.beginSection("AnswerProximitySensor.Cleanup"); call.removeListener(this); releaseProximityWakeLock(); + Trace.endSection(); } private void releaseProximityWakeLock() { |
