diff options
author | Santos Cordon <santoscordon@google.com> | 2013-11-21 14:45:39 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-11-21 14:45:39 -0800 |
commit | 4ad60cb38a892b0cf9842dad8129027970643721 (patch) | |
tree | c51c30421754c157c847cad090b93f108a330498 | |
parent | c1b8556d705169ff9ba8268ab7f2356c3c4c8c84 (diff) | |
parent | 9d424fce7ef11fd6b5b390834b466db170df7fec (diff) |
am 7f1d6342: am 1d0e426e: am 78cbbb3f: am 0b2b20a9: Add incoming-during-hold case to fullscreen Notification code.
* commit '7f1d6342bd61a1e4e6b3198f3f7602b3cb378cce':
Add incoming-during-hold case to fullscreen Notification code.
-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 7c60bef6f..86568c6b0 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 |