Wait for animation done when sleeping

When pressing the home button when showing a show-when-locked
activity on top of Keyguard, stop signal was sent too early,
leading to a hole in various apps, for example, Camera, because
stop signal wasn't deferred until animation was done.

Since we only use sleep token for display off and Keyguard, we
think it's safe to also wait for animation done in that case, but
not for shutting down.

Also make sure to only check for transition type.

Test: Press home button while showing Secure camera on top of
locked Keyguard, observe no hole
Fixes: 156514461

Change-Id: I527747ae9b3042beee233f5436db3acf3df97964
1 file changed