From 9982f0db5e9b74a66d22befa113073c9cfcd221e Mon Sep 17 00:00:00 2001 From: wangqi Date: Wed, 11 Oct 2017 17:46:07 -0700 Subject: 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 --- java/com/android/incallui/StatusBarNotifier.java | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'java/com/android/incallui/StatusBarNotifier.java') diff --git a/java/com/android/incallui/StatusBarNotifier.java b/java/com/android/incallui/StatusBarNotifier.java index 7146c7235..e5908f12e 100644 --- a/java/com/android/incallui/StatusBarNotifier.java +++ b/java/com/android/incallui/StatusBarNotifier.java @@ -541,6 +541,18 @@ public class StatusBarNotifier || !Objects.equals(mRingtone, ringtone) || !Objects.equals(savedCallAudioState, callAudioState); + LogUtil.d( + "StatusBarNotifier.checkForChangeAndSaveData", + "data changed: icon: %b, content: %b, state: %b, largeIcon: %b, title: %b, ringtone: %b, " + + "audioState: %b, type: %b", + (mSavedIcon != icon), + !Objects.equals(mSavedContent, content), + (mCallState != state), + largeIconChanged, + contentTitleChanged, + !Objects.equals(mRingtone, ringtone), + !Objects.equals(savedCallAudioState, callAudioState), + mCurrentNotification != notificationType); // If we aren't showing a notification right now or the notification type is changing, // definitely do an update. if (mCurrentNotification != notificationType) { @@ -614,7 +626,7 @@ public class StatusBarNotifier @ContactType int contactType = LetterTileDrawable.getContactTypeFromPrimitives( - CallerInfoUtils.isVoiceMailNumber(context, call), + call.isVoiceMailNumber(), call.isSpam(), contactInfo.isBusiness, call.getNumberPresentation(), @@ -709,7 +721,7 @@ public class StatusBarNotifier resId = getECIncomingCallText(call.getEnrichedCallSession()); } else if (call.hasProperty(Details.PROPERTY_WIFI)) { resId = R.string.notification_incoming_call_wifi_template; - } else if (call.getAccountHandle() != null && hasMultiplePhoneAccounts()) { + } else if (call.getAccountHandle() != null && hasMultiplePhoneAccounts(call)) { return getMultiSimIncomingText(call); } else if (call.isVideoCall()) { resId = R.string.notification_incoming_video_call; @@ -1043,9 +1055,11 @@ public class StatusBarNotifier mStatusBarCallListener = listener; } - @SuppressWarnings("MissingPermission") - private boolean hasMultiplePhoneAccounts() { - return mContext.getSystemService(TelecomManager.class).getCallCapablePhoneAccounts().size() > 1; + private boolean hasMultiplePhoneAccounts(DialerCall call) { + if (call.getCallCapableAccounts() == null) { + return false; + } + return call.getCallCapableAccounts().size() > 1; } @Override -- cgit v1.2.3