mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-10-01 01:35:54 -04:00
59bf3b75c7
https://review.lineageos.org/c/LineageOS/android_frameworks_base/+/353117 https://review.lineageos.org/q/topic:Q_asb_2023-03 https://review.lineageos.org/q/topic:Q_asb_2023-04 https://review.lineageos.org/q/topic:Q_asb_2023-05 https://review.lineageos.org/q/topic:Q_asb_2023-06 https://review.lineageos.org/q/topic:Q_asb_2023-07 https://review.lineageos.org/q/topic:Q_asb_2023-08 accounted for via patches: https://review.lineageos.org/c/LineageOS/android_system_ca-certificates/+/376560 https://review.lineageos.org/c/LineageOS/android_system_ca-certificates/+/376561 https://review.lineageos.org/c/LineageOS/android_system_ca-certificates/+/376562 https://review.lineageos.org/q/topic:Q_asb_2023-09 https://review.lineageos.org/q/topic:Q_asb_2023-10 https://review.lineageos.org/q/topic:Q_asb_2023-11 accounted for via patches: https://review.lineageos.org/c/LineageOS/android_system_ca-certificates/+/376563 accounted for via manifest change: https://review.lineageos.org/c/LineageOS/android_external_webp/+/376568 https://review.lineageos.org/q/topic:Q_asb_2023-12 https://review.lineageos.org/q/topic:Q_asb_2024-01 https://review.lineageos.org/q/topic:Q_asb_2024-02 https://review.lineageos.org/q/topic:Q_asb_2024-03 Signed-off-by: Tavi <tavi@divested.dev>
62 lines
2.9 KiB
Diff
62 lines
2.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Ioana Alexandru <aioana@google.com>
|
|
Date: Mon, 15 May 2023 16:15:55 +0000
|
|
Subject: [PATCH] Check URIs in notification public version.
|
|
|
|
Bug: 276294099
|
|
Test: atest NotificationManagerServiceTest NotificationVisitUrisTest
|
|
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:9663d493142b59c65311bc09d48427d3bdde0222)
|
|
Merged-In: I670198b213abb2cb29a9865eb9d1e897700508b4
|
|
Change-Id: I670198b213abb2cb29a9865eb9d1e897700508b4
|
|
---
|
|
core/java/android/app/Notification.java | 4 ++++
|
|
.../NotificationManagerServiceTest.java | 20 +++++++++++++++++++
|
|
2 files changed, 24 insertions(+)
|
|
|
|
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
|
|
index 5b9e1ea6daf1..7921a89ca96f 100644
|
|
--- a/core/java/android/app/Notification.java
|
|
+++ b/core/java/android/app/Notification.java
|
|
@@ -2451,6 +2451,10 @@ public class Notification implements Parcelable
|
|
* @hide
|
|
*/
|
|
public void visitUris(@NonNull Consumer<Uri> visitor) {
|
|
+ if (publicVersion != null) {
|
|
+ publicVersion.visitUris(visitor);
|
|
+ }
|
|
+
|
|
visitor.accept(sound);
|
|
|
|
if (tickerView != null) tickerView.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 da4a2420b924..f3a9ef1eb63e 100755
|
|
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
|
|
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
|
|
@@ -3436,6 +3436,26 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
|
|
verify(visitor, times(1)).accept(eq(largeIcon.getUri()));
|
|
}
|
|
|
|
+ @Test
|
|
+ public void testVisitUris_publicVersion() throws Exception {
|
|
+ final Icon smallIconPublic = Icon.createWithContentUri("content://media/small/icon");
|
|
+ final Icon largeIconPrivate = Icon.createWithContentUri("content://media/large/icon");
|
|
+
|
|
+ Notification publicVersion = new Notification.Builder(mContext, "a")
|
|
+ .setContentTitle("notification with uris")
|
|
+ .setSmallIcon(smallIconPublic)
|
|
+ .build();
|
|
+ Notification n = new Notification.Builder(mContext, "a")
|
|
+ .setLargeIcon(largeIconPrivate)
|
|
+ .setPublicVersion(publicVersion)
|
|
+ .build();
|
|
+
|
|
+ Consumer<Uri> visitor = (Consumer<Uri>) spy(Consumer.class);
|
|
+ n.visitUris(visitor);
|
|
+ verify(visitor, times(1)).accept(eq(smallIconPublic.getUri()));
|
|
+ verify(visitor, times(1)).accept(eq(largeIconPrivate.getUri()));
|
|
+ }
|
|
+
|
|
@Test
|
|
public void testVisitUris_messagingStyle() {
|
|
final Icon personIcon1 = Icon.createWithContentUri("content://media/person1");
|