fix(android): check added to trigger onMediaKeyEvent if OxygenOS < 15 #2559
+9
−3
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.
Summary
Fixes an issue on Oxygen OS < 15 where
onMediaButtondoesn't get called due to the OEM's implementation. As a result, the lock screen controls didn't work on Oxygen 14.## Root Cause
This was also an issue in Android 13 and below. It looks like OnePlus forgot to patch it on their end in Oxygen 14, but managed to fix it in Oxygen 15. I couldn't test it directly on 15, but according to this it seems to be working fine on Oxygen 15.
## Solution
I've extended the original hack for Android 13 so it applies to Oxygen14 as well. Tested on a OnePlus9 (Oxygen 14) and a Pixel 9, to make sure it didn't break anything on non-One Plus devices. Both worked just fine.