Fixes cannot leave dozing when dismiss keyguard.

Setup dream by enable AOD or dreaming. Then entering dreaming and wait
lockscreen on, trigger wm dismiss-keyguard should stop dreaming no
matter is AOD or DreamActivity, and if user has set crediental,
SystemUI should show keyguard bouncer at the same time.

Currently behavior:
- When showing AOD: dismiss-keyguard won't leave AOD, once user press
power key, AOD will gone and show keyguard bouncer directly.
- When showing DreamActivity: dismiss-keyguard keyguard bouncer will
pop up without leave DreamActivity, after enter crediental,
DreamActivity keep in resumed state.

In order to make a consistent behavior, when receive a request to
dismiss keyguard, wake up the device if it's dreaming.

Bug: 162190413
Test: atest KeyguardTests KeyguardLockedTests
Test: atest WindowManagerServiceTests
Test: Enable dream, set crediental, wait for dreaming and device
locked. Try to dismiss keyguard with "adb shell wm dismiss-keyguard",
the DreamActivity or AOD should stop.

Change-Id: I62be9283a1d22119eceae5585960b5775a019153
2 files changed