Android Oreo System Apps Can Set Volume Key Long-Press Listeners

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

Adding additional functionality to various hardware and software buttons on our devices is something Android enthusiasts have been doing for a while. Most people know about applications such as Button Mapper from XDA Recognized Developer flar2, and we even spoke about other remapper solutions back when the Galaxy S8 was released. While those solutions handled these actions in a certain way, Google looks to be implementing a listener in Android Oreo for long-pressing the volume keys. This means that potentially, applications in the future might be able to react to volume key long presses even while the screen is off, which could be used to bring an often-requested feature over from custom ROMs – music track control with volume key presses.

We do want to mention that this feature isn’t actually enabled in the user-facing build that we have available to us right now. Support for it is there though, as evidenced by the commit we found, and that means it can be enabled by the OEM for your specific device. As mentioned, traditional remapping applications work by detecting if a KeyEvent has been sent (with long presses, these apps measure the time between a key down and key up event whereas with double presses they measure the time between down presses), but these KeyEvents are only sent while the screen is on. Furthermore, they also typically require the use of an Accessibility Service which can be taxing on the performance.

Your typical button remap solution can be considered to be a workaround to be used to toggle the torch on or off, opening an application, pulling down the notification panel and so on. However, what Google has implemented into Android Oreo takes this a step further with letting system applications themselves set up these volume button long-press listeners. This could allow the user to trigger something within the application itself once the platform detects a volume button has been held down for a few seconds.