Privileged Apps in Android Oreo Will be Able to Set Media Key Event Listeners

Privileged Apps in Android Oreo Will be Able to Set Media Key Event Listeners

We may earn a commission for purchases made using our links.

Even though Android has existed for years, it is still far away from being a perfect smartphone OS. There are plenty of areas which could see improvements, and slowly but surely, we’re inching towards a more polished product. One such change area is how Android handles media key event listeners, and one of the commits in Android Oreo fixes an oversight present since the earliest of Android’s days.

In previous versions of Android, any application installed on a particular device could grab media button events at any time, only for any other app to wrest it away. So when you do press any media button events such as play/pause/next/previous, the command may not reach the app you intended it to reach. One of the most common examples of this behaviour is seen with Pokémon GO and music playback over Bluetooth — the music player often does not respond to media commands when Pokémon GO is in the foreground.

This new commit in Android Oreo attempts to fix this issue in a way, by allowing privileged apps (applications present in /system/priv-app) to set the media key event listener. If a privileged app sets the media key listener, the listener will receive the media key events before any other sessions can, but after the global priority session (Android system itself). If the listener that is set up handles the media key event, other sessions cannot get the event. Privileged apps still need android.permission.SET_MEDIA_KEY_LISTENER
permission to set the listener.

In simpler terms, system apps can now gain priority access over media key events. This does open up the door for slight misuse through carrier bloatware, but it also fixes a gripe that can lead to an annoying user experience. This particular change is currently not implemented in Android 8.0‘s user-facing builds, though it might be implemented by OEMs in the future.

Source: Android Source