Skip to content
Commit 4b13ab89 authored by Anthony Hugh's avatar Anthony Hugh
Browse files

Prevent back button from being handled by app after waking device

The current implementation marks KEYCODE_BACK as a wake key in
KeyEvent.  In theory, this prevents the back key from being
dispatched to the app.  In practice though, on watches the key
both wakes the device and dispatches the back button.

This behavior is because of the logic in
interceptKeyBeforeQueueing().  Watches spend the majority of their
time in ambient, so when the code runs the
shouldDispatchInputWhenNonInteractive() logic, it always assumes
wake key events should be passed through.

With this change, I am adjusting the behavior for watches.
shouldDispatchInputWhenNonInteractive() has been modified to
handle the back button specially on watches so that the Down event
is treated as a wake up only.

The above change had an unintended side effect of sending an Up
event to the app without a corresponding Down event. I've also
added a cached value so that we don't send the Up event if
a Down event was responsible for waking the device.

BUG: 28716144

Change-Id: If8906bffd9b3e0b6070de3b4e7bce4d8178ac65d
parent a582dd00
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment