diff options
author | Jorim Jaggi <jjaggi@google.com> | 2014-05-21 01:34:15 +0200 |
---|---|---|
committer | Craig Mautner <cmautner@google.com> | 2014-05-27 16:45:57 -0700 |
commit | 0d674623facfbd3e9c520d2be4ed98977b92a1a2 (patch) | |
tree | ab6c7fd7cb671b0e32da414fb0c640af20403c71 /packages | |
parent | 41b170d6066cb52bb3e396c608b01f2981b95e5d (diff) | |
download | frameworks_base-0d674623facfbd3e9c520d2be4ed98977b92a1a2.zip frameworks_base-0d674623facfbd3e9c520d2be4ed98977b92a1a2.tar.gz frameworks_base-0d674623facfbd3e9c520d2be4ed98977b92a1a2.tar.bz2 |
Add methods to coordinate unlock animation.
Introduce IWindowManager.keyguardGoingAway to notify that Keyguard
wants to dismiss it self. This method starts the state machine in
WindowAnimator which animates in the activity behind the keyguard.
Animating out the keyguard is done by the StatusBar/Keyguard
software when it receives the startKeyguardExitAnimation() callback.
Bug: 14118756
Change-Id: Id3b8f41189410bad808b4892fbec74245e59efce
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java | 6 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java | 29 |
2 files changed, 34 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java index 41c0e78..4c7f3df 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java @@ -202,6 +202,12 @@ public class KeyguardService extends Service { checkPermission(); mKeyguardViewMediator.onBootCompleted(); } + + @Override + public void startKeyguardExitAnimation(long fadeoutDuration) { + checkPermission(); + mKeyguardViewMediator.startKeyguardExitAnimation(fadeoutDuration); + } }; } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index b2872fa..7110d8d 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -46,7 +46,8 @@ import android.util.EventLog; import android.util.Log; import android.util.Slog; import android.view.ViewGroup; -import android.view.WindowManager; +import android.view.IWindowManager; +import android.view.WindowManagerGlobal; import android.view.WindowManagerPolicy; import com.android.internal.policy.IKeyguardExitCallback; @@ -137,6 +138,7 @@ public class KeyguardViewMediator extends SystemUI { private static final int SET_OCCLUDED = 12; private static final int KEYGUARD_TIMEOUT = 13; private static final int DISMISS = 17; + private static final int START_KEYGUARD_EXIT_ANIM = 18; /** * The default amount of time we stay awake (used for all key input) @@ -180,6 +182,9 @@ public class KeyguardViewMediator extends SystemUI { /** High level access to the power manager for WakeLocks */ private PowerManager mPM; + /** High level access to the window manager for dismissing keyguard animation */ + private IWindowManager mWM; + /** UserManager for querying number of users */ private UserManager mUserManager; @@ -440,6 +445,7 @@ public class KeyguardViewMediator extends SystemUI { private void setup() { mPM = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); + mWM = WindowManagerGlobal.getWindowManagerService(); mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE); mShowKeyguardWakeLock = mPM.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "show keyguard"); mShowKeyguardWakeLock.setReferenceCounted(false); @@ -1076,6 +1082,9 @@ public class KeyguardViewMediator extends SystemUI { case DISMISS: handleDismiss(); break; + case START_KEYGUARD_EXIT_ANIM: + handleStartKeyguardExitAnimation((Long) msg.obj); + break; } } }; @@ -1207,6 +1216,19 @@ public class KeyguardViewMediator extends SystemUI { private void handleHide() { synchronized (KeyguardViewMediator.this) { if (DEBUG) Log.d(TAG, "handleHide"); + try { + + // Don't actually hide the Keyguard at the moment, wait for window manager until + // it tells us it's safe to do so with startKeyguardExitAnimation. + mWM.keyguardGoingAway(); + } catch (RemoteException e) { + Log.e(TAG, "Error while calling WindowManager", e); + } + } + } + + private void handleStartKeyguardExitAnimation(long fadeoutDuration) { + synchronized (KeyguardViewMediator.this) { // only play "unlock" noises if not on a call (since the incall UI // disables the keyguard) @@ -1324,6 +1346,11 @@ public class KeyguardViewMediator extends SystemUI { return mStatusBarKeyguardViewManager; } + public void startKeyguardExitAnimation(long fadeoutDuration) { + Message msg = mHandler.obtainMessage(START_KEYGUARD_EXIT_ANIM, fadeoutDuration); + mHandler.sendMessage(msg); + } + public ViewMediatorCallback getViewMediatorCallback() { return mViewMediatorCallback; } |