Grant URI permissions to the CallStyle-related ones
This will also verify that the caller app can actually grant them. Fix: 274592467 Test: atest NotificationManagerServiceTest Change-Id: I83429f9e63e51c615a6e3f03befb76bb5b8ea7fc
This commit is contained in:
@@ -2829,6 +2829,14 @@ public class Notification implements Parcelable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isStyle(CallStyle.class) & extras != null) {
|
||||||
|
Person callPerson = extras.getParcelable(EXTRA_CALL_PERSON);
|
||||||
|
if (callPerson != null) {
|
||||||
|
visitor.accept(callPerson.getIconUri());
|
||||||
|
}
|
||||||
|
visitIconUri(visitor, extras.getParcelable(EXTRA_VERIFICATION_ICON));
|
||||||
|
}
|
||||||
|
|
||||||
if (mBubbleMetadata != null) {
|
if (mBubbleMetadata != null) {
|
||||||
visitIconUri(visitor, mBubbleMetadata.getIcon());
|
visitIconUri(visitor, mBubbleMetadata.getIcon());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4335,6 +4335,29 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
|
|||||||
verify(visitor, times(1)).accept(eq(backgroundImage));
|
verify(visitor, times(1)).accept(eq(backgroundImage));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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
|
@Test
|
||||||
public void testVisitUris_audioContentsString() throws Exception {
|
public void testVisitUris_audioContentsString() throws Exception {
|
||||||
final Uri audioContents = Uri.parse("content://com.example/audio");
|
final Uri audioContents = Uri.parse("content://com.example/audio");
|
||||||
|
|||||||
Reference in New Issue
Block a user