Skip to content

Commit

Permalink
Grant URI permissions to the CallStyle-related ones
Browse files Browse the repository at this point in the history
This will also verify that the caller app can actually grant them.

Fix: 274592467
Test: atest NotificationManagerServiceTest
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:4dee5aab12e95cd8b4d663ad050f07b0f2433596)
Merged-In: I83429f9e63e51c615a6e3f03befb76bb5b8ea7fc
Change-Id: I83429f9e63e51c615a6e3f03befb76bb5b8ea7fc
  • Loading branch information
Matías Hernández authored and basamaryan committed Jul 18, 2023
1 parent d1d4a18 commit 79163ec
Showing 1 changed file with 23 additions and 0 deletions.
Expand Up @@ -5445,6 +5445,29 @@ public void testVisitUris_callStyle() {
verify(visitor, times(1)).accept(eq(verificationIcon.getUri()));
}

@Test
public void testVisitUris_callStyle() {
Icon personIcon = Icon.createWithContentUri("content://media/person");
Icon verificationIcon = Icon.createWithContentUri("content://media/verification");
Person callingPerson = new Person.Builder().setName("Someone")
.setIcon(personIcon)
.build();
PendingIntent hangUpIntent = PendingIntent.getActivity(mContext, 0, new Intent(),
PendingIntent.FLAG_IMMUTABLE);
Notification n = new Notification.Builder(mContext, "a")
.setStyle(Notification.CallStyle.forOngoingCall(callingPerson, hangUpIntent)
.setVerificationIcon(verificationIcon))
.setContentTitle("Calling...")
.setSmallIcon(android.R.drawable.sym_def_app_icon)
.build();

Consumer<Uri> visitor = (Consumer<Uri>) spy(Consumer.class);
n.visitUris(visitor);

verify(visitor, times(1)).accept(eq(personIcon.getUri()));
verify(visitor, times(1)).accept(eq(verificationIcon.getUri()));
}

@Test
public void testVisitUris_audioContentsString() throws Exception {
final Uri audioContents = Uri.parse("content://com.example/audio");
Expand Down

0 comments on commit 79163ec

Please sign in to comment.