Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit b0e32b08 authored by Jaewan Kim's avatar Jaewan Kim
Browse files

MediaSessionManager: Add isTrustedForMediaControl()

The API checks whether an app is granted MEDIA_CONTENT_CONTROL
permisison or has enabled notification listener. Such apps can be
considered as the system component (e.g. Bluetooth) or equivalent (e.g.
Auto/Wearable companion app), so sessions shouldn't refuse connection
request from it.

It needs to be public because API for checking whether an app has an
enabled notification listener can only be called by the system service.
(see: NotificationManager.getEnabledNotificationListeners(int))
With the MediaSessionManager#isTrustedForMediaControl(),
MediaSessionService will query the information indirectly for a session
to tell an app is trusted.

Note that this isn't workaround for bypassing permission check of
NotificationManager API calls. It's indirectly available through
the android.provider.Settings.Secure with the *deprecated* key
ENABLD_NOTIFICATION_LISTENERS and it doesn't need any permission.
MediaSessionManager#isTrustedForMediaControl() is needed to avoid using
deprecated key for querying notification listeners.

Bug: 75500592
Test: Build
Change-Id: I8d1183aa946aa0d2ec35dbd7f31933d1c2717f99
parent 1c73370d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment