mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-25 07:29:24 -05:00
082bc48c32
https://review.lineageos.org/q/topic:P_asb_2022-05 https://review.lineageos.org/q/topic:P_asb_2022-06 https://review.lineageos.org/q/topic:P_asb_2022-07 https://review.lineageos.org/q/topic:P_asb_2022-08 https://review.lineageos.org/q/topic:P_asb_2022-09 https://review.lineageos.org/q/topic:P_asb_2022-10 https://review.lineageos.org/q/topic:P_asb_2022-11 https://review.lineageos.org/q/topic:P_asb_2022-12 https://review.lineageos.org/q/topic:P_asb_2023-01 https://review.lineageos.org/q/topic:P_asb_2023-02 https://review.lineageos.org/q/topic:P_asb_2023-03 https://review.lineageos.org/q/topic:P_asb_2023-04 https://review.lineageos.org/q/topic:P_asb_2023-05 https://review.lineageos.org/q/topic:P_asb_2023-06 https://review.lineageos.org/q/topic:P_asb_2023-07 accounted for via manifest change: https://review.lineageos.org/c/LineageOS/android_external_freetype/+/361250 https://review.lineageos.org/q/topic:P_asb_2023-08 accounted for via manifest change: https://review.lineageos.org/c/LineageOS/android_external_freetype/+/364606 accounted for via patches: https://review.lineageos.org/c/LineageOS/android_system_ca-certificates/+/365328 https://review.lineageos.org/q/topic:P_asb_2023-09 https://review.lineageos.org/q/topic:P_asb_2023-10 https://review.lineageos.org/q/topic:P_asb_2023-11 accounted for via patches: https://review.lineageos.org/c/LineageOS/android_system_ca-certificates/+/374916 https://review.lineageos.org/q/topic:P_asb_2023-12 https://review.lineageos.org/q/topic:P_asb_2024-01 https://review.lineageos.org/q/topic:P_asb_2024-02 https://review.lineageos.org/q/topic:P_asb_2024-03 https://review.lineageos.org/q/topic:P_asb_2024-04 Signed-off-by: Tavi <tavi@divested.dev>
96 lines
3.9 KiB
Diff
96 lines
3.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Mat=C3=ADas=20Hern=C3=A1ndez?= <matiashe@google.com>
|
|
Date: Wed, 5 Jul 2023 13:52:21 +0200
|
|
Subject: [PATCH] Visit Uris added by WearableExtender
|
|
|
|
Bug: 283962802
|
|
Test: atest + manual (POC app now crashes on notify() as expected)
|
|
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a6f44e911f2d7204cc28c710e54f97c96231abab)
|
|
Merged-In: I0da18c631eb5e4844a48760c7aaedab715a0bfed
|
|
Change-Id: I0da18c631eb5e4844a48760c7aaedab715a0bfed
|
|
---
|
|
core/java/android/app/Notification.java | 17 +++++++++++++++-
|
|
.../NotificationManagerServiceTest.java | 20 +++++++++++++++++++
|
|
2 files changed, 36 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
|
|
index d456e3d57039..d1354a7e5c21 100644
|
|
--- a/core/java/android/app/Notification.java
|
|
+++ b/core/java/android/app/Notification.java
|
|
@@ -1700,6 +1700,10 @@ public class Notification implements Parcelable
|
|
}
|
|
}
|
|
|
|
+ private void visitUris(@NonNull Consumer<Uri> visitor) {
|
|
+ visitIconUri(visitor, getIcon());
|
|
+ }
|
|
+
|
|
@Override
|
|
public Action clone() {
|
|
return new Action(
|
|
@@ -2362,7 +2366,7 @@ public class Notification implements Parcelable
|
|
|
|
if (actions != null) {
|
|
for (Action action : actions) {
|
|
- visitIconUri(visitor, action.getIcon());
|
|
+ action.visitUris(visitor);
|
|
}
|
|
}
|
|
|
|
@@ -2390,6 +2394,11 @@ public class Notification implements Parcelable
|
|
}
|
|
}
|
|
}
|
|
+
|
|
+ if (extras != null && extras.containsKey(WearableExtender.EXTRA_WEARABLE_EXTENSIONS)) {
|
|
+ WearableExtender extender = new WearableExtender(this);
|
|
+ extender.visitUris(visitor);
|
|
+ }
|
|
}
|
|
|
|
/**
|
|
@@ -9045,6 +9054,12 @@ public class Notification implements Parcelable
|
|
mFlags &= ~mask;
|
|
}
|
|
}
|
|
+
|
|
+ private void visitUris(@NonNull Consumer<Uri> visitor) {
|
|
+ for (Action action : mActions) {
|
|
+ action.visitUris(visitor);
|
|
+ }
|
|
+ }
|
|
}
|
|
|
|
/**
|
|
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
|
|
index e073e6767da6..379290bcf0ad 100644
|
|
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
|
|
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
|
|
@@ -2797,6 +2797,26 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
|
|
anyInt(), anyInt());
|
|
}
|
|
|
|
+ @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);
|