Merge "Visit Uris added by WearableExtender" into rvc-dev am: 345239848c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23892861 Change-Id: I8501745789e5ba42a3d68ab04b61195cc78cafac Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1831,6 +1831,10 @@ public class Notification implements Parcelable
|
||||
}
|
||||
}
|
||||
|
||||
private void visitUris(@NonNull Consumer<Uri> visitor) {
|
||||
visitIconUri(visitor, getIcon());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Action clone() {
|
||||
return new Action(
|
||||
@@ -2508,7 +2512,7 @@ public class Notification implements Parcelable
|
||||
|
||||
if (actions != null) {
|
||||
for (Action action : actions) {
|
||||
visitIconUri(visitor, action.getIcon());
|
||||
action.visitUris(visitor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2579,6 +2583,11 @@ public class Notification implements Parcelable
|
||||
if (mBubbleMetadata != null) {
|
||||
visitIconUri(visitor, mBubbleMetadata.getIcon());
|
||||
}
|
||||
|
||||
if (extras != null && extras.containsKey(WearableExtender.EXTRA_WEARABLE_EXTENSIONS)) {
|
||||
WearableExtender extender = new WearableExtender(this);
|
||||
extender.visitUris(visitor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -10288,6 +10297,12 @@ public class Notification implements Parcelable
|
||||
mFlags &= ~mask;
|
||||
}
|
||||
}
|
||||
|
||||
private void visitUris(@NonNull Consumer<Uri> visitor) {
|
||||
for (Action action : mActions) {
|
||||
action.visitUris(visitor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4420,6 +4420,26 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
|
||||
verify(visitor, times(1)).accept(eq(personIcon3.getUri()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVisitUris_wearableExtender() {
|
||||
Icon actionIcon = Icon.createWithContentUri("content://media/action");
|
||||
Icon wearActionIcon = Icon.createWithContentUri("content://media/wearAction");
|
||||
PendingIntent intent = PendingIntent.getActivity(mContext, 0, new Intent(),
|
||||
PendingIntent.FLAG_IMMUTABLE);
|
||||
Notification n = new Notification.Builder(mContext, "a")
|
||||
.setSmallIcon(android.R.drawable.sym_def_app_icon)
|
||||
.addAction(new Notification.Action.Builder(actionIcon, "Hey!", intent).build())
|
||||
.extend(new Notification.WearableExtender().addAction(
|
||||
new Notification.Action.Builder(wearActionIcon, "Wear!", intent).build()))
|
||||
.build();
|
||||
|
||||
Consumer<Uri> visitor = (Consumer<Uri>) spy(Consumer.class);
|
||||
n.visitUris(visitor);
|
||||
|
||||
verify(visitor).accept(eq(actionIcon.getUri()));
|
||||
verify(visitor).accept(eq(wearActionIcon.getUri()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetNotificationPolicy_preP_setOldFields() {
|
||||
ZenModeHelper mZenModeHelper = mock(ZenModeHelper.class);
|
||||
|
||||
Reference in New Issue
Block a user