Allow focused window to override stem primary key.
This change hooks StemPrimaryKeyRule to DeferredKeyActionExecutor so
that stem primary key events get deferred until the focused app doesn't
handle the DOWN key event.
Several key points of this change:
1. Only send stem primary key events to apps with permission
OVERRIDE_SYSTEM_KEY_BEHAVIOR_IN_FOCUSED_WINDOW.
2. We also need to send KEYCODE_STEM_PRIMARY to status bar only if it's
not handled by the app.
3. We want to make sure the triple-press accessibility gesture always
get triggered regardless of if the gesture is consumed by app.
Bug: 308482931
Test: atest WmTests:StemKeyGestureTests
manually tested using a test app
Change-Id: I84791ca71416ec6c5d2f1c603c647031c76e059b
6 files changed