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

Commit 52b33281 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android Git Automerger
Browse files

am 2240f806: am d04f864c: am b9eedce2: Merge "Fix lockscreen launch animations...

am 2240f806: am d04f864c: am b9eedce2: Merge "Fix lockscreen launch animations once and for all" into lmp-mr1-dev

* commit '2240f806':
  Fix lockscreen launch animations once and for all
parents 2c75562f 2240f806
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -426,8 +426,10 @@ public class KeyguardViewMediator extends SystemUI {
        }

        public void keyguardDone(boolean authenticated) {
            if (!mKeyguardDonePending) {
                KeyguardViewMediator.this.keyguardDone(authenticated, true);
            }
        }

        public void keyguardDoneDrawing() {
            mHandler.sendEmptyMessage(KEYGUARD_DONE_DRAWING);
@@ -1049,9 +1051,6 @@ public class KeyguardViewMediator extends SystemUI {
    public void keyguardDone(boolean authenticated, boolean wakeup) {
        if (DEBUG) Log.d(TAG, "keyguardDone(" + authenticated + ")");
        EventLog.writeEvent(70000, 2);
        synchronized (this) {
            mKeyguardDonePending = false;
        }
        Message msg = mHandler.obtainMessage(KEYGUARD_DONE, authenticated ? 1 : 0, wakeup ? 1 : 0);
        mHandler.sendMessage(msg);
    }
@@ -1122,6 +1121,9 @@ public class KeyguardViewMediator extends SystemUI {
     */
    private void handleKeyguardDone(boolean authenticated, boolean wakeup) {
        if (DEBUG) Log.d(TAG, "handleKeyguardDone");
        synchronized (this) {
            mKeyguardDonePending = false;
        }

        if (authenticated) {
            mUpdateMonitor.clearFailedUnlockAttempts();
@@ -1297,6 +1299,7 @@ public class KeyguardViewMediator extends SystemUI {
    }

    private void handleOnActivityDrawn() {
        if (DEBUG) Log.d(TAG, "handleOnActivityDrawn: mKeyguardDonePending=" + mKeyguardDonePending);
        if (mKeyguardDonePending) {
            mStatusBarKeyguardViewManager.onActivityDrawn();
        }
+0 −3
Original line number Diff line number Diff line
@@ -1538,9 +1538,6 @@ final class ActivityStack {
            ActivityOptions.abort(options);
            if (DEBUG_STATES) Slog.d(TAG, "resumeTopActivityLocked: Top activity resumed " + next);
            if (DEBUG_STACK) mStackSupervisor.validateTopActivitiesLocked();

            // Make sure to notify Keyguard as well if it is waiting for an activity to be drawn.
            mStackSupervisor.notifyActivityDrawnForKeyguard();
            return false;
        }

+13 −1
Original line number Diff line number Diff line
@@ -656,7 +656,6 @@ public final class ActivityStackSupervisor implements DisplayListener {

    void reportActivityVisibleLocked(ActivityRecord r) {
        sendWaitingVisibleReportLocked(r);
        notifyActivityDrawnForKeyguard();
    }

    void sendWaitingVisibleReportLocked(ActivityRecord r) {
@@ -1832,6 +1831,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
                    final ActivityStack lastStack = getLastStack();
                    ActivityRecord curTop = lastStack == null?
                            null : lastStack.topRunningNonDelayedActivityLocked(notTop);
                    boolean movedToFront = false;
                    if (curTop != null && (curTop.task != intentActivity.task ||
                            curTop.task != lastStack.topTask())) {
                        r.intent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
@@ -1851,6 +1851,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
                                intentActivity.task.setTaskToReturnTo(HOME_ACTIVITY_TYPE);
                            }
                            options = null;
                            movedToFront = true;
                        }
                    }
                    // If the caller has requested that the target task be
@@ -1865,6 +1866,12 @@ public final class ActivityStackSupervisor implements DisplayListener {
                        // sure we have correctly resumed the top activity.
                        if (doResume) {
                            resumeTopActivitiesLocked(targetStack, null, options);

                            // Make sure to notify Keyguard as well if we are not running an app
                            // transition later.
                            if (!movedToFront) {
                                notifyActivityDrawnForKeyguard();
                            }
                        } else {
                            ActivityOptions.abort(options);
                        }
@@ -1956,6 +1963,11 @@ public final class ActivityStackSupervisor implements DisplayListener {
                        // sure we have correctly resumed the top activity.
                        if (doResume) {
                            targetStack.resumeTopActivityLocked(null, options);
                            if (!movedToFront) {
                                // Make sure to notify Keyguard as well if we are not running an app
                                // transition later.
                                notifyActivityDrawnForKeyguard();
                            }
                        } else {
                            ActivityOptions.abort(options);
                        }
+46 −19
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;

import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_SYSTEM_ERROR;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
import static com.android.server.wm.WindowManagerService.DEBUG_KEYGUARD;
import static com.android.server.wm.WindowManagerService.LayoutFields.SET_UPDATE_ROTATION;
import static com.android.server.wm.WindowManagerService.LayoutFields.SET_WALLPAPER_MAY_CHANGE;
@@ -241,6 +242,7 @@ public class WindowAnimator {
                        winAnimator.mAnimation = new AlphaAnimation(1.0f, 1.0f);
                        winAnimator.mAnimation.setDuration(KEYGUARD_ANIM_TIMEOUT_MS);
                        winAnimator.mAnimationIsEntrance = false;
                        winAnimator.mAnimationStartTime = -1;
                    }
                } else {
                    if (DEBUG_KEYGUARD) Slog.d(TAG,
@@ -263,6 +265,7 @@ public class WindowAnimator {
                null : winShowWhenLocked.mAppToken;

        boolean wallpaperInUnForceHiding = false;
        boolean startingInUnForceHiding = false;
        ArrayList<WindowStateAnimator> unForceHiding = null;
        WindowState wallpaper = null;
        for (int i = windows.size() - 1; i >= 0; i--) {
@@ -344,8 +347,13 @@ public class WindowAnimator {
                        if (DEBUG_KEYGUARD || WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
                                "Now policy hidden: " + win);
                    } else {
                        if (!win.showLw(false, false)) {
                            // Was already showing.
                        boolean applyExistingExitAnimation = mPostKeyguardExitAnimation != null
                                && !winAnimator.mKeyguardGoingAwayAnimation
                                && win.hasDrawnLw();

                        // If the window is already showing and we don't need to apply an existing
                        // Keyguard exit animation, skip.
                        if (!win.showLw(false, false) && !applyExistingExitAnimation) {
                            continue;
                        }
                        final boolean visibleNow = win.isVisibleNow();
@@ -364,11 +372,19 @@ public class WindowAnimator {
                            if ((flags & FLAG_SHOW_WALLPAPER) != 0) {
                                wallpaperInUnForceHiding = true;
                            }
                        } else if (mPostKeyguardExitAnimation != null) {
                            if (win.mAttrs.type == TYPE_APPLICATION_STARTING) {
                                startingInUnForceHiding = true;
                            }
                        } else if (applyExistingExitAnimation) {
                            // We're already in the middle of an animation. Use the existing
                            // animation to bring in this window.
                            winAnimator.setAnimation(mPostKeyguardExitAnimation);
                            winAnimator.keyguardGoingAwayAnimation = true;
                            if (DEBUG_KEYGUARD) Slog.v(TAG,
                                    "Applying existing Keyguard exit animation to new window: win="
                                            + win);
                            Animation a = mPolicy.createForceHideEnterAnimation(
                                    false, mKeyguardGoingAwayToNotificationShade);
                            winAnimator.setAnimation(a, mPostKeyguardExitAnimation.getStartTime());
                            winAnimator.mKeyguardGoingAwayAnimation = true;
                        }
                        final WindowState currentFocus = mService.mCurrentFocus;
                        if (currentFocus == null || currentFocus.mLayer < win.mLayer) {
@@ -421,24 +437,33 @@ public class WindowAnimator {
        } // end forall windows

        // If we have windows that are being show due to them no longer
        // being force-hidden, apply the appropriate animation to them.
        // being force-hidden, apply the appropriate animation to them if animations are not
        // disabled.
        if (unForceHiding != null) {
            // This only happens the first time that we detect the keyguard is animating out.
            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="
                        + unForceHiding);
                mPostKeyguardExitAnimation = mPolicy.createForceHideEnterAnimation(
                        wallpaperInUnForceHiding, mKeyguardGoingAwayToNotificationShade);
            }
            if (mPostKeyguardExitAnimation != null) {
            if (!mKeyguardGoingAwayDisableWindowAnimations) {
                boolean first = true;
                for (int i=unForceHiding.size()-1; i>=0; i--) {
                    final WindowStateAnimator winAnimator = unForceHiding.get(i);
                    winAnimator.setAnimation(mPostKeyguardExitAnimation);
                    winAnimator.keyguardGoingAwayAnimation = true;
                    Animation a = mPolicy.createForceHideEnterAnimation(
                            wallpaperInUnForceHiding && !startingInUnForceHiding,
                            mKeyguardGoingAwayToNotificationShade);
                    if (a != null) {
                        if (DEBUG_KEYGUARD) Slog.v(TAG,
                                "Starting keyguard exit animation on window " + winAnimator.mWin);
                        winAnimator.setAnimation(a);
                        winAnimator.mKeyguardGoingAwayAnimation = true;
                        if (first) {
                            mPostKeyguardExitAnimation = a;
                            mPostKeyguardExitAnimation.setStartTime(mCurrentTime);
                            first = false;
                        }
                    }
                }
            } else if (mKeyguardGoingAway) {
                mPolicy.startKeyguardExitAnimation(mCurrentTime, 0 /* duration */);
                mKeyguardGoingAway = false;
            }


            // Wallpaper is going away in un-force-hide motion, animate it as well.
            if (!wallpaperInUnForceHiding && wallpaper != null
@@ -459,8 +484,10 @@ public class WindowAnimator {
                        mPostKeyguardExitAnimation.getStartOffset(),
                        mPostKeyguardExitAnimation.getDuration());
                mKeyguardGoingAway = false;
            } else if (mPostKeyguardExitAnimation.hasEnded()) {
            } else if (mCurrentTime - mPostKeyguardExitAnimation.getStartTime()
                    > mPostKeyguardExitAnimation.getDuration()) {
                // Done with the animation, reset.
                if (DEBUG_KEYGUARD) Slog.v(TAG, "Done with Keyguard exit animations.");
                mPostKeyguardExitAnimation = null;
            }
        }
+7 −5
Original line number Diff line number Diff line
@@ -1759,7 +1759,7 @@ public class WindowManagerService extends IWindowManager.Stub
            // wallpaper during the animation so it doesn't flicker out.
            final boolean hasWallpaper = (w.mAttrs.flags&FLAG_SHOW_WALLPAPER) != 0
                    || (w.mAppToken != null
                            && w.mWinAnimator.keyguardGoingAwayAnimation);
                            && w.mWinAnimator.mKeyguardGoingAwayAnimation);
            if (hasWallpaper && w.isOnScreen()
                    && (mWallpaperTarget == w || w.isDrawFinishedLw())) {
                if (DEBUG_WALLPAPER) Slog.v(TAG,
@@ -2541,8 +2541,8 @@ public class WindowManagerService extends IWindowManager.Stub
            }
            mInputMonitor.updateInputWindowsLw(false /*force*/);

            if (true || localLOGV) Slog.v(TAG, "addWindow: New client " + client.asBinder()
                    + ": window=" + win + " Callers=" + Debug.getCallers(5));
            if (true || localLOGV || DEBUG_ADD_REMOVE) Slog.v(TAG, "addWindow: New client "
                    + client.asBinder() + ": window=" + win + " Callers=" + Debug.getCallers(5));

            if (win.isVisibleOrAdding() && updateOrientationFromAppTokensLocked(false)) {
                reportNewConfig = true;
@@ -5411,7 +5411,7 @@ public class WindowManagerService extends IWindowManager.Stub

    public void notifyActivityDrawnForKeyguard() {
        if (DEBUG_KEYGUARD) Slog.d(TAG, "notifyActivityDrawnForKeyguard: waiting="
                + mKeyguardWaitingForActivityDrawn);
                + mKeyguardWaitingForActivityDrawn + " Callers=" + Debug.getCallers(5));
        synchronized (mWindowMap) {
            if (mKeyguardWaitingForActivityDrawn) {
                mPolicy.notifyActivityDrawnForKeyguardLw();
@@ -9322,6 +9322,7 @@ public class WindowManagerService extends IWindowManager.Stub
            }
            updateFocusedWindowLocked(UPDATE_FOCUS_PLACING_SURFACES, true /*updateInputWindows*/);
            mFocusMayChange = false;
            notifyActivityDrawnForKeyguard();
        }

        return changes;
@@ -9809,7 +9810,8 @@ public class WindowManagerService extends IWindowManager.Stub
                                atoken.numInterestingWindows = atoken.numDrawnWindows = 0;
                                atoken.startingDisplayed = false;
                            }
                            if ((w.isOnScreen() || winAnimator.mAttrType == TYPE_BASE_APPLICATION)
                            if ((w.isOnScreenIgnoringKeyguard()
                                    || winAnimator.mAttrType == TYPE_BASE_APPLICATION)
                                    && !w.mExiting && !w.mDestroying) {
                                if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) {
                                    Slog.v(TAG, "Eval win " + w + ": isDrawn=" + w.isDrawnLw()
Loading