Fade out inattentive sleep warning overlay
After long user inactivity, a warning overlay is shown that the device will go to sleep soon unless a button is pressed. Currently, the overlay is hidden immediately on user activity. This causes the overlay to be dismissed on an ACTION_DOWN KeyEvent, and the following ACTION_UP KeyEvent to be delivered to the app underneath the overlay. We want to consume the ACTION_UP KeyEvent, as eg. an ACTION_UP KeyEvent for the back button causes YouTube to quit out of a currently playing video (even if the KeyEvent is cancelled). With this change, the overlay fades out, and during the animation continues to receive KeyEvents. For quick button presses, this prevents the app from seeing the ACTION_UP KeyEvent. For long button presses, the app continues to see key repeats and ACTION_UP events. Bug: 137633812 Test: 1. Set timeout lower: `adb shell settings put secure attentive_timeout 35000` 2. Play YouTube video 3. Wait for overlay to show 4. Press back 5. Verify: Video keeps playing, overlay disappears Change-Id: Ie6eab2b381f3ba9638b231cfeab3b90ad349b6e8
Loading
Please register or sign in to comment