Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +2 −2 Original line number Diff line number Diff line Loading @@ -329,11 +329,11 @@ public final class NotificationEntry extends ListEntry { return mRanking.canBubble(); } public @NonNull List<Notification.Action> getSmartActions() { public @Nullable List<Notification.Action> getSmartActions() { return mRanking.getSmartActions(); } public @NonNull List<CharSequence> getSmartReplies() { public @Nullable List<CharSequence> getSmartReplies() { return mRanking.getSmartReplies(); } Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartRepliesAndActionsInflater.kt +28 −23 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ interface SmartRepliesAndActionsInflater { sysuiContext: Context, notifPackageContext: Context, entry: NotificationEntry, existingRepliesAndAction: SmartRepliesAndActions existingRepliesAndAction: SmartRepliesAndActions? ): InflatedSmartReplies } Loading @@ -103,7 +103,7 @@ interface SmartRepliesAndActionsInflater { sysuiContext: Context, notifPackageContext: Context, entry: NotificationEntry, existingRepliesAndAction: SmartRepliesAndActions existingRepliesAndAction: SmartRepliesAndActions? ): InflatedSmartReplies { val newRepliesAndActions = chooseSmartRepliesAndActions(entry) if (!shouldShowSmartReplyView(entry, newRepliesAndActions)) { Loading Loading @@ -204,26 +204,31 @@ interface SmartRepliesAndActionsInflater { } // Apps didn't provide any smart replies / actions, use those from NAS (if any). if (smartReplies == null && smartActions == null) { if (entry.smartReplies.isNotEmpty() && freeformRemoteInputActionPair != null && freeformRemoteInputActionPair.second.allowGeneratedReplies && freeformRemoteInputActionPair.second.actionIntent != null) { smartReplies = SmartReplies( entry.smartReplies, freeformRemoteInputActionPair.first, freeformRemoteInputActionPair.second.actionIntent, smartReplies = entry.smartReplies ?.takeIf { it.isNotEmpty() } ?.let { entryReplies -> freeformRemoteInputActionPair ?.takeIf { it.second.allowGeneratedReplies && it.second.actionIntent != null }?.let { freeformPair -> SmartReplies( entryReplies, freeformPair.first, freeformPair.second.actionIntent, true /* fromAssistant */) } if (entry.smartActions.isNotEmpty() && notification.allowSystemGeneratedContextualActions) { } smartActions = entry.smartActions ?.takeIf { it.isNotEmpty() && notification.allowSystemGeneratedContextualActions }?.let { entryActions -> val systemGeneratedActions: List<Notification.Action> = when { activityManagerWrapper.isLockTaskKioskModeActive -> // Filter actions if we're in kiosk-mode - we don't care about screen // pinning mode, since notifications aren't shown there anyway. filterAllowlistedLockTaskApps(entry.smartActions) else -> entry.smartActions // Filter actions if we're in kiosk-mode - we don't care about // screen pinning mode, since notifications aren't shown there // anyway. filterAllowlistedLockTaskApps(entryActions) else -> entryActions } smartActions = SmartActions(systemGeneratedActions, true /* fromAssistant */) SmartActions(systemGeneratedActions, true /* fromAssistant */) } } return SmartRepliesAndActions(smartReplies, smartActions) Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/InflatedSmartRepliesTest.java +1 −2 Original line number Diff line number Diff line Loading @@ -183,8 +183,7 @@ public class InflatedSmartRepliesTest extends SysuiTestCase { SmartRepliesAndActions repliesAndActions = mSmartRepliesInflater.chooseSmartRepliesAndActions(mEntry); assertThat(repliesAndActions.smartReplies.choices).isEqualTo( mEntry.getSmartReplies()); assertThat(repliesAndActions.smartReplies.choices).isEqualTo(mEntry.getSmartReplies()); assertThat(repliesAndActions.smartReplies.fromAssistant).isTrue(); assertThat(repliesAndActions.smartActions).isNull(); } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +2 −2 Original line number Diff line number Diff line Loading @@ -329,11 +329,11 @@ public final class NotificationEntry extends ListEntry { return mRanking.canBubble(); } public @NonNull List<Notification.Action> getSmartActions() { public @Nullable List<Notification.Action> getSmartActions() { return mRanking.getSmartActions(); } public @NonNull List<CharSequence> getSmartReplies() { public @Nullable List<CharSequence> getSmartReplies() { return mRanking.getSmartReplies(); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartRepliesAndActionsInflater.kt +28 −23 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ interface SmartRepliesAndActionsInflater { sysuiContext: Context, notifPackageContext: Context, entry: NotificationEntry, existingRepliesAndAction: SmartRepliesAndActions existingRepliesAndAction: SmartRepliesAndActions? ): InflatedSmartReplies } Loading @@ -103,7 +103,7 @@ interface SmartRepliesAndActionsInflater { sysuiContext: Context, notifPackageContext: Context, entry: NotificationEntry, existingRepliesAndAction: SmartRepliesAndActions existingRepliesAndAction: SmartRepliesAndActions? ): InflatedSmartReplies { val newRepliesAndActions = chooseSmartRepliesAndActions(entry) if (!shouldShowSmartReplyView(entry, newRepliesAndActions)) { Loading Loading @@ -204,26 +204,31 @@ interface SmartRepliesAndActionsInflater { } // Apps didn't provide any smart replies / actions, use those from NAS (if any). if (smartReplies == null && smartActions == null) { if (entry.smartReplies.isNotEmpty() && freeformRemoteInputActionPair != null && freeformRemoteInputActionPair.second.allowGeneratedReplies && freeformRemoteInputActionPair.second.actionIntent != null) { smartReplies = SmartReplies( entry.smartReplies, freeformRemoteInputActionPair.first, freeformRemoteInputActionPair.second.actionIntent, smartReplies = entry.smartReplies ?.takeIf { it.isNotEmpty() } ?.let { entryReplies -> freeformRemoteInputActionPair ?.takeIf { it.second.allowGeneratedReplies && it.second.actionIntent != null }?.let { freeformPair -> SmartReplies( entryReplies, freeformPair.first, freeformPair.second.actionIntent, true /* fromAssistant */) } if (entry.smartActions.isNotEmpty() && notification.allowSystemGeneratedContextualActions) { } smartActions = entry.smartActions ?.takeIf { it.isNotEmpty() && notification.allowSystemGeneratedContextualActions }?.let { entryActions -> val systemGeneratedActions: List<Notification.Action> = when { activityManagerWrapper.isLockTaskKioskModeActive -> // Filter actions if we're in kiosk-mode - we don't care about screen // pinning mode, since notifications aren't shown there anyway. filterAllowlistedLockTaskApps(entry.smartActions) else -> entry.smartActions // Filter actions if we're in kiosk-mode - we don't care about // screen pinning mode, since notifications aren't shown there // anyway. filterAllowlistedLockTaskApps(entryActions) else -> entryActions } smartActions = SmartActions(systemGeneratedActions, true /* fromAssistant */) SmartActions(systemGeneratedActions, true /* fromAssistant */) } } return SmartRepliesAndActions(smartReplies, smartActions) Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/InflatedSmartRepliesTest.java +1 −2 Original line number Diff line number Diff line Loading @@ -183,8 +183,7 @@ public class InflatedSmartRepliesTest extends SysuiTestCase { SmartRepliesAndActions repliesAndActions = mSmartRepliesInflater.chooseSmartRepliesAndActions(mEntry); assertThat(repliesAndActions.smartReplies.choices).isEqualTo( mEntry.getSmartReplies()); assertThat(repliesAndActions.smartReplies.choices).isEqualTo(mEntry.getSmartReplies()); assertThat(repliesAndActions.smartReplies.fromAssistant).isTrue(); assertThat(repliesAndActions.smartActions).isNull(); } Loading