summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSantos Cordon <santoscordon@google.com>2013-11-13 17:51:11 -0800
committerSantos Cordon <santoscordon@google.com>2013-11-14 11:56:47 -0800
commitcd83c12b31b1a7df7d83edf5fd62dca4f35c89c3 (patch)
tree1989ddc26b6ecff7379ef37838f6fcfcd2d25483
parent4233d32f3ecae7e0d9cfaaff650fa08911cf3677 (diff)
Add incoming-during-hold case to fullscreen Notification code.
We use fullScreen notifications to bring up the incoming call screen when it is not already being shown. Android framework ignores fullScreen property if the same notification ID already exists. To fix that we cancel the notification right before setting it to full screen. We only used to do that for the CALL_WAITING state since that when it mattered. However, if the current call is on hold, a new call comes in as INCOMING instead of CALL_WAITING so this change adds that condition as well. Also fixed two other minor pieces of code which only checked INCOMING and not CALL_WAITING. One for an icon, the other used to acquiring location as part of the contact info (we only do so for incoming calls). bug:11578080 Change-Id: Id010a6848cd1ca06d68e8405041565bc008a781e
-rw-r--r--InCallUI/src/com/android/incallui/InCallPresenter.java2
-rw-r--r--InCallUI/src/com/android/incallui/StatusBarNotifier.java21
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