Skip to content

Commit

Permalink
Mark broadcast receivers as not exported
Browse files Browse the repository at this point in the history
They are called from the system only and don't need to be exported
to be visible to other apps.

PiperOrigin-RevId: 489210264
  • Loading branch information
tonihei authored and microkatz committed Nov 22, 2022
1 parent 4ce171a commit 22ccc1a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ public MediaSessionImpl(
broadcastReceiver = new MediaButtonReceiver();
IntentFilter filter = new IntentFilter(Intent.ACTION_MEDIA_BUTTON);
filter.addDataScheme(castNonNull(sessionUri.getScheme()));
// TODO(b/197817693): Explicitly indicate whether the receiver should be exported.
context.registerReceiver(broadcastReceiver, filter);
Util.registerReceiverNotExported(context, broadcastReceiver, filter);
} else {
// Has MediaSessionService to revive playback after it's dead.
Intent intent = new Intent(Intent.ACTION_MEDIA_BUTTON, sessionUri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1164,8 +1164,7 @@ private void startOrUpdateNotification(Player player, @Nullable Bitmap bitmap) {
Notification notification = builder.build();
notificationManager.notify(notificationId, notification);
if (!isNotificationStarted) {
// TODO(b/197817693): Explicitly indicate whether the receiver should be exported.
context.registerReceiver(notificationBroadcastReceiver, intentFilter);
Util.registerReceiverNotExported(context, notificationBroadcastReceiver, intentFilter);
}
if (notificationListener != null) {
// Always pass true for ongoing with the first notification to tell a service to go into
Expand Down

0 comments on commit 22ccc1a

Please sign in to comment.