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

Commit 80b1f642 authored by Craig Mautner's avatar Craig Mautner
Browse files

Fix bad crop on clip reveal animation

For non-fullscreen apps the dimensions of the app window must be used
to set up the animation.

Fixes bug 18392184.

Change-Id: Ia1681e4a2cb74be2f820cb76ddc7c651a5e4aab6
parent 8ce568e7
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -501,12 +501,15 @@ public class AppTransition implements Dump {
        return a;
    }

    private Animation createClipRevealAnimationLocked(int transit, boolean enter,
                                                      int appWidth, int appHeight) {
    private Animation createClipRevealAnimationLocked(int transit, boolean enter, Rect appFrame) {
        final Animation anim;
        if (enter) {
            // Reveal will expand and move faster in horizontal direction

            // Start from upper left of start and move to final position
            final int appWidth = appFrame.width();
            final int appHeight = appFrame.height();

            // Start from size of launch icon, expand to full width/height
            Animation clipAnimLR = new ClipRectLRAnimation(
                    (appWidth - mNextAppTransitionStartWidth) / 2,
@@ -521,9 +524,9 @@ public class AppTransition implements Dump {

            // Start from middle of launch icon area, move to 0, 0
            int startMiddleX = mNextAppTransitionStartX +
                    (mNextAppTransitionStartWidth - appWidth) / 2;
                    (mNextAppTransitionStartWidth - appWidth) / 2 - appFrame.left;
            int startMiddleY = mNextAppTransitionStartY +
                    (mNextAppTransitionStartHeight - appHeight) / 2;
                    (mNextAppTransitionStartHeight - appHeight) / 2 - appFrame.top;

            TranslateXAnimation translateX = new TranslateXAnimation(
                    Animation.ABSOLUTE, startMiddleX, Animation.ABSOLUTE, 0);
@@ -940,7 +943,7 @@ public class AppTransition implements Dump {

    Animation loadAnimation(WindowManager.LayoutParams lp, int transit, boolean enter,
            int appWidth, int appHeight, int orientation, Rect containingFrame, Rect contentInsets,
            boolean isFullScreen, boolean isVoiceInteraction) {
            Rect appFrame, boolean isFullScreen, boolean isVoiceInteraction) {
        Animation a;
        if (isVoiceInteraction && (transit == TRANSIT_ACTIVITY_OPEN
                || transit == TRANSIT_TASK_OPEN
@@ -977,9 +980,7 @@ public class AppTransition implements Dump {
                            + " anim=" + a + " nextAppTransition=ANIM_CUSTOM_IN_PLACE"
                            + " transit=" + transit + " Callers=" + Debug.getCallers(3));
        } else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_CLIP_REVEAL) {
            a = createClipRevealAnimationLocked(transit, enter,
                    containingFrame.right - containingFrame.left,
                    containingFrame.bottom - containingFrame.top);
            a = createClipRevealAnimationLocked(transit, enter, appFrame);
            if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) Slog.v(TAG,
                    "applyAnimation:"
                            + " anim=" + a + " nextAppTransition=ANIM_CLIP_REVEAL"
+6 −2
Original line number Diff line number Diff line
@@ -3385,6 +3385,7 @@ public class WindowManagerService extends IWindowManager.Stub
            WindowState win = atoken.findMainWindow();
            Rect containingFrame = new Rect(0, 0, width, height);
            Rect contentInsets = new Rect();
            Rect appFrame = new Rect(0, 0, width, height);
            boolean isFullScreen = true;
            if (win != null) {
                if (win.mContainingFrame != null) {
@@ -3393,6 +3394,9 @@ public class WindowManagerService extends IWindowManager.Stub
                if (win.mContentInsets != null) {
                    contentInsets.set(win.mContentInsets);
                }
                if (win.mFrame != null) {
                    appFrame.set(win.mFrame);
                }
                isFullScreen =
                        ((win.mSystemUiVisibility & SYSTEM_UI_FLAGS_LAYOUT_STABLE_FULLSCREEN) ==
                                SYSTEM_UI_FLAGS_LAYOUT_STABLE_FULLSCREEN) ||
@@ -3406,8 +3410,8 @@ public class WindowManagerService extends IWindowManager.Stub
                enter = false;
            }
            Animation a = mAppTransition.loadAnimation(lp, transit, enter, width, height,
                    mCurConfiguration.orientation, containingFrame, contentInsets, isFullScreen,
                    isVoiceInteraction);
                    mCurConfiguration.orientation, containingFrame, contentInsets, appFrame,
                    isFullScreen, isVoiceInteraction);
            if (a != null) {
                if (DEBUG_ANIM) {
                    RuntimeException e = null;
+4 −0
Original line number Diff line number Diff line
@@ -1623,6 +1623,10 @@ final class WindowState implements WindowManagerPolicy.WindowState {
                    pw.println();
            pw.print(prefix); pw.print("mSystemDecorRect="); mSystemDecorRect.printShortString(pw);
                    pw.print(" last="); mLastSystemDecorRect.printShortString(pw);
                    if (mWinAnimator.mHasClipRect) {
                        pw.print(" mLastClipRect=");
                        mWinAnimator.mLastClipRect.printShortString(pw);
                    }
                    pw.println();
        }
        if (mEnforceSizeCompat) {
+1 −3
Original line number Diff line number Diff line
@@ -1139,8 +1139,6 @@ class WindowStateAnimator {
                    mShownAlpha *= appTransformation.getAlpha();
                    if (appTransformation.hasClipRect()) {
                        mClipRect.set(appTransformation.getClipRect());
                        // Account for non-fullscreen windows
                        mClipRect.offset(frame.left, frame.top);
                        if (mWin.mHScale > 0) {
                            mClipRect.left /= mWin.mHScale;
                            mClipRect.right /= mWin.mHScale;
@@ -1223,7 +1221,7 @@ class WindowStateAnimator {
        }
    }

    void applyDecorRect(final Rect decorRect) {
    private void applyDecorRect(final Rect decorRect) {
        final WindowState w = mWin;
        final int width = w.mFrame.width();
        final int height = w.mFrame.height();