summaryrefslogtreecommitdiff
path: root/java/com
diff options
context:
space:
mode:
authorwangqi <wangqi@google.com>2017-07-28 18:26:11 -0700
committerEric Erfanian <erfanian@google.com>2017-07-31 09:49:53 -0700
commite4030e8376e5052157910aae31ff838ad8157e4e (patch)
treeb3a59e170fa4c2c03f7f2187910fa437404a4975 /java/com
parenta69311f29586cd5f374fa98a5a217a45b97e306d (diff)
Add some trace information for incall.
This will help us better understanding where it spends time for bringing up an incoming call ui. The overhead is very light that could be ignored. Bug: 62426694 Test: none PiperOrigin-RevId: 163544107 Change-Id: I5520ed2b4b8085b8611af15e2c15c4c774446bec
Diffstat (limited to 'java/com')
-rw-r--r--java/com/android/incallui/CallButtonPresenter.java3
-rw-r--r--java/com/android/incallui/CallCardPresenter.java4
-rw-r--r--java/com/android/incallui/InCallActivity.java21
-rw-r--r--java/com/android/incallui/InCallPresenter.java12
-rw-r--r--java/com/android/incallui/InCallServiceImpl.java18
-rw-r--r--java/com/android/incallui/call/CallList.java14
-rw-r--r--java/com/android/incallui/call/DialerCall.java4
7 files changed, 72 insertions, 4 deletions
diff --git a/java/com/android/incallui/CallButtonPresenter.java b/java/com/android/incallui/CallButtonPresenter.java
index d4b77ad3c..4da227c31 100644
--- a/java/com/android/incallui/CallButtonPresenter.java
+++ b/java/com/android/incallui/CallButtonPresenter.java
@@ -18,6 +18,7 @@ package com.android.incallui;
import android.content.Context;
import android.os.Bundle;
+import android.os.Trace;
import android.support.v4.app.Fragment;
import android.support.v4.os.UserManagerCompat;
import android.telecom.CallAudioState;
@@ -101,6 +102,7 @@ public class CallButtonPresenter
@Override
public void onStateChange(InCallState oldState, InCallState newState, CallList callList) {
+ Trace.beginSection("CallButtonPresenter.onStateChange");
if (newState == InCallState.OUTGOING) {
mCall = callList.getOutgoingCall();
} else if (newState == InCallState.INCALL) {
@@ -124,6 +126,7 @@ public class CallButtonPresenter
mCall = null;
}
updateUi(newState, mCall);
+ Trace.endSection();
}
/**
diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java
index 390683233..afd2342bf 100644
--- a/java/com/android/incallui/CallCardPresenter.java
+++ b/java/com/android/incallui/CallCardPresenter.java
@@ -28,6 +28,7 @@ import android.graphics.drawable.Drawable;
import android.hardware.display.DisplayManager;
import android.os.BatteryManager;
import android.os.Handler;
+import android.os.Trace;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
@@ -247,8 +248,10 @@ public class CallCardPresenter
@Override
public void onStateChange(InCallState oldState, InCallState newState, CallList callList) {
+ Trace.beginSection("CallCardPresenter.onStateChange");
LogUtil.v("CallCardPresenter.onStateChange", "oldState: %s, newState: %s", oldState, newState);
if (mInCallScreen == null) {
+ Trace.endSection();
return;
}
@@ -345,6 +348,7 @@ public class CallCardPresenter
callState != DialerCall.State.INCOMING /* animate */);
maybeSendAccessibilityEvent(oldState, newState, primaryChanged);
+ Trace.endSection();
}
@Override
diff --git a/java/com/android/incallui/InCallActivity.java b/java/com/android/incallui/InCallActivity.java
index c95086c1e..3ea2b176f 100644
--- a/java/com/android/incallui/InCallActivity.java
+++ b/java/com/android/incallui/InCallActivity.java
@@ -21,6 +21,7 @@ import android.content.Intent;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.GradientDrawable.Orientation;
import android.os.Bundle;
+import android.os.Trace;
import android.support.annotation.ColorInt;
import android.support.annotation.FloatRange;
import android.support.annotation.NonNull;
@@ -112,6 +113,7 @@ public class InCallActivity extends TransactionSafeFragmentActivity
@Override
protected void onCreate(Bundle icicle) {
+ Trace.beginSection("InCallActivity.onCreate");
LogUtil.i("InCallActivity.onCreate", "");
super.onCreate(icicle);
@@ -129,6 +131,7 @@ public class InCallActivity extends TransactionSafeFragmentActivity
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
pseudoBlackScreenOverlay = findViewById(R.id.psuedo_black_screen_overlay);
+ Trace.endSection();
}
@Override
@@ -144,6 +147,7 @@ public class InCallActivity extends TransactionSafeFragmentActivity
@Override
protected void onStart() {
+ Trace.beginSection("InCallActivity.onStart");
LogUtil.i("InCallActivity.onStart", "");
super.onStart();
isVisible = true;
@@ -154,40 +158,49 @@ public class InCallActivity extends TransactionSafeFragmentActivity
// Hide the dialpad because there may not be enough room
showDialpadFragment(false, false);
}
+ Trace.endSection();
}
@Override
protected void onResume() {
+ Trace.beginSection("InCallActivity.onResume");
LogUtil.i("InCallActivity.onResume", "");
super.onResume();
common.onResume();
PseudoScreenState pseudoScreenState = InCallPresenter.getInstance().getPseudoScreenState();
pseudoScreenState.addListener(this);
onPseudoScreenStateChanged(pseudoScreenState.isOn());
+ Trace.endSection();
}
/** onPause is guaranteed to be called when the InCallActivity goes in the background. */
@Override
protected void onPause() {
+ Trace.beginSection("InCallActivity.onPause");
LogUtil.i("InCallActivity.onPause", "");
super.onPause();
common.onPause();
InCallPresenter.getInstance().getPseudoScreenState().removeListener(this);
+ Trace.endSection();
}
@Override
protected void onStop() {
+ Trace.beginSection("InCallActivity.onStop");
LogUtil.i("InCallActivity.onStop", "");
super.onStop();
common.onStop();
isVisible = false;
+ Trace.endSection();
}
@Override
protected void onDestroy() {
+ Trace.beginSection("InCallActivity.onDestroy");
LogUtil.i("InCallActivity.onDestroy", "");
super.onDestroy();
common.onDestroy();
+ Trace.endSection();
}
@Override
@@ -476,8 +489,10 @@ public class InCallActivity extends TransactionSafeFragmentActivity
}
public void onPrimaryCallStateChanged() {
+ Trace.beginSection("InCallActivity.onPrimaryCallStateChanged");
LogUtil.i("InCallActivity.onPrimaryCallStateChanged", "");
showMainInCallFragment();
+ Trace.endSection();
}
public void onWiFiToLteHandover(DialerCall call) {
@@ -514,15 +529,18 @@ public class InCallActivity extends TransactionSafeFragmentActivity
}
private void showMainInCallFragment() {
+ Trace.beginSection("InCallActivity.showMainInCallFragment");
// If the activity's onStart method hasn't been called yet then defer doing any work.
if (!isVisible) {
LogUtil.i("InCallActivity.showMainInCallFragment", "not visible yet/anymore");
+ Trace.endSection();
return;
}
// Don't let this be reentrant.
if (isInShowMainInCallFragment) {
LogUtil.i("InCallActivity.showMainInCallFragment", "already in method, bailing");
+ Trace.endSection();
return;
}
@@ -560,10 +578,13 @@ public class InCallActivity extends TransactionSafeFragmentActivity
}
if (didChangeInCall || didChangeVideo || didChangeAnswer) {
+ Trace.beginSection("InCallActivity.commitTransaction");
transaction.commitNow();
+ Trace.endSection();
Logger.get(this).logScreenView(ScreenEvent.Type.INCALL, this);
}
isInShowMainInCallFragment = false;
+ Trace.endSection();
}
private ShouldShowUiResult getShouldShowAnswerUi() {
diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java
index 0dd654903..c46c99ed0 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;
@@ -321,11 +322,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;
}
@@ -371,6 +374,7 @@ public class InCallPresenter implements CallList.Listener {
.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
LogUtil.d("InCallPresenter.setUp", "Finished InCallPresenter.setUp");
+ Trace.endSection();
}
/**
@@ -510,6 +514,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 +530,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 +693,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 +750,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 +772,7 @@ public class InCallPresenter implements CallList.Listener {
// Re-evaluate which fragment is being shown.
mInCallActivity.onPrimaryCallStateChanged();
}
+ Trace.endSection();
}
@Override
diff --git a/java/com/android/incallui/InCallServiceImpl.java b/java/com/android/incallui/InCallServiceImpl.java
index d2b029741..a2e243202 100644
--- a/java/com/android/incallui/InCallServiceImpl.java
+++ b/java/com/android/incallui/InCallServiceImpl.java
@@ -19,6 +19,7 @@ package com.android.incallui;
import android.content.Context;
import android.content.Intent;
import android.os.IBinder;
+import android.os.Trace;
import android.telecom.Call;
import android.telecom.CallAudioState;
import android.telecom.InCallService;
@@ -45,26 +46,35 @@ public class InCallServiceImpl extends InCallService {
@Override
public void onBringToForeground(boolean showDialpad) {
+ Trace.beginSection("InCallServiceImpl.onBringToForeground");
InCallPresenter.getInstance().onBringToForeground(showDialpad);
+ Trace.endSection();
}
@Override
public void onCallAdded(Call call) {
+ Trace.beginSection("InCallServiceImpl.onCallAdded");
InCallPresenter.getInstance().onCallAdded(call);
+ Trace.endSection();
}
@Override
public void onCallRemoved(Call call) {
+ Trace.beginSection("InCallServiceImpl.onCallRemoved");
InCallPresenter.getInstance().onCallRemoved(call);
+ Trace.endSection();
}
@Override
public void onCanAddCallChanged(boolean canAddCall) {
+ Trace.beginSection("InCallServiceImpl.onCanAddCallChanged");
InCallPresenter.getInstance().onCanAddCallChanged(canAddCall);
+ Trace.endSection();
}
@Override
public IBinder onBind(Intent intent) {
+ Trace.beginSection("InCallServiceImpl.onBind");
final Context context = getApplicationContext();
final ContactInfoCache contactInfoCache = ContactInfoCache.getInstance(context);
InCallPresenter.getInstance()
@@ -85,20 +95,25 @@ public class InCallServiceImpl extends InCallService {
returnToCallController = new ReturnToCallController(this);
}
- return super.onBind(intent);
+ IBinder iBinder = super.onBind(intent);
+ Trace.endSection();
+ return iBinder;
}
@Override
public boolean onUnbind(Intent intent) {
+ Trace.beginSection("InCallServiceImpl.onUnbind");
super.onUnbind(intent);
InCallPresenter.getInstance().onServiceUnbind();
tearDown();
+ Trace.endSection();
return false;
}
private void tearDown() {
+ Trace.beginSection("InCallServiceImpl.tearDown");
Log.v(this, "tearDown");
// Tear down the InCall system
TelecomAdapter.getInstance().clearInCallService();
@@ -107,5 +122,6 @@ public class InCallServiceImpl extends InCallService {
returnToCallController.tearDown();
returnToCallController = null;
}
+ Trace.endSection();
}
}
diff --git a/java/com/android/incallui/call/CallList.java b/java/com/android/incallui/call/CallList.java
index 269fcd68b..d932c2488 100644
--- a/java/com/android/incallui/call/CallList.java
+++ b/java/com/android/incallui/call/CallList.java
@@ -114,7 +114,7 @@ public class CallList implements DialerCallDelegate {
public void onCallAdded(
final Context context, final android.telecom.Call telecomCall, LatencyReport latencyReport) {
- Trace.beginSection("onCallAdded");
+ Trace.beginSection("CallList.onCallAdded");
final DialerCall call =
new DialerCall(context, this, telecomCall, latencyReport, true /* registerCallback */);
logSecondIncomingCall(context, call);
@@ -123,6 +123,7 @@ public class CallList implements DialerCallDelegate {
manager.registerCapabilitiesListener(call);
manager.registerStateChangedListener(call);
+ Trace.beginSection("checkSpam");
final DialerCallListenerImpl dialerCallListener = new DialerCallListenerImpl(call);
call.addListener(dialerCallListener);
LogUtil.d("CallList.onCallAdded", "callState=" + call.getState());
@@ -169,7 +170,9 @@ public class CallList implements DialerCallDelegate {
updateUserMarkedSpamStatus(call, context, number, dialerCallListener);
}
+ Trace.endSection();
+ Trace.beginSection("checkBlock");
FilteredNumberAsyncQueryHandler filteredNumberAsyncQueryHandler =
new FilteredNumberAsyncQueryHandler(context);
@@ -185,6 +188,7 @@ public class CallList implements DialerCallDelegate {
},
call.getNumber(),
GeoUtil.getCurrentCountryIso(context));
+ Trace.endSection();
if (call.getState() == DialerCall.State.INCOMING
|| call.getState() == DialerCall.State.CALL_WAITING) {
@@ -353,6 +357,7 @@ public class CallList implements DialerCallDelegate {
/** Called when a single call has changed. */
private void onIncoming(DialerCall call) {
+ Trace.beginSection("CallList.onIncoming");
if (updateCallInMap(call)) {
LogUtil.i("CallList.onIncoming", String.valueOf(call));
}
@@ -360,6 +365,7 @@ public class CallList implements DialerCallDelegate {
for (Listener listener : mListeners) {
listener.onIncomingCall(call);
}
+ Trace.endSection();
}
public void addListener(@NonNull Listener listener) {
@@ -570,6 +576,7 @@ public class CallList implements DialerCallDelegate {
*/
@VisibleForTesting
void onUpdateCall(DialerCall call) {
+ Trace.beginSection("CallList.onUpdateCall");
LogUtil.d("CallList.onUpdateCall", String.valueOf(call));
if (!mCallById.containsKey(call.getId()) && call.isExternalCall()) {
// When a regular call becomes external, it is removed from the call list, and there may be
@@ -582,6 +589,7 @@ public class CallList implements DialerCallDelegate {
if (updateCallInMap(call)) {
LogUtil.i("CallList.onUpdateCall", String.valueOf(call));
}
+ Trace.endSection();
}
/**
@@ -606,6 +614,7 @@ public class CallList implements DialerCallDelegate {
* @return false if no call previously existed and no call was added, otherwise true.
*/
private boolean updateCallInMap(DialerCall call) {
+ Trace.beginSection("CallList.updateCallInMap");
Objects.requireNonNull(call);
boolean updated = false;
@@ -635,6 +644,7 @@ public class CallList implements DialerCallDelegate {
updated = true;
}
+ Trace.endSection();
return updated;
}
@@ -764,7 +774,7 @@ public class CallList implements DialerCallDelegate {
@Override
public void onDialerCallUpdate() {
- Trace.beginSection("onUpdate");
+ Trace.beginSection("CallList.onDialerCallUpdate");
onUpdateCall(mCall);
notifyGenericListeners();
Trace.endSection();
diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java
index 2e15264a5..20dab9692 100644
--- a/java/com/android/incallui/call/DialerCall.java
+++ b/java/com/android/incallui/call/DialerCall.java
@@ -430,7 +430,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
}
private void update() {
- Trace.beginSection("Update");
+ Trace.beginSection("DialerCall.update");
int oldState = getState();
// Clear any cache here that could potentially change on update.
videoTech = null;
@@ -455,6 +455,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
}
private void updateFromTelecomCall() {
+ Trace.beginSection("DialerCall.updateFromTelecomCall");
LogUtil.v("DialerCall.updateFromTelecomCall", mTelecomCall.toString());
mVideoTechManager.dispatchCallStateChanged(mTelecomCall.getState());
@@ -503,6 +504,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
}
}
}
+ Trace.endSection();
}
/**