Merge "More fixes for keyguard animations." into lmp-mr1-dev

This commit is contained in:
Craig Mautner
2014-11-06 20:49:35 +00:00
committed by Android (Google) Code Review
5 changed files with 52 additions and 32 deletions

View File

@@ -952,10 +952,13 @@ public final class ActivityManagerService extends ActivityManagerNative
*/
private boolean mWentToSleep = false;
static final int LOCK_SCREEN_HIDDEN = 0;
static final int LOCK_SCREEN_LEAVING = 1;
static final int LOCK_SCREEN_SHOWN = 2;
/**
* State of external call telling us if the lock screen is shown.
*/
private boolean mLockScreenShown = false;
int mLockScreenShown = LOCK_SCREEN_HIDDEN;
/**
* Set if we are shutting down the system, similar to sleeping.
@@ -6118,9 +6121,8 @@ public final class ActivityManagerService extends ActivityManagerNative
synchronized (this) {
if (DEBUG_LOCKSCREEN) logLockScreen("");
mWindowManager.keyguardWaitingForActivityDrawn();
if (mLockScreenShown) {
mLockScreenShown = false;
comeOutOfSleepIfNeededLocked();
if (mLockScreenShown == LOCK_SCREEN_SHOWN) {
mLockScreenShown = LOCK_SCREEN_LEAVING;
}
}
} finally {
@@ -9957,14 +9959,23 @@ public final class ActivityManagerService extends ActivityManagerNative
Binder.restoreCallingIdentity(origId);
}
private String lockScreenShownToString() {
switch (mLockScreenShown) {
case LOCK_SCREEN_HIDDEN: return "LOCK_SCREEN_HIDDEN";
case LOCK_SCREEN_LEAVING: return "LOCK_SCREEN_LEAVING";
case LOCK_SCREEN_SHOWN: return "LOCK_SCREEN_SHOWN";
default: return "Unknown=" + mLockScreenShown;
}
}
void logLockScreen(String msg) {
if (DEBUG_LOCKSCREEN) Slog.d(TAG, Debug.getCallers(2) + ":" + msg +
" mLockScreenShown=" + mLockScreenShown + " mWentToSleep=" +
" mLockScreenShown=" + lockScreenShownToString() + " mWentToSleep=" +
mWentToSleep + " mSleeping=" + mSleeping);
}
private void comeOutOfSleepIfNeededLocked() {
if ((!mWentToSleep && !mLockScreenShown) || mRunningVoice) {
void comeOutOfSleepIfNeededLocked() {
if ((!mWentToSleep && mLockScreenShown == LOCK_SCREEN_HIDDEN) || mRunningVoice) {
if (mSleeping) {
mSleeping = false;
mStackSupervisor.comeOutOfSleepIfNeededLocked();
@@ -10001,7 +10012,7 @@ public final class ActivityManagerService extends ActivityManagerNative
long ident = Binder.clearCallingIdentity();
try {
if (DEBUG_LOCKSCREEN) logLockScreen(" shown=" + shown);
mLockScreenShown = shown;
mLockScreenShown = shown ? LOCK_SCREEN_SHOWN : LOCK_SCREEN_HIDDEN;
comeOutOfSleepIfNeededLocked();
} finally {
Binder.restoreCallingIdentity(ident);
@@ -12767,9 +12778,9 @@ public final class ActivityManagerService extends ActivityManagerNative
}
}
if (dumpPackage == null) {
if (mSleeping || mWentToSleep || mLockScreenShown) {
if (mSleeping || mWentToSleep || mLockScreenShown != LOCK_SCREEN_HIDDEN) {
pw.println(" mSleeping=" + mSleeping + " mWentToSleep=" + mWentToSleep
+ " mLockScreenShown " + mLockScreenShown);
+ " mLockScreenShown " + lockScreenShownToString());
}
if (mShuttingDown || mRunningVoice) {
pw.print(" mShuttingDown=" + mShuttingDown + " mRunningVoice=" + mRunningVoice);

View File

@@ -241,9 +241,6 @@ final class ActivityStack {
/** Run all ActivityStacks through this */
final ActivityStackSupervisor mStackSupervisor;
/** Used to keep resumeTopActivityLocked() from being entered recursively */
private boolean inResumeTopActivity;
static final int PAUSE_TIMEOUT_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 1;
static final int DESTROY_TIMEOUT_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 2;
static final int LAUNCH_TICK_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 3;
@@ -1468,7 +1465,7 @@ final class ActivityStack {
}
final boolean resumeTopActivityLocked(ActivityRecord prev, Bundle options) {
if (inResumeTopActivity) {
if (mStackSupervisor.inResumeTopActivity) {
// Don't even start recursing.
return false;
}
@@ -1476,10 +1473,14 @@ final class ActivityStack {
boolean result = false;
try {
// Protect against recursion.
inResumeTopActivity = true;
mStackSupervisor.inResumeTopActivity = true;
if (mService.mLockScreenShown == ActivityManagerService.LOCK_SCREEN_LEAVING) {
mService.mLockScreenShown = ActivityManagerService.LOCK_SCREEN_HIDDEN;
mService.comeOutOfSleepIfNeededLocked();
}
result = resumeTopActivityInnerLocked(prev, options);
} finally {
inResumeTopActivity = false;
mStackSupervisor.inResumeTopActivity = false;
}
return result;
}

View File

@@ -274,6 +274,9 @@ public final class ActivityStackSupervisor implements DisplayListener {
final ArrayList<PendingActivityLaunch> mPendingActivityLaunches
= new ArrayList<PendingActivityLaunch>();
/** Used to keep resumeTopActivityLocked() from being entered recursively */
boolean inResumeTopActivity;
/**
* Description of a request to start a new activity, which has been held
* due to app switches being disabled.

View File

@@ -272,6 +272,7 @@ public class WindowAnimator {
if (winAnimator.mSurfaceControl != null) {
final boolean wasAnimating = winAnimator.mWasAnimating;
final boolean nowAnimating = winAnimator.stepAnimationLocked(mCurrentTime);
mAnimating |= nowAnimating;
if (WindowManagerService.DEBUG_WALLPAPER) {
Slog.v(TAG, win + ": wasAnimating=" + wasAnimating +
@@ -423,7 +424,8 @@ public class WindowAnimator {
if (mKeyguardGoingAwayDisableWindowAnimations) {
if (DEBUG_KEYGUARD) Slog.d(TAG, "updateWindowsLocked: skipping anim for windows");
} else {
if (DEBUG_KEYGUARD) Slog.d(TAG, "updateWindowsLocked: created anim for windows");
if (DEBUG_KEYGUARD) Slog.d(TAG, "updateWindowsLocked: created anim for windows="
+ unForceHiding);
mPostKeyguardExitAnimation = mPolicy.createForceHideEnterAnimation(
wallpaperInUnForceHiding, mKeyguardGoingAwayToNotificationShade);
}
@@ -434,6 +436,17 @@ public class WindowAnimator {
winAnimator.keyguardGoingAwayAnimation = true;
}
}
// Wallpaper is going away in un-force-hide motion, animate it as well.
if (!wallpaperInUnForceHiding && wallpaper != null
&& !mKeyguardGoingAwayDisableWindowAnimations) {
if (DEBUG_KEYGUARD) Slog.d(TAG, "updateWindowsLocked: wallpaper animating away");
Animation a = mPolicy.createForceHideWallpaperExitAnimation(
mKeyguardGoingAwayToNotificationShade);
if (a != null) {
wallpaper.mWinAnimator.setAnimation(a);
}
}
}
if (mPostKeyguardExitAnimation != null) {
@@ -448,17 +461,6 @@ public class WindowAnimator {
mPostKeyguardExitAnimation = null;
}
}
// Wallpaper is going away in un-force-hide motion, animate it as well.
if (!wallpaperInUnForceHiding && wallpaper != null
&& !mKeyguardGoingAwayDisableWindowAnimations) {
if (DEBUG_KEYGUARD) Slog.d(TAG, "updateWindowsLocked: wallpaper animating away");
Animation a = mPolicy.createForceHideWallpaperExitAnimation(
mKeyguardGoingAwayToNotificationShade);
if (a != null) {
wallpaper.mWinAnimator.setAnimation(a);
}
}
}
private void updateWallpaperLocked(int displayId) {

View File

@@ -486,8 +486,9 @@ class WindowStateAnimator {
}
boolean finishDrawingLocked() {
if (DEBUG_STARTING_WINDOW &&
mWin.mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_STARTING) {
final boolean startingWindow =
mWin.mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
if (DEBUG_STARTING_WINDOW && startingWindow) {
Slog.v(TAG, "Finishing drawing window " + mWin + ": mDrawState="
+ drawStateToString());
}
@@ -495,11 +496,13 @@ class WindowStateAnimator {
if (DEBUG_SURFACE_TRACE || DEBUG_ANIM || SHOW_TRANSACTIONS || DEBUG_ORIENTATION)
Slog.v(TAG, "finishDrawingLocked: mDrawState=COMMIT_DRAW_PENDING " + this + " in "
+ mSurfaceControl);
if (DEBUG_STARTING_WINDOW &&
mWin.mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_STARTING) {
if (DEBUG_STARTING_WINDOW && startingWindow) {
Slog.v(TAG, "Draw state now committed in " + mWin);
}
mDrawState = COMMIT_DRAW_PENDING;
if (startingWindow) {
mService.notifyActivityDrawnForKeyguard();
}
return true;
}
return false;