summaryrefslogtreecommitdiffstats
path: root/java/com/android/incallui/answer
diff options
context:
space:
mode:
authorwangqi <wangqi@google.com>2017-10-11 17:46:07 -0700
committerEric Erfanian <erfanian@google.com>2017-10-12 14:30:51 -0700
commit9982f0db5e9b74a66d22befa113073c9cfcd221e (patch)
treeb5307eb2e3ebbd1ac616441f3c562babcdbd84db /java/com/android/incallui/answer
parent2cec38000c225d15a7b895db28541f4be2f2df7b (diff)
downloadandroid_packages_apps_Dialer-9982f0db5e9b74a66d22befa113073c9cfcd221e.tar.gz
android_packages_apps_Dialer-9982f0db5e9b74a66d22befa113073c9cfcd221e.tar.bz2
android_packages_apps_Dialer-9982f0db5e9b74a66d22befa113073c9cfcd221e.zip
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/answer')
-rw-r--r--java/com/android/incallui/answer/impl/AnswerFragment.java10
-rw-r--r--java/com/android/incallui/answer/impl/answermethod/FlingUpDownMethod.java9
-rw-r--r--java/com/android/incallui/answer/impl/classifier/FalsingManager.java7
3 files changed, 26 insertions, 0 deletions
diff --git a/java/com/android/incallui/answer/impl/AnswerFragment.java b/java/com/android/incallui/answer/impl/AnswerFragment.java
index 3476557ba..f0b0c0fde 100644
--- a/java/com/android/incallui/answer/impl/AnswerFragment.java
+++ b/java/com/android/incallui/answer/impl/AnswerFragment.java
@@ -744,6 +744,7 @@ public class AnswerFragment extends Fragment
@Override
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) {
+ Trace.beginSection("AnswerFragment.onViewCreated");
super.onViewCreated(view, savedInstanceState);
createInCallScreenDelegate();
updateUI();
@@ -751,18 +752,22 @@ public class AnswerFragment extends Fragment
if (savedInstanceState == null || !savedInstanceState.getBoolean(STATE_HAS_ANIMATED_ENTRY)) {
ViewUtil.doOnGlobalLayout(view, this::animateEntry);
}
+ Trace.endSection();
}
@Override
public void onResume() {
+ Trace.beginSection("AnswerFragment.onResume");
super.onResume();
LogUtil.i("AnswerFragment.onResume", null);
restoreSwipeHintTexts();
inCallScreenDelegate.onInCallScreenResumed();
+ Trace.endSection();
}
@Override
public void onStart() {
+ Trace.beginSection("AnswerFragment.onStart");
super.onStart();
LogUtil.i("AnswerFragment.onStart", null);
@@ -770,10 +775,12 @@ public class AnswerFragment extends Fragment
if (answerVideoCallScreen != null) {
answerVideoCallScreen.onVideoScreenStart();
}
+ Trace.endSection();
}
@Override
public void onStop() {
+ Trace.beginSection("AnswerFragment.onStop");
super.onStop();
LogUtil.i("AnswerFragment.onStop", null);
@@ -781,13 +788,16 @@ public class AnswerFragment extends Fragment
if (answerVideoCallScreen != null) {
answerVideoCallScreen.onVideoScreenStop();
}
+ Trace.endSection();
}
@Override
public void onPause() {
+ Trace.beginSection("AnswerFragment.onPause");
super.onPause();
LogUtil.i("AnswerFragment.onPause", null);
inCallScreenDelegate.onInCallScreenPaused();
+ Trace.endSection();
}
@Override
diff --git a/java/com/android/incallui/answer/impl/answermethod/FlingUpDownMethod.java b/java/com/android/incallui/answer/impl/answermethod/FlingUpDownMethod.java
index 5c1ee47e6..ea5956c8c 100644
--- a/java/com/android/incallui/answer/impl/answermethod/FlingUpDownMethod.java
+++ b/java/com/android/incallui/answer/impl/answermethod/FlingUpDownMethod.java
@@ -28,6 +28,7 @@ import android.content.res.ColorStateList;
import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
+import android.os.Trace;
import android.support.annotation.ColorInt;
import android.support.annotation.FloatRange;
import android.support.annotation.IntDef;
@@ -157,6 +158,7 @@ public class FlingUpDownMethod extends AnswerMethod implements OnProgressChanged
@Override
public void onStart() {
+ Trace.beginSection("FlingUpDownMethod.onStart");
super.onStart();
falsingManager.onScreenOn();
if (getView() != null) {
@@ -170,22 +172,26 @@ public class FlingUpDownMethod extends AnswerMethod implements OnProgressChanged
startSwipeToAnswerEntryAnimation();
}
}
+ Trace.endSection();
}
@Override
public void onStop() {
+ Trace.beginSection("FlingUpDownMethod.onStop");
endAnimation();
falsingManager.onScreenOff();
if (getActivity().isFinishing()) {
setAnimationState(AnimationState.COMPLETED);
}
super.onStop();
+ Trace.endSection();
}
@Nullable
@Override
public View onCreateView(
LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
+ Trace.beginSection("FlingUpDownMethod.onCreateView");
View view = layoutInflater.inflate(R.layout.swipe_up_down_method, viewGroup, false);
contactPuckContainer = view.findViewById(R.id.incoming_call_puck_container);
@@ -242,6 +248,7 @@ public class FlingUpDownMethod extends AnswerMethod implements OnProgressChanged
(ViewGroup) view.findViewById(R.id.hint_container),
contactPuckContainer,
swipeToAnswerText);
+ Trace.endSection();
return view;
}
@@ -400,6 +407,7 @@ public class FlingUpDownMethod extends AnswerMethod implements OnProgressChanged
}
private void updateSwipeTextAndPuckForTouch() {
+ Trace.beginSection("FlingUpDownMethod.updateSwipeTextAndPuckForTouch");
// Clamp progress value between -1 and 1.
final float clampedProgress = MathUtil.clamp(swipeProgress, -1 /* min */, 1 /* max */);
final float positiveAdjustedProgress = Math.abs(clampedProgress);
@@ -473,6 +481,7 @@ public class FlingUpDownMethod extends AnswerMethod implements OnProgressChanged
}
getParent().onAnswerProgressUpdate(clampedProgress);
+ Trace.endSection();
}
private void startSwipeToAnswerSwipeAnimation() {
diff --git a/java/com/android/incallui/answer/impl/classifier/FalsingManager.java b/java/com/android/incallui/answer/impl/classifier/FalsingManager.java
index fdcc0a3f9..9cdd888d1 100644
--- a/java/com/android/incallui/answer/impl/classifier/FalsingManager.java
+++ b/java/com/android/incallui/answer/impl/classifier/FalsingManager.java
@@ -22,6 +22,7 @@ import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.PowerManager;
+import android.os.Trace;
import android.view.MotionEvent;
import android.view.accessibility.AccessibilityManager;
@@ -130,11 +131,17 @@ public class FalsingManager implements SensorEventListener {
}
private void registerSensors(int[] sensors) {
+ Trace.beginSection("FalsingManager.registerSensors");
for (int sensorType : sensors) {
+ Trace.beginSection("get sensor " + sensorType);
Sensor s = mSensorManager.getDefaultSensor(sensorType);
+ Trace.endSection();
if (s != null) {
+ Trace.beginSection("register");
mSensorManager.registerListener(this, s, SensorManager.SENSOR_DELAY_GAME);
+ Trace.endSection();
}
}
+ Trace.endSection();
}
}