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

Commit 0a1523de authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Fix issue with translucent animations

If a translucent has overridden their activityOpenEnter/exit
animation in the resources, they won't be used anymore because the
system always forces the translucent animations, which is a bug.

Instead, we only use the translucent animation in case the app has
not overridden their animations manually.

Test: Open WhatsApp profile picture.
Test: go/wm-smoke
Change-Id: I7e81815e78453392773ac2ac96c47540e6146381
Fixes: 78270476
parent f12a2130
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1623,6 +1623,8 @@
  <java-symbol type="anim" name="task_open_enter_cross_profile_apps" />
  <java-symbol type="anim" name="activity_translucent_open_enter" />
  <java-symbol type="anim" name="activity_translucent_close_exit" />
  <java-symbol type="anim" name="activity_open_enter" />
  <java-symbol type="anim" name="activity_close_exit" />

  <java-symbol type="array" name="config_autoRotationTiltTolerance" />
  <java-symbol type="array" name="config_keyboardTapVibePattern" />
+15 −16
Original line number Diff line number Diff line
@@ -554,7 +554,7 @@ public class AppTransition implements Dump {
        return null;
    }

    Animation loadAnimationAttr(LayoutParams lp, int animAttr) {
    Animation loadAnimationAttr(LayoutParams lp, int animAttr, int transit) {
        int anim = 0;
        Context context = mContext;
        if (animAttr >= 0) {
@@ -564,6 +564,7 @@ public class AppTransition implements Dump {
                anim = ent.array.getResourceId(animAttr, 0);
            }
        }
        anim = updateToTranslucentAnimIfNeeded(anim, transit);
        if (anim != 0) {
            return AnimationUtils.loadAnimation(context, anim);
        }
@@ -598,6 +599,16 @@ public class AppTransition implements Dump {
        return null;
    }

    private int updateToTranslucentAnimIfNeeded(int anim, int transit) {
        if (transit == TRANSIT_TRANSLUCENT_ACTIVITY_OPEN && anim == R.anim.activity_open_enter) {
            return R.anim.activity_translucent_open_enter;
        }
        if (transit == TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE && anim == R.anim.activity_close_exit) {
            return R.anim.activity_translucent_close_exit;
        }
        return anim;
    }

    /**
     * Compute the pivot point for an animation that is scaling from a small
     * rect on screen to a larger rect.  The pivot point varies depending on
@@ -1664,29 +1675,17 @@ public class AppTransition implements Dump {
                    "applyAnimation NEXT_TRANSIT_TYPE_OPEN_CROSS_PROFILE_APPS:"
                            + " anim=" + a + " transit=" + appTransitionToString(transit)
                            + " isEntrance=true" + " Callers=" + Debug.getCallers(3));
        } else if (transit == TRANSIT_TRANSLUCENT_ACTIVITY_OPEN && enter) {
            a = loadAnimationRes("android",
                    com.android.internal.R.anim.activity_translucent_open_enter);
            Slog.v(TAG,
                    "applyAnimation TRANSIT_TRANSLUCENT_ACTIVITY_OPEN:"
                            + " anim=" + a + " transit=" + appTransitionToString(transit)
                            + " isEntrance=true" + " Callers=" + Debug.getCallers(3));
        } else if (transit == TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE && !enter) {
            a = loadAnimationRes("android",
                    com.android.internal.R.anim.activity_translucent_close_exit);
            Slog.v(TAG,
                    "applyAnimation TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE:"
                            + " anim=" + a + " transit=" + appTransitionToString(transit)
                            + " isEntrance=false" + " Callers=" + Debug.getCallers(3));
        } else {
            int animAttr = 0;
            switch (transit) {
                case TRANSIT_ACTIVITY_OPEN:
                case TRANSIT_TRANSLUCENT_ACTIVITY_OPEN:
                    animAttr = enter
                            ? WindowAnimation_activityOpenEnterAnimation
                            : WindowAnimation_activityOpenExitAnimation;
                    break;
                case TRANSIT_ACTIVITY_CLOSE:
                case TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE:
                    animAttr = enter
                            ? WindowAnimation_activityCloseEnterAnimation
                            : WindowAnimation_activityCloseExitAnimation;
@@ -1737,7 +1736,7 @@ public class AppTransition implements Dump {
                            ? WindowAnimation_launchTaskBehindSourceAnimation
                            : WindowAnimation_launchTaskBehindTargetAnimation;
            }
            a = animAttr != 0 ? loadAnimationAttr(lp, animAttr) : null;
            a = animAttr != 0 ? loadAnimationAttr(lp, animAttr, transit) : null;
            if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) Slog.v(TAG,
                    "applyAnimation:"
                    + " anim=" + a
+2 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_IS_ROUNDED_CO
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
import static android.view.WindowManager.TRANSIT_NONE;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
import static com.android.server.wm.DragResizeMode.DRAG_RESIZE_MODE_FREEFORM;
@@ -1360,7 +1361,7 @@ class WindowStateAnimator {
                        break;
                }
                if (attr >= 0) {
                    a = mService.mAppTransition.loadAnimationAttr(mWin.mAttrs, attr);
                    a = mService.mAppTransition.loadAnimationAttr(mWin.mAttrs, attr, TRANSIT_NONE);
                }
            }
            if (DEBUG_ANIM) Slog.v(TAG,