diff options
author | Santos Cordon <santoscordon@google.com> | 2013-11-14 13:49:14 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-11-14 13:49:14 -0800 |
commit | d522c551102c251c9d6223efa1cff2b92b27c79d (patch) | |
tree | d044f23bf0f330cf692eff8b8d7a99cd7360278c /InCallUI | |
parent | e2b8dcc3c6527c181b3bd4d6d8f7f6c264e8d222 (diff) | |
parent | cd83c12b31b1a7df7d83edf5fd62dca4f35c89c3 (diff) |
am 0b2b20a9: Add incoming-during-hold case to fullscreen Notification code.
* commit '0b2b20a9dbecff3e0ac345b559caeaae779de03d':
Add incoming-during-hold case to fullscreen Notification code.
Diffstat (limited to 'InCallUI')
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallPresenter.java | 2 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/StatusBarNotifier.java | 21 |
2 files changed, 16 insertions, 7 deletions
diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java index bfb4a5019..80c47395f 100644 --- a/InCallUI/src/com/android/incallui/InCallPresenter.java +++ b/InCallUI/src/com/android/incallui/InCallPresenter.java @@ -94,7 +94,7 @@ public class InCallPresenter implements CallList.Listener { mContactInfoCache = ContactInfoCache.getInstance(context); - mStatusBarNotifier = new StatusBarNotifier(context, mContactInfoCache, mCallList); + mStatusBarNotifier = new StatusBarNotifier(context, mContactInfoCache); addListener(mStatusBarNotifier); mAudioModeProvider = audioModeProvider; diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java index 89c9ff41e..6d9fd600c 100644 --- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java +++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java @@ -96,8 +96,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener { private Bitmap mSavedLargeIcon; private String mSavedContentTitle; - public StatusBarNotifier(Context context, ContactInfoCache contactInfoCache, - CallList callList) { + public StatusBarNotifier(Context context, ContactInfoCache contactInfoCache) { Preconditions.checkNotNull(context); mContext = context; @@ -254,12 +253,15 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener { } private void showNotification(final Call call, final boolean allowFullScreenIntent) { + final boolean isIncoming = (call.getState() == Call.State.INCOMING || + call.getState() == Call.State.CALL_WAITING); + // we make a call to the contact info cache to query for supplemental data to what the // call provides. This includes the contact name and photo. // This callback will always get called immediately and synchronously with whatever data // it has available, and may make a subsequent call later (same thread) if it had to // call into the contacts provider for more data. - mContactInfoCache.findInfo(call.getIdentification(), call.getState() == Call.State.INCOMING, + mContactInfoCache.findInfo(call.getIdentification(), isIncoming, new ContactInfoCacheCallback() { private boolean mAllowFullScreenIntent = allowFullScreenIntent; @@ -457,12 +459,12 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener { } /** - * Returns the message to use with the notificaiton. + * Returns the message to use with the notification. */ private int getContentString(Call call) { int resId = R.string.notification_ongoing_call; - if (call.getState() == Call.State.INCOMING) { + if (call.getState() == Call.State.INCOMING || call.getState() == Call.State.CALL_WAITING) { resId = R.string.notification_incoming_call; } else if (call.getState() == Call.State.ONHOLD) { @@ -535,7 +537,14 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener { // TODO: there should be a cleaner way of avoiding this // problem (see discussion in bug 3184149.) - if (call.getState() == Call.State.CALL_WAITING) { + // If a call is onhold during an incoming call, the call actually comes in as + // INCOMING. For that case *and* traditional call-waiting, we want to + // cancel the notification. + boolean isCallWaiting = (call.getState() == Call.State.CALL_WAITING || + (call.getState() == Call.State.INCOMING && + CallList.getInstance().getBackgroundCall() != null)); + + if (isCallWaiting) { Log.i(this, "updateInCallNotification: call-waiting! force relaunch..."); // Cancel the IN_CALL_NOTIFICATION immediately before // (re)posting it; this seems to force the |