summaryrefslogtreecommitdiff
path: root/core/java/android/app/Notification.java
diff options
context:
space:
mode:
authorSteve Elliott <steell@google.com>2020-03-25 14:26:42 -0400
committerSteve Elliott <steell@google.com>2020-03-31 16:20:39 -0400
commit239e6cb1df6a932cd05826427369837efab09080 (patch)
treeee2d1e6bd316abced01223b7379373d0ad2e2546 /core/java/android/app/Notification.java
parent4fca5e9d5bccc13f4fd12b54ff32ddc24cf05e47 (diff)
Add unread count badge to conversation layout
Fixes: 152303800 Test: manual, visual Change-Id: I9308a15ab223086398ba073b08d60cb7c50d8c30
Diffstat (limited to 'core/java/android/app/Notification.java')
-rw-r--r--core/java/android/app/Notification.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 9b42fa2012e1..f461a1708373 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -1232,6 +1232,10 @@ public class Notification implements Parcelable
/** @hide */
public static final String EXTRA_CONVERSATION_ICON = "android.conversationIcon";
+ /** @hide */
+ public static final String EXTRA_CONVERSATION_UNREAD_MESSAGE_COUNT =
+ "android.conversationUnreadMessageCount";
+
/**
* {@link #extras} key: an array of {@link android.app.Notification.MessagingStyle.Message}
* bundles provided by a
@@ -7102,6 +7106,7 @@ public class Notification implements Parcelable
List<Message> mHistoricMessages = new ArrayList<>();
boolean mIsGroupConversation;
@ConversationType int mConversationType = CONVERSATION_TYPE_LEGACY;
+ int mUnreadMessageCount;
MessagingStyle() {
}
@@ -7247,6 +7252,17 @@ public class Notification implements Parcelable
return mConversationType;
}
+ /** @hide */
+ public int getUnreadMessageCount() {
+ return mUnreadMessageCount;
+ }
+
+ /** @hide */
+ public MessagingStyle setUnreadMessageCount(int unreadMessageCount) {
+ mUnreadMessageCount = unreadMessageCount;
+ return this;
+ }
+
/**
* Adds a message for display by this notification. Convenience call for a simple
* {@link Message} in {@link #addMessage(Notification.MessagingStyle.Message)}.
@@ -7401,6 +7417,7 @@ public class Notification implements Parcelable
if (mShortcutIcon != null) {
extras.putParcelable(EXTRA_CONVERSATION_ICON, mShortcutIcon);
}
+ extras.putInt(EXTRA_CONVERSATION_UNREAD_MESSAGE_COUNT, mUnreadMessageCount);
fixTitleAndTextExtras(extras);
extras.putBoolean(EXTRA_IS_GROUP_CONVERSATION, mIsGroupConversation);
@@ -7452,6 +7469,7 @@ public class Notification implements Parcelable
Parcelable[] histMessages = extras.getParcelableArray(EXTRA_HISTORIC_MESSAGES);
mHistoricMessages = Message.getMessagesFromBundleArray(histMessages);
mIsGroupConversation = extras.getBoolean(EXTRA_IS_GROUP_CONVERSATION);
+ mUnreadMessageCount = extras.getInt(EXTRA_CONVERSATION_UNREAD_MESSAGE_COUNT);
}
/**
@@ -7601,6 +7619,7 @@ public class Notification implements Parcelable
: mBuilder.getMessagingLayoutResource(),
p,
bindResult);
+
addExtras(mBuilder.mN.extras);
if (!isConversationLayout) {
// also update the end margin if there is an image