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

Commit ae2f3689 authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Fix index error" into pi-dev

parents f9593d62 5a366fbd
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2631,8 +2631,8 @@ public class Notification implements Parcelable
                    if (!Objects.equals(firstRs[j].getLabel(), secondRs[j].getLabel())) {
                        return true;
                    }
                    CharSequence[] firstCs = firstRs[i].getChoices();
                    CharSequence[] secondCs = secondRs[i].getChoices();
                    CharSequence[] firstCs = firstRs[j].getChoices();
                    CharSequence[] secondCs = secondRs[j].getChoices();
                    if (firstCs == null) {
                        firstCs = new CharSequence[0];
                    }
+22 −0
Original line number Diff line number Diff line
@@ -366,6 +366,28 @@ public class NotificationTest extends UiServiceTestCase {
        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
    public void testActionsDifferentRemoteInputs() {
        PendingIntent intent = mock(PendingIntent.class);