Merge "Visit Uris added by WearableExtender" into sc-dev am: 917c91ed5f am: aed7e0e6c4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23905843 Change-Id: I0d52c1f0eaa8a290b4b773210d754bfa8c57f6ce Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -2092,6 +2092,10 @@ public class Notification implements Parcelable
|
||||
}
|
||||
}
|
||||
|
||||
private void visitUris(@NonNull Consumer<Uri> visitor) {
|
||||
visitIconUri(visitor, getIcon());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Action clone() {
|
||||
return new Action(
|
||||
@@ -2777,7 +2781,7 @@ public class Notification implements Parcelable
|
||||
|
||||
if (actions != null) {
|
||||
for (Action action : actions) {
|
||||
visitIconUri(visitor, action.getIcon());
|
||||
action.visitUris(visitor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2854,6 +2858,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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -11405,6 +11414,12 @@ public class Notification implements Parcelable
|
||||
mFlags &= ~mask;
|
||||
}
|
||||
}
|
||||
|
||||
private void visitUris(@NonNull Consumer<Uri> visitor) {
|
||||
for (Action action : mActions) {
|
||||
action.visitUris(visitor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4619,6 +4619,26 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
|
||||
verify(visitor, times(1)).accept(eq(verificationIcon.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