mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-15 02:44:23 -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>
71 lines
3.2 KiB
Diff
71 lines
3.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Ioana Alexandru <aioana@google.com>
|
|
Date: Fri, 12 May 2023 15:41:09 +0000
|
|
Subject: [PATCH] Implement visitUris for RemoteViews ViewGroupActionAdd.
|
|
|
|
This is to prevent a vulnerability where notifications can show
|
|
resources belonging to other users, since the URI in the nested views
|
|
was not being checked.
|
|
|
|
Bug: 277740082
|
|
Test: atest RemoteViewsTest NotificationVisitUrisTest
|
|
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:850fd984e5f346645b5a941ed7307387c7e4c4de)
|
|
Merged-In: I5c71f0bad0a6f6361eb5ceffe8d1e47e936d78f8
|
|
Change-Id: I5c71f0bad0a6f6361eb5ceffe8d1e47e936d78f8
|
|
---
|
|
core/java/android/widget/RemoteViews.java | 5 ++++
|
|
.../src/android/widget/RemoteViewsTest.java | 24 +++++++++++++++++++
|
|
2 files changed, 29 insertions(+)
|
|
|
|
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
|
|
index 10053dddb0fb..b36d27fc3b3b 100644
|
|
--- a/core/java/android/widget/RemoteViews.java
|
|
+++ b/core/java/android/widget/RemoteViews.java
|
|
@@ -1672,6 +1672,11 @@ public class RemoteViews implements Parcelable, Filter {
|
|
public int getActionTag() {
|
|
return VIEW_GROUP_ACTION_ADD_TAG;
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public final void visitUris(@NonNull Consumer<Uri> visitor) {
|
|
+ mNestedViews.visitUris(visitor);
|
|
+ }
|
|
}
|
|
|
|
/**
|
|
diff --git a/core/tests/coretests/src/android/widget/RemoteViewsTest.java b/core/tests/coretests/src/android/widget/RemoteViewsTest.java
|
|
index 7d2e07ecbd71..1123988e9512 100644
|
|
--- a/core/tests/coretests/src/android/widget/RemoteViewsTest.java
|
|
+++ b/core/tests/coretests/src/android/widget/RemoteViewsTest.java
|
|
@@ -474,6 +474,30 @@ public class RemoteViewsTest {
|
|
verify(visitor, times(1)).accept(eq(icon4.getUri()));
|
|
}
|
|
|
|
+ @Test
|
|
+ public void visitUris_nestedViews() {
|
|
+ final RemoteViews outer = new RemoteViews(mPackage, R.layout.remote_views_test);
|
|
+
|
|
+ final RemoteViews inner = new RemoteViews(mPackage, 33);
|
|
+ final Uri imageUriI = Uri.parse("content://inner/image");
|
|
+ final Icon icon1 = Icon.createWithContentUri("content://inner/icon1");
|
|
+ final Icon icon2 = Icon.createWithContentUri("content://inner/icon2");
|
|
+ final Icon icon3 = Icon.createWithContentUri("content://inner/icon3");
|
|
+ final Icon icon4 = Icon.createWithContentUri("content://inner/icon4");
|
|
+ inner.setImageViewUri(R.id.image, imageUriI);
|
|
+ inner.setTextViewCompoundDrawables(R.id.text, icon1, icon2, icon3, icon4);
|
|
+
|
|
+ outer.addView(R.id.layout, inner);
|
|
+
|
|
+ Consumer<Uri> visitor = (Consumer<Uri>) spy(Consumer.class);
|
|
+ outer.visitUris(visitor);
|
|
+ verify(visitor, times(1)).accept(eq(imageUriI));
|
|
+ verify(visitor, times(1)).accept(eq(icon1.getUri()));
|
|
+ verify(visitor, times(1)).accept(eq(icon2.getUri()));
|
|
+ verify(visitor, times(1)).accept(eq(icon3.getUri()));
|
|
+ verify(visitor, times(1)).accept(eq(icon4.getUri()));
|
|
+ }
|
|
+
|
|
@Test
|
|
public void visitUris_separateOrientation() {
|
|
final RemoteViews landscape = new RemoteViews(mPackage, R.layout.remote_views_test);
|