Merge "Visit Uris added by WearableExtender" into sc-dev am: 917c91ed5f am: aed7e0e6c4 am: 7ddb25c9c4 am: 4251379163 am: 9ab41c26a2
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23905843 Change-Id: Ied339ec19afca5a88b80245485d27fb285d9ebf1 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -2138,6 +2138,10 @@ public class Notification implements Parcelable
|
||||
}
|
||||
}
|
||||
|
||||
private void visitUris(@NonNull Consumer<Uri> visitor) {
|
||||
visitIconUri(visitor, getIcon());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Action clone() {
|
||||
return new Action(
|
||||
@@ -2823,7 +2827,7 @@ public class Notification implements Parcelable
|
||||
|
||||
if (actions != null) {
|
||||
for (Action action : actions) {
|
||||
visitIconUri(visitor, action.getIcon());
|
||||
action.visitUris(visitor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2912,6 +2916,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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -11627,6 +11636,12 @@ public class Notification implements Parcelable
|
||||
mFlags &= ~mask;
|
||||
}
|
||||
}
|
||||
|
||||
private void visitUris(@NonNull Consumer<Uri> visitor) {
|
||||
for (Action action : mActions) {
|
||||
action.visitUris(visitor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5564,6 +5564,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