Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7b1b0f63 authored by Craig Mautner's avatar Craig Mautner Committed by Android (Google) Code Review
Browse files

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

parents efec89f2 42d04db4
Loading
Loading
Loading
Loading
+21 −10
Original line number Original line Diff line number Diff line
@@ -952,10 +952,13 @@ public final class ActivityManagerService extends ActivityManagerNative
     */
     */
    private boolean mWentToSleep = false;
    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.
     * 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.
     * Set if we are shutting down the system, similar to sleeping.
@@ -6118,9 +6121,8 @@ public final class ActivityManagerService extends ActivityManagerNative
            synchronized (this) {
            synchronized (this) {
                if (DEBUG_LOCKSCREEN) logLockScreen("");
                if (DEBUG_LOCKSCREEN) logLockScreen("");
                mWindowManager.keyguardWaitingForActivityDrawn();
                mWindowManager.keyguardWaitingForActivityDrawn();
                if (mLockScreenShown) {
                if (mLockScreenShown == LOCK_SCREEN_SHOWN) {
                    mLockScreenShown = false;
                    mLockScreenShown = LOCK_SCREEN_LEAVING;
                    comeOutOfSleepIfNeededLocked();
                }
                }
            }
            }
        } finally {
        } finally {
@@ -9957,14 +9959,23 @@ public final class ActivityManagerService extends ActivityManagerNative
        Binder.restoreCallingIdentity(origId);
        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) {
    void logLockScreen(String msg) {
        if (DEBUG_LOCKSCREEN) Slog.d(TAG, Debug.getCallers(2) + ":" + msg +
        if (DEBUG_LOCKSCREEN) Slog.d(TAG, Debug.getCallers(2) + ":" + msg +
                " mLockScreenShown=" + mLockScreenShown + " mWentToSleep=" +
                " mLockScreenShown=" + lockScreenShownToString() + " mWentToSleep=" +
                mWentToSleep + " mSleeping=" + mSleeping);
                mWentToSleep + " mSleeping=" + mSleeping);
    }
    }
    private void comeOutOfSleepIfNeededLocked() {
    void comeOutOfSleepIfNeededLocked() {
        if ((!mWentToSleep && !mLockScreenShown) || mRunningVoice) {
        if ((!mWentToSleep && mLockScreenShown == LOCK_SCREEN_HIDDEN) || mRunningVoice) {
            if (mSleeping) {
            if (mSleeping) {
                mSleeping = false;
                mSleeping = false;
                mStackSupervisor.comeOutOfSleepIfNeededLocked();
                mStackSupervisor.comeOutOfSleepIfNeededLocked();
@@ -10001,7 +10012,7 @@ public final class ActivityManagerService extends ActivityManagerNative
            long ident = Binder.clearCallingIdentity();
            long ident = Binder.clearCallingIdentity();
            try {
            try {
                if (DEBUG_LOCKSCREEN) logLockScreen(" shown=" + shown);
                if (DEBUG_LOCKSCREEN) logLockScreen(" shown=" + shown);
                mLockScreenShown = shown;
                mLockScreenShown = shown ? LOCK_SCREEN_SHOWN : LOCK_SCREEN_HIDDEN;
                comeOutOfSleepIfNeededLocked();
                comeOutOfSleepIfNeededLocked();
            } finally {
            } finally {
                Binder.restoreCallingIdentity(ident);
                Binder.restoreCallingIdentity(ident);
@@ -12767,9 +12778,9 @@ public final class ActivityManagerService extends ActivityManagerNative
            }
            }
        }
        }
        if (dumpPackage == null) {
        if (dumpPackage == null) {
            if (mSleeping || mWentToSleep || mLockScreenShown) {
            if (mSleeping || mWentToSleep || mLockScreenShown != LOCK_SCREEN_HIDDEN) {
                pw.println("  mSleeping=" + mSleeping + " mWentToSleep=" + mWentToSleep
                pw.println("  mSleeping=" + mSleeping + " mWentToSleep=" + mWentToSleep
                        + " mLockScreenShown " + mLockScreenShown);
                        + " mLockScreenShown " + lockScreenShownToString());
            }
            }
            if (mShuttingDown || mRunningVoice) {
            if (mShuttingDown || mRunningVoice) {
                pw.print("  mShuttingDown=" + mShuttingDown + " mRunningVoice=" + mRunningVoice);
                pw.print("  mShuttingDown=" + mShuttingDown + " mRunningVoice=" + mRunningVoice);
+7 −6
Original line number Original line Diff line number Diff line
@@ -241,9 +241,6 @@ final class ActivityStack {
    /** Run all ActivityStacks through this */
    /** Run all ActivityStacks through this */
    final ActivityStackSupervisor mStackSupervisor;
    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 PAUSE_TIMEOUT_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 1;
    static final int DESTROY_TIMEOUT_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 2;
    static final int DESTROY_TIMEOUT_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 2;
    static final int LAUNCH_TICK_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 3;
    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) {
    final boolean resumeTopActivityLocked(ActivityRecord prev, Bundle options) {
        if (inResumeTopActivity) {
        if (mStackSupervisor.inResumeTopActivity) {
            // Don't even start recursing.
            // Don't even start recursing.
            return false;
            return false;
        }
        }
@@ -1476,10 +1473,14 @@ final class ActivityStack {
        boolean result = false;
        boolean result = false;
        try {
        try {
            // Protect against recursion.
            // 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);
            result = resumeTopActivityInnerLocked(prev, options);
        } finally {
        } finally {
            inResumeTopActivity = false;
            mStackSupervisor.inResumeTopActivity = false;
        }
        }
        return result;
        return result;
    }
    }
+3 −0
Original line number Original line Diff line number Diff line
@@ -274,6 +274,9 @@ public final class ActivityStackSupervisor implements DisplayListener {
    final ArrayList<PendingActivityLaunch> mPendingActivityLaunches
    final ArrayList<PendingActivityLaunch> mPendingActivityLaunches
            = new ArrayList<PendingActivityLaunch>();
            = 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
     * Description of a request to start a new activity, which has been held
     * due to app switches being disabled.
     * due to app switches being disabled.
+14 −12
Original line number Original line Diff line number Diff line
@@ -272,6 +272,7 @@ public class WindowAnimator {
            if (winAnimator.mSurfaceControl != null) {
            if (winAnimator.mSurfaceControl != null) {
                final boolean wasAnimating = winAnimator.mWasAnimating;
                final boolean wasAnimating = winAnimator.mWasAnimating;
                final boolean nowAnimating = winAnimator.stepAnimationLocked(mCurrentTime);
                final boolean nowAnimating = winAnimator.stepAnimationLocked(mCurrentTime);
                mAnimating |= nowAnimating;


                if (WindowManagerService.DEBUG_WALLPAPER) {
                if (WindowManagerService.DEBUG_WALLPAPER) {
                    Slog.v(TAG, win + ": wasAnimating=" + wasAnimating +
                    Slog.v(TAG, win + ": wasAnimating=" + wasAnimating +
@@ -423,7 +424,8 @@ public class WindowAnimator {
            if (mKeyguardGoingAwayDisableWindowAnimations) {
            if (mKeyguardGoingAwayDisableWindowAnimations) {
                if (DEBUG_KEYGUARD) Slog.d(TAG, "updateWindowsLocked: skipping anim for windows");
                if (DEBUG_KEYGUARD) Slog.d(TAG, "updateWindowsLocked: skipping anim for windows");
            } else {
            } 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(
                mPostKeyguardExitAnimation = mPolicy.createForceHideEnterAnimation(
                        wallpaperInUnForceHiding, mKeyguardGoingAwayToNotificationShade);
                        wallpaperInUnForceHiding, mKeyguardGoingAwayToNotificationShade);
            }
            }
@@ -434,6 +436,17 @@ public class WindowAnimator {
                    winAnimator.keyguardGoingAwayAnimation = true;
                    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) {
        if (mPostKeyguardExitAnimation != null) {
@@ -448,17 +461,6 @@ public class WindowAnimator {
                mPostKeyguardExitAnimation = null;
                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) {
    private void updateWallpaperLocked(int displayId) {
+7 −4
Original line number Original line Diff line number Diff line
@@ -486,8 +486,9 @@ class WindowStateAnimator {
    }
    }


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