Prevent display brightness flicker on power button

ag/22712141 tried to fix an issue where using system keys would
not trigger user activity, allowing the device to go into sleep
mode even while interacting with things like volume controls. The
cause of this is that system shortcuts were never sent to keyguard,
which is responsible for manging the power state. Unfortunately,
the fix caused the side effect of considering the power button user
activity, which would brighten the display if in dim mode before
bringing the display to sleep. This was quite subtle as we only
learned of this problem recently.

This CL refines the logic introduced in ag/22712141, correcting the
specific issue while restoring the original user activity logic.

Bug: 312671872
Test: Flashed on device, tested on keyguard and several apps
Flag: EXEMPT bugfix
Change-Id: I57f98ec1b138d4e71cd8c21742eacd8a2813e9d3
4 files changed