Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationUiAdjustment.java +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ public class NotificationUiAdjustment { public static NotificationUiAdjustment extractFromNotificationEntry( NotificationEntry entry) { return new NotificationUiAdjustment( entry.key, entry.systemGeneratedSmartActions, entry.smartReplies); entry.key, entry.systemGeneratedSmartActions, entry.systemGeneratedSmartReplies); } public static boolean needReinflate( Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +4 −2 Original line number Diff line number Diff line Loading @@ -102,7 +102,9 @@ public final class NotificationEntry { /** Smart Actions provided by the NotificationAssistantService. */ @NonNull public List<Notification.Action> systemGeneratedSmartActions = Collections.emptyList(); public CharSequence[] smartReplies = new CharSequence[0]; /** Smart replies provided by the NotificationAssistantService. */ @NonNull public CharSequence[] systemGeneratedSmartReplies = new CharSequence[0]; @VisibleForTesting public int suppressedVisualEffects; public boolean suspended; Loading Loading @@ -182,7 +184,7 @@ public final class NotificationEntry { userSentiment = ranking.getUserSentiment(); systemGeneratedSmartActions = ranking.getSmartActions() == null ? Collections.emptyList() : ranking.getSmartActions(); smartReplies = ranking.getSmartReplies() == null systemGeneratedSmartReplies = ranking.getSmartReplies() == null ? new CharSequence[0] : ranking.getSmartReplies().toArray(new CharSequence[0]); suppressedVisualEffects = ranking.getSuppressedVisualEffects(); Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java +2 −2 Original line number Diff line number Diff line Loading @@ -1373,13 +1373,13 @@ public class NotificationContentView extends FrameLayout { } // Apps didn't provide any smart replies / actions, use those from NAS (if any). if (!appGeneratedSmartRepliesExist && !appGeneratedSmartActionsExist) { boolean useGeneratedReplies = !ArrayUtils.isEmpty(entry.smartReplies) boolean useGeneratedReplies = !ArrayUtils.isEmpty(entry.systemGeneratedSmartReplies) && freeformRemoteInputActionPair != null && freeformRemoteInputActionPair.second.getAllowGeneratedReplies() && freeformRemoteInputActionPair.second.actionIntent != null; if (useGeneratedReplies) { smartReplies = new SmartReplyView.SmartReplies( entry.smartReplies, entry.systemGeneratedSmartReplies, freeformRemoteInputActionPair.first, freeformRemoteInputActionPair.second.actionIntent, true /* fromAssistant */); Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java +11 −6 Original line number Diff line number Diff line Loading @@ -209,7 +209,8 @@ public class NotificationContentViewTest extends SysuiTestCase { @Test public void chooseSmartRepliesAndActions_smartRepliesOff_noSystemGeneratedSmartSuggestions() { mEntry.smartReplies = new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; mEntry.systemGeneratedSmartReplies = new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; mEntry.systemGeneratedSmartActions = createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"}); when(mSmartReplyConstants.isEnabled()).thenReturn(false); Loading Loading @@ -256,11 +257,13 @@ public class NotificationContentViewTest extends SysuiTestCase { // replies. setupAppGeneratedReplies(null /* smartReplies */); mEntry.smartReplies = new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; mEntry.systemGeneratedSmartReplies = new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; NotificationContentView.SmartRepliesAndActions repliesAndActions = NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); assertThat(repliesAndActions.smartReplies.choices).isEqualTo(mEntry.smartReplies); assertThat(repliesAndActions.smartReplies.choices).isEqualTo( mEntry.systemGeneratedSmartReplies); assertThat(repliesAndActions.smartReplies.fromAssistant).isTrue(); assertThat(repliesAndActions.smartActions).isNull(); } Loading @@ -271,7 +274,7 @@ public class NotificationContentViewTest extends SysuiTestCase { // replies. setupAppGeneratedReplies(null /* smartReplies */, false /* allowSystemGeneratedReplies */); mEntry.smartReplies = mEntry.systemGeneratedSmartReplies = new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; NotificationContentView.SmartRepliesAndActions repliesAndActions = NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); Loading Loading @@ -306,7 +309,8 @@ public class NotificationContentViewTest extends SysuiTestCase { createActions(new String[] {"Test Action 1", "Test Action 2"}); setupAppGeneratedSuggestions(appGenSmartReplies, appGenSmartActions); mEntry.smartReplies = new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; mEntry.systemGeneratedSmartReplies = new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; mEntry.systemGeneratedSmartActions = createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"}); Loading @@ -325,7 +329,8 @@ public class NotificationContentViewTest extends SysuiTestCase { // actions. setupAppGeneratedReplies(null /* smartReplies */, false /* allowSystemGeneratedReplies */); when(mNotification.getAllowSystemGeneratedContextualActions()).thenReturn(false); mEntry.smartReplies = new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; mEntry.systemGeneratedSmartReplies = new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; mEntry.systemGeneratedSmartActions = createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"}); Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationUiAdjustment.java +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ public class NotificationUiAdjustment { public static NotificationUiAdjustment extractFromNotificationEntry( NotificationEntry entry) { return new NotificationUiAdjustment( entry.key, entry.systemGeneratedSmartActions, entry.smartReplies); entry.key, entry.systemGeneratedSmartActions, entry.systemGeneratedSmartReplies); } public static boolean needReinflate( Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +4 −2 Original line number Diff line number Diff line Loading @@ -102,7 +102,9 @@ public final class NotificationEntry { /** Smart Actions provided by the NotificationAssistantService. */ @NonNull public List<Notification.Action> systemGeneratedSmartActions = Collections.emptyList(); public CharSequence[] smartReplies = new CharSequence[0]; /** Smart replies provided by the NotificationAssistantService. */ @NonNull public CharSequence[] systemGeneratedSmartReplies = new CharSequence[0]; @VisibleForTesting public int suppressedVisualEffects; public boolean suspended; Loading Loading @@ -182,7 +184,7 @@ public final class NotificationEntry { userSentiment = ranking.getUserSentiment(); systemGeneratedSmartActions = ranking.getSmartActions() == null ? Collections.emptyList() : ranking.getSmartActions(); smartReplies = ranking.getSmartReplies() == null systemGeneratedSmartReplies = ranking.getSmartReplies() == null ? new CharSequence[0] : ranking.getSmartReplies().toArray(new CharSequence[0]); suppressedVisualEffects = ranking.getSuppressedVisualEffects(); Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java +2 −2 Original line number Diff line number Diff line Loading @@ -1373,13 +1373,13 @@ public class NotificationContentView extends FrameLayout { } // Apps didn't provide any smart replies / actions, use those from NAS (if any). if (!appGeneratedSmartRepliesExist && !appGeneratedSmartActionsExist) { boolean useGeneratedReplies = !ArrayUtils.isEmpty(entry.smartReplies) boolean useGeneratedReplies = !ArrayUtils.isEmpty(entry.systemGeneratedSmartReplies) && freeformRemoteInputActionPair != null && freeformRemoteInputActionPair.second.getAllowGeneratedReplies() && freeformRemoteInputActionPair.second.actionIntent != null; if (useGeneratedReplies) { smartReplies = new SmartReplyView.SmartReplies( entry.smartReplies, entry.systemGeneratedSmartReplies, freeformRemoteInputActionPair.first, freeformRemoteInputActionPair.second.actionIntent, true /* fromAssistant */); Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java +11 −6 Original line number Diff line number Diff line Loading @@ -209,7 +209,8 @@ public class NotificationContentViewTest extends SysuiTestCase { @Test public void chooseSmartRepliesAndActions_smartRepliesOff_noSystemGeneratedSmartSuggestions() { mEntry.smartReplies = new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; mEntry.systemGeneratedSmartReplies = new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; mEntry.systemGeneratedSmartActions = createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"}); when(mSmartReplyConstants.isEnabled()).thenReturn(false); Loading Loading @@ -256,11 +257,13 @@ public class NotificationContentViewTest extends SysuiTestCase { // replies. setupAppGeneratedReplies(null /* smartReplies */); mEntry.smartReplies = new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; mEntry.systemGeneratedSmartReplies = new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; NotificationContentView.SmartRepliesAndActions repliesAndActions = NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); assertThat(repliesAndActions.smartReplies.choices).isEqualTo(mEntry.smartReplies); assertThat(repliesAndActions.smartReplies.choices).isEqualTo( mEntry.systemGeneratedSmartReplies); assertThat(repliesAndActions.smartReplies.fromAssistant).isTrue(); assertThat(repliesAndActions.smartActions).isNull(); } Loading @@ -271,7 +274,7 @@ public class NotificationContentViewTest extends SysuiTestCase { // replies. setupAppGeneratedReplies(null /* smartReplies */, false /* allowSystemGeneratedReplies */); mEntry.smartReplies = mEntry.systemGeneratedSmartReplies = new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; NotificationContentView.SmartRepliesAndActions repliesAndActions = NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); Loading Loading @@ -306,7 +309,8 @@ public class NotificationContentViewTest extends SysuiTestCase { createActions(new String[] {"Test Action 1", "Test Action 2"}); setupAppGeneratedSuggestions(appGenSmartReplies, appGenSmartActions); mEntry.smartReplies = new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; mEntry.systemGeneratedSmartReplies = new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; mEntry.systemGeneratedSmartActions = createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"}); Loading @@ -325,7 +329,8 @@ public class NotificationContentViewTest extends SysuiTestCase { // actions. setupAppGeneratedReplies(null /* smartReplies */, false /* allowSystemGeneratedReplies */); when(mNotification.getAllowSystemGeneratedContextualActions()).thenReturn(false); mEntry.smartReplies = new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; mEntry.systemGeneratedSmartReplies = new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; mEntry.systemGeneratedSmartActions = createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"}); Loading