From be75d5170892cf1acaeca5df4ad31e591e148595 Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Fri, 9 Oct 2020 14:45:41 -0400 Subject: [PATCH 1/2] Allow NLSes to see conversation information Test: atest Bug: 167547800 Change-Id: I9b7930951fa7d2550b21c0fa398fc7ff7cc9566f --- api/current.txt | 2 ++ .../notification/NotificationListenerService.java | 10 +++++++--- non-updatable-api/current.txt | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/api/current.txt b/api/current.txt index 83df1d97dbfff..c3fb70c9dbd11 100644 --- a/api/current.txt +++ b/api/current.txt @@ -44100,11 +44100,13 @@ package android.service.notification { method public long getLastAudiblyAlertedMillis(); method public String getOverrideGroupKey(); method public int getRank(); + method @Nullable public android.content.pm.ShortcutInfo getShortcutInfo(); method @NonNull public java.util.List getSmartActions(); method @NonNull public java.util.List getSmartReplies(); method public int getSuppressedVisualEffects(); method public int getUserSentiment(); method public boolean isAmbient(); + method public boolean isConversation(); method public boolean isSuspended(); method public boolean matchesInterruptionFilter(); field public static final int USER_SENTIMENT_NEGATIVE = -1; // 0xffffffff diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java index 5d34c476a4a64..a1e4c39b70c15 100644 --- a/core/java/android/service/notification/NotificationListenerService.java +++ b/core/java/android/service/notification/NotificationListenerService.java @@ -1864,8 +1864,9 @@ public abstract class NotificationListenerService extends Service { } /** - * Returns whether this notification is a conversation notification. - * @hide + * Returns whether this notification is a conversation notification, and would appear + * in the conversation section of the notification shade, on devices that separate that + * type of notification. */ public boolean isConversation() { return mIsConversation; @@ -1880,7 +1881,10 @@ public abstract class NotificationListenerService extends Service { } /** - * @hide + * Returns the shortcut information associated with this notification, if it is a + * {@link #isConversation() conversation notification}. + *

This might be null even if the notification is a conversation notification, if + * the posting app hasn't opted into the full conversation feature set yet.

*/ public @Nullable ShortcutInfo getShortcutInfo() { return mShortcutInfo; diff --git a/non-updatable-api/current.txt b/non-updatable-api/current.txt index a0aa0e09084bc..bd6ff5c2c780e 100644 --- a/non-updatable-api/current.txt +++ b/non-updatable-api/current.txt @@ -42234,11 +42234,13 @@ package android.service.notification { method public long getLastAudiblyAlertedMillis(); method public String getOverrideGroupKey(); method public int getRank(); + method @Nullable public android.content.pm.ShortcutInfo getShortcutInfo(); method @NonNull public java.util.List getSmartActions(); method @NonNull public java.util.List getSmartReplies(); method public int getSuppressedVisualEffects(); method public int getUserSentiment(); method public boolean isAmbient(); + method public boolean isConversation(); method public boolean isSuspended(); method public boolean matchesInterruptionFilter(); field public static final int USER_SENTIMENT_NEGATIVE = -1; // 0xffffffff From e57d36d4fd1fce48d4446d9756034d06ce9659c8 Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Fri, 9 Oct 2020 16:04:06 -0400 Subject: [PATCH 2/2] Add flag for pendingintent Test: make Fixes: 170422191 Change-Id: I9e803606034c04cad5a0e0db1d9c6d115fab2210 --- core/java/android/app/Notification.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 0d682d64fb08f..54380629e4cad 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -2240,7 +2240,8 @@ public class Notification implements Parcelable .setTicker(tickerText) .setContentTitle(contentTitle) .setContentText(contentText) - .setContentIntent(PendingIntent.getActivity(context, 0, contentIntent, 0)) + .setContentIntent(PendingIntent.getActivity( + context, 0, contentIntent, PendingIntent.FLAG_MUTABLE)) .buildInto(this); }