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

Commit 3bc1119f authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Restrict change mode to apply transition background" into udc-dev am: ad693c12

parents a6a6c191 ad693c12
Loading
Loading
Loading
Loading
+8 −17
Original line number Diff line number Diff line
@@ -37,12 +37,8 @@ import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_ROTATE;
import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS;
import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_UNSPECIFIED;
import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE;
import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_RELAUNCH;
import static android.view.WindowManager.TRANSIT_TO_BACK;
import static android.view.WindowManager.TRANSIT_TO_FRONT;
import static android.window.TransitionInfo.FLAG_BACK_GESTURE_ANIMATED;
import static android.window.TransitionInfo.FLAG_CROSS_PROFILE_OWNER_THUMBNAIL;
import static android.window.TransitionInfo.FLAG_CROSS_PROFILE_WORK_THUMBNAIL;
@@ -93,7 +89,6 @@ import android.view.Choreographer;
import android.view.SurfaceControl;
import android.view.SurfaceSession;
import android.view.WindowManager;
import android.view.WindowManager.TransitionType;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Transformation;
@@ -346,9 +341,10 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
                continue;
            }
            final boolean isTask = change.getTaskInfo() != null;
            final int mode = change.getMode();
            boolean isSeamlessDisplayChange = false;

            if (change.getMode() == TRANSIT_CHANGE && (change.getFlags() & FLAG_IS_DISPLAY) != 0) {
            if (mode == TRANSIT_CHANGE && change.hasFlags(FLAG_IS_DISPLAY)) {
                if (info.getType() == TRANSIT_CHANGE) {
                    final int anim = getRotationAnimationHint(change, info, mDisplayController);
                    isSeamlessDisplayChange = anim == ROTATION_ANIMATION_SEAMLESS;
@@ -364,7 +360,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
                }
            }

            if (change.getMode() == TRANSIT_CHANGE) {
            if (mode == TRANSIT_CHANGE) {
                // If task is child task, only set position in parent and update crop when needed.
                if (isTask && change.getParent() != null
                        && info.getChange(change.getParent()).getTaskInfo() != null) {
@@ -413,8 +409,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {

            // Hide the invisible surface directly without animating it if there is a display
            // rotation animation playing.
            if (isDisplayRotationAnimationStarted && TransitionUtil.isClosingType(
                    change.getMode())) {
            if (isDisplayRotationAnimationStarted && TransitionUtil.isClosingType(mode)) {
                startTransaction.hide(change.getLeash());
                continue;
            }
@@ -430,13 +425,9 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
            Animation a = loadAnimation(info, change, wallpaperTransit, isDreamTransition);
            if (a != null) {
                if (isTask) {
                    final @TransitionType int type = info.getType();
                    final boolean isOpenOrCloseTransition = type == TRANSIT_OPEN
                            || type == TRANSIT_CLOSE
                            || type == TRANSIT_TO_FRONT
                            || type == TRANSIT_TO_BACK;
                    final boolean isTranslucent = (change.getFlags() & FLAG_TRANSLUCENT) != 0;
                    if (isOpenOrCloseTransition && !isTranslucent
                    if (!isTranslucent && TransitionUtil.isOpenOrCloseMode(mode)
                            && TransitionUtil.isOpenOrCloseMode(info.getType())
                            && wallpaperTransit == WALLPAPER_TRANSITION_NONE) {
                        // Use the overview background as the background for the animation
                        final Context uiContext = ActivityThread.currentActivityThread()
@@ -461,7 +452,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
                        backgroundColorForTransition);

                if (!isTask && a.hasExtension()) {
                    if (!TransitionUtil.isOpeningType(change.getMode())) {
                    if (!TransitionUtil.isOpeningType(mode)) {
                        // Can screenshot now (before startTransaction is applied)
                        edgeExtendWindow(change, a, startTransaction, finishTransaction);
                    } else {
@@ -472,7 +463,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
                    }
                }

                final Rect clipRect = TransitionUtil.isClosingType(change.getMode())
                final Rect clipRect = TransitionUtil.isClosingType(mode)
                        ? new Rect(mRotator.getEndBoundsInStartRotation(change))
                        : new Rect(change.getEndAbsBounds());
                clipRect.offsetTo(0, 0);
+6 −0
Original line number Diff line number Diff line
@@ -68,6 +68,12 @@ public class TransitionUtil {
        return type == TRANSIT_CLOSE || type == TRANSIT_TO_BACK;
    }

    /** Returns {@code true} if the transition is opening or closing mode. */
    public static boolean isOpenOrCloseMode(@TransitionInfo.TransitionMode int mode) {
        return mode == TRANSIT_OPEN || mode == TRANSIT_CLOSE
                || mode == TRANSIT_TO_FRONT || mode == TRANSIT_TO_BACK;
    }

    /** Returns {@code true} if the transition has a display change. */
    public static boolean hasDisplayChange(@NonNull TransitionInfo info) {
        for (int i = info.getChanges().size() - 1; i >= 0; --i) {