Repository navigation
wpeview: Let Android handle the volume keys and Back - #343
Merged
Merged
Conversation
WebView sends every key to the page and reports it as handled, so Android does not get the volume keys while the page has the focus, and they do not change the volume, for example while a video plays. Embedders have to catch Back before it reaches the WebView for the same reason. As GeckoView does, do not send the volume keys, Back, Forward, Menu, Search and the headset button to the page, and leave them to the app and the system. Add a test that these keys are neither consumed nor sent to the page, while other keys still are.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WebView sends every key to the page and reports it as handled, so Android does not get the volume keys while the page has the focus. For example, the volume buttons do nothing while a YouTube video plays in Wolvic WPE. For the same reason, Wolvic WPE has to catch Back before it reaches the WebView.
This leaves the volume keys, Back, Forward, Menu, Search and the headset button to Android, as GeckoView does in GeckoEditable.shouldProcessKey(). The page no longer gets these keys.
Tested on a Pixel 7a with WPE WebKit 2.55.0.6: the wpeview instrumented tests pass, 25 in all, including a new one that fails without this change. In Wolvic WPE, the volume buttons now change the media volume while a YouTube video plays.