diff options
author | Tyler Gunn <tgunn@google.com> | 2015-08-05 08:20:34 -0700 |
---|---|---|
committer | Tyler Gunn <tgunn@google.com> | 2015-08-05 08:20:34 -0700 |
commit | 061fc22101930c3c69f454c85fbb85ff2c5c92fb (patch) | |
tree | ffd6b5e949faffb1907b0f9d0ba7880e449dcd76 /InCallUI/src/com/android/incallui/StatusBarNotifier.java | |
parent | 99f712322b481bce390626621a2f95b73122811a (diff) |
Last forwarded number and incoming call subject.
Last forwarded number:
- Added assets for the "forward" icon for last forwarded number.
- Modified InCall Call to store last forwarded number; also calls
onLastForwardedNumberChange callback (the last forwarded number is
received via a supp service update, so may change after call starts).
Call subject (i.e. instant lettering):
- Added placeholder subject_bubble asset to form the chat bubble for
incoming calls with a subject.
- Modified InCall Call to store the call subject (expected to be populated
in extras at start of call.
- Added code to hide the call status (e.g. "incoming call via XYZ") line
and primary call label (e.g. a location "California", or the number type
"Mobile" for the number). This was necessary to make room for the call
subject bubble, and is in line with the UX mocks.
- Change call subject text color to background color of call card (per
UX mocks)
- Modified call notification to show call subject if it is specified.
- Moved code to show HD icon into common method.
Bug: 22685114
Change-Id: I22d9dae16658490e3245cfdd9c936bb0584cd6db
Diffstat (limited to 'InCallUI/src/com/android/incallui/StatusBarNotifier.java')
-rw-r--r-- | InCallUI/src/com/android/incallui/StatusBarNotifier.java | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java index 8df4520bf..e583434da 100644 --- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java +++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java @@ -40,6 +40,8 @@ import com.android.incallui.InCallPresenter.InCallState; import com.google.common.base.Preconditions; +import java.util.Objects; + /** * This class adds Notifications to the status bar for the in-call experience. */ @@ -60,7 +62,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, private int mCurrentNotification = NOTIFICATION_NONE; private int mCallState = Call.State.INVALID; private int mSavedIcon = 0; - private int mSavedContent = 0; + private String mSavedContent = null; private Bitmap mSavedLargeIcon; private String mSavedContentTitle; private String mCallId = null; @@ -206,7 +208,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, // Check if data has changed; if nothing is different, don't issue another notification. final int iconResId = getIconToDisplay(call); Bitmap largeIcon = getLargeIconToDisplay(contactInfo, call); - final int contentResId = getContentString(call); + final String content = getContentString(call); final String contentTitle = getContentTitle(contactInfo, call); final int notificationType; @@ -218,7 +220,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, notificationType = NOTIFICATION_IN_CALL; } - if (!checkForChangeAndSaveData(iconResId, contentResId, largeIcon, contentTitle, state, + if (!checkForChangeAndSaveData(iconResId, content, largeIcon, contentTitle, state, notificationType)) { return; } @@ -244,7 +246,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, } // Set the content - builder.setContentText(mContext.getString(contentResId)); + builder.setContentText(content); builder.setSmallIcon(iconResId); builder.setContentTitle(contentTitle); builder.setLargeIcon(largeIcon); @@ -306,7 +308,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, * are already displaying. If the data is exactly the same, we return false so that * we do not issue a new notification for the exact same data. */ - private boolean checkForChangeAndSaveData(int icon, int content, Bitmap largeIcon, + private boolean checkForChangeAndSaveData(int icon, String content, Bitmap largeIcon, String contentTitle, int state, int notificationType) { // The two are different: @@ -317,7 +319,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, (contentTitle == null && mSavedContentTitle != null); // any change means we are definitely updating - boolean retval = (mSavedIcon != icon) || (mSavedContent != content) || + boolean retval = (mSavedIcon != icon) || !Objects.equals(mSavedContent, content) || (mCallState != state) || (mSavedLargeIcon != largeIcon) || contentTitleChanged; @@ -419,13 +421,20 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, /** * Returns the message to use with the notification. */ - private int getContentString(Call call) { + private String getContentString(Call call) { + boolean isIncomingOrWaiting = call.getState() == Call.State.INCOMING || + call.getState() == Call.State.CALL_WAITING; + + if (isIncomingOrWaiting && !TextUtils.isEmpty(call.getCallSubject())) { + return call.getCallSubject(); + } + int resId = R.string.notification_ongoing_call; if (call.hasProperty(Details.PROPERTY_WIFI)) { resId = R.string.notification_ongoing_call_wifi; } - if (call.getState() == Call.State.INCOMING || call.getState() == Call.State.CALL_WAITING) { + if (isIncomingOrWaiting) { if (call.hasProperty(Details.PROPERTY_WIFI)) { resId = R.string.notification_incoming_call_wifi; } else { @@ -440,7 +449,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, resId = R.string.notification_requesting_video_call; } - return resId; + return mContext.getString(resId); } /** @@ -637,4 +646,9 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, updateNotification(mInCallState, CallList.getInstance()); } } + + @Override + public void onLastForwardedNumberChange() { + // no-op + } } |