Merge "Fix index error" into pi-dev

am: ae2f368907

Change-Id: I818ce7bfe0fc6cb5f0bbe25ede1ac443ab7ef052
This commit is contained in:
Julia Reynolds
2018-03-22 11:54:05 +00:00
committed by android-build-merger
2 changed files with 24 additions and 2 deletions

View File

@@ -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];
}

View File

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