Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cc56009e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Rename NotificationEntry.smartReplies to systemGeneratedSmartReplies"

parents 1ad0fed8 e255f90a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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(
+4 −2
Original line number Diff line number Diff line
@@ -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;
@@ -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();
+2 −2
Original line number Diff line number Diff line
@@ -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 */);
+11 −6
Original line number Diff line number Diff line
@@ -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);
@@ -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();
    }
@@ -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);
@@ -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"});

@@ -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"});