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 /services | |
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 'services')
-rw-r--r-- | services/core/java/com/android/server/wm/WindowAnimator.java | 44 | ||||
-rw-r--r-- | services/core/java/com/android/server/wm/WindowManagerService.java | 16 |
2 files changed, 55 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/wm/WindowAnimator.java b/services/core/java/com/android/server/wm/WindowAnimator.java index 266527d..6fdd535 100644 --- a/services/core/java/com/android/server/wm/WindowAnimator.java +++ b/services/core/java/com/android/server/wm/WindowAnimator.java @@ -36,6 +36,7 @@ import android.util.TimeUtils; import android.view.Display; import android.view.SurfaceControl; import android.view.WindowManagerPolicy; +import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import com.android.server.wm.WindowManagerService.LayoutFields; @@ -50,6 +51,9 @@ import java.util.ArrayList; public class WindowAnimator { private static final String TAG = "WindowAnimator"; + /** How long to give statusbar to clear the private keyguard flag when animating out */ + private static final long KEYGUARD_ANIM_TIMEOUT_MS = 1000; + final WindowManagerService mService; final Context mContext; final WindowManagerPolicy mPolicy; @@ -82,6 +86,8 @@ public class WindowAnimator { boolean mInitialized = false; + boolean mKeyguardGoingAway; + // forceHiding states. static final int KEYGUARD_NOT_SHOWN = 0; static final int KEYGUARD_ANIMATING_IN = 1; @@ -213,6 +219,29 @@ public class WindowAnimator { final WindowList windows = mService.getWindowListLocked(displayId); ArrayList<WindowStateAnimator> unForceHiding = null; boolean wallpaperInUnForceHiding = false; + + if (mKeyguardGoingAway) { + for (int i = windows.size() - 1; i >= 0; i--) { + WindowState win = windows.get(i); + if (!mPolicy.isKeyguardHostWindow(win.mAttrs)) { + continue; + } + final WindowStateAnimator winAnimator = win.mWinAnimator; + if (mPolicy.doesForceHide(win.mAttrs)) { + if (!winAnimator.mAnimating) { + // Create a new animation to delay until keyguard is gone on its own. + winAnimator.mAnimation = new AlphaAnimation(1.0f, 1.0f); + winAnimator.mAnimation.setDuration(KEYGUARD_ANIM_TIMEOUT_MS); + winAnimator.mAnimationIsEntrance = false; + } + } else { + mKeyguardGoingAway = false; + winAnimator.clearAnimation(); + } + break; + } + } + mForceHiding = KEYGUARD_NOT_SHOWN; for (int i = windows.size() - 1; i >= 0; i--) { @@ -239,7 +268,7 @@ public class WindowAnimator { } } - if (mPolicy.doesForceHide(win, win.mAttrs)) { + if (mPolicy.doesForceHide(win.mAttrs)) { if (!wasAnimating && nowAnimating) { if (WindowManagerService.DEBUG_ANIM || WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG, @@ -252,6 +281,11 @@ public class WindowAnimator { getPendingLayoutChanges(displayId)); } mService.mFocusMayChange = true; + } else if (mKeyguardGoingAway && !nowAnimating) { + // Timeout!! + Slog.e(TAG, "Timeout waiting for animation to startup"); + mPolicy.startKeyguardExitAnimation(0); + mKeyguardGoingAway = false; } if (win.isReadyForDisplay()) { if (nowAnimating) { @@ -265,7 +299,7 @@ public class WindowAnimator { } } if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG, - "Force hide " + mForceHiding + "Force hide " + forceHidingToString() + " hasSurface=" + win.mHasSurface + " policyVis=" + win.mPolicyVisibility + " destroying=" + win.mDestroying @@ -349,12 +383,18 @@ public class WindowAnimator { // If we have windows that are being show due to them no longer // being force-hidden, apply the appropriate animation to them. if (unForceHiding != null) { + boolean startKeyguardExit = true; for (int i=unForceHiding.size()-1; i>=0; i--) { Animation a = mPolicy.createForceHideEnterAnimation(wallpaperInUnForceHiding); if (a != null) { final WindowStateAnimator winAnimator = unForceHiding.get(i); winAnimator.setAnimation(a); winAnimator.mAnimationIsEntrance = true; + if (startKeyguardExit) { + // Do one time only. + mPolicy.startKeyguardExitAnimation(a.getStartOffset()); + startKeyguardExit = false; + } } } } diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 6fbb39d..27ab5ac 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -5126,6 +5126,18 @@ public class WindowManagerService extends IWindowManager.Stub } @Override + public void keyguardGoingAway() { + if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DISABLE_KEYGUARD) + != PackageManager.PERMISSION_GRANTED) { + throw new SecurityException("Requires DISABLE_KEYGUARD permission"); + } + synchronized (mWindowMap) { + mAnimator.mKeyguardGoingAway = true; + requestTraversalLocked(); + } + } + + @Override public void closeSystemDialogs(String reason) { synchronized(mWindowMap) { final int numDisplays = mDisplayContents.size(); @@ -7148,9 +7160,7 @@ public class WindowManagerService extends IWindowManager.Stub public static final int TAP_OUTSIDE_STACK = 31; public static final int NOTIFY_ACTIVITY_DRAWN = 32; - public static final int REMOVE_STARTING_TIMEOUT = 33; - - public static final int SHOW_DISPLAY_MASK = 34; + public static final int SHOW_DISPLAY_MASK = 33; @Override public void handleMessage(Message msg) { |