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

Commit 36f47771 authored by Julia Reynolds's avatar Julia Reynolds Committed by android-build-team Robot
Browse files

Fix index error

Change-Id: I93cf18b35060a09a3b8f4be8e0b9b4682d390b25
Fixes: 76101440
Test: runtest systemui-notification
(cherry picked from commit 5a366fbd)
parent 992cb80d
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -2631,8 +2631,8 @@ public class Notification implements Parcelable
                    if (!Objects.equals(firstRs[j].getLabel(), secondRs[j].getLabel())) {
                    if (!Objects.equals(firstRs[j].getLabel(), secondRs[j].getLabel())) {
                        return true;
                        return true;
                    }
                    }
                    CharSequence[] firstCs = firstRs[i].getChoices();
                    CharSequence[] firstCs = firstRs[j].getChoices();
                    CharSequence[] secondCs = secondRs[i].getChoices();
                    CharSequence[] secondCs = secondRs[j].getChoices();
                    if (firstCs == null) {
                    if (firstCs == null) {
                        firstCs = new CharSequence[0];
                        firstCs = new CharSequence[0];
                    }
                    }
+22 −0
Original line number Original line Diff line number Diff line
@@ -366,6 +366,28 @@ public class NotificationTest extends UiServiceTestCase {
        assertFalse(Notification.areActionsVisiblyDifferent(n1, n2));
        assertFalse(Notification.areActionsVisiblyDifferent(n1, n2));
    }
    }


    @Test
    public void testActionsMoreOptionsThanChoices() {
        PendingIntent intent1 = mock(PendingIntent.class);
        PendingIntent intent2 = mock(PendingIntent.class);
        Icon icon = mock(Icon.class);

        Notification n1 = new Notification.Builder(mContext, "test")
                .addAction(new Notification.Action.Builder(icon, "TEXT 1", intent1).build())
                .addAction(new Notification.Action.Builder(icon, "TEXT 2", intent1)
                        .addRemoteInput(new RemoteInput.Builder("a")
                                .setChoices(new CharSequence[] {"i", "m"})
                                .build())
                        .build())
                .build();
        Notification n2 = new Notification.Builder(mContext, "test")
                .addAction(new Notification.Action.Builder(icon, "TEXT 1", intent2).build())
                .addAction(new Notification.Action.Builder(icon, "TEXT 2", intent1).build())
                .build();

        assertTrue(Notification.areActionsVisiblyDifferent(n1, n2));
    }

    @Test
    @Test
    public void testActionsDifferentRemoteInputs() {
    public void testActionsDifferentRemoteInputs() {
        PendingIntent intent = mock(PendingIntent.class);
        PendingIntent intent = mock(PendingIntent.class);