Fix dismissing window showing

Only show dismissing window if we are about to unlock, and not just
in all cases. For that, set a flag to true during the process, and
reset the flag after the Keyguard has unlocked.

Test: Have a FLAG_SHOW_WHEN_LOCKED activity that starts a
FLAG_DISMISS_KEYGUARD_ACTIVITY. Check whether window is hidden
when toggling the power button. Make sure that the device is
in a trusted state during the whole test.

Change-Id: I9346dd869d1cf50a42c64a5f7c69f8e24f1e1f9b
Fixes: 31810884
4 files changed