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
Loading
Please register or sign in to comment