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

Commit 24fbabf9 authored by Chris Li's avatar Chris Li
Browse files

Update WM Extensions aar for animation background color

Store 0 in a named constant as the default animation background color.
Update the animation background color usage to make sure it is not
transparent.

Bug: 267955776
Test: verify the behavior is not changed with demo app
Change-Id: I23fcab10a516de2c7646639e5773cf8c67143bcb
parent 7f04fad0
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -33,6 +33,13 @@ public final class TaskFragmentAnimationParams implements Parcelable {
    public static final TaskFragmentAnimationParams DEFAULT =
            new TaskFragmentAnimationParams.Builder().build();

    /**
     * The default value for animation background color, which means to use the theme window
     * background color.
     */
    @ColorInt
    public static final int DEFAULT_ANIMATION_BACKGROUND_COLOR = 0;

    @ColorInt
    private final int mAnimationBackgroundColor;

@@ -104,12 +111,13 @@ public final class TaskFragmentAnimationParams implements Parcelable {
    public static final class Builder {

        @ColorInt
        private int mAnimationBackgroundColor = 0;
        private int mAnimationBackgroundColor = DEFAULT_ANIMATION_BACKGROUND_COLOR;

        /**
         * Sets the {@link ColorInt} to use for the background during the animation with this
         * TaskFragment if the animation requires a background. The default value is
         * {@code 0}, which is to use the theme window background.
         * {@link #DEFAULT_ANIMATION_BACKGROUND_COLOR}, which is to use the theme window background
         * color.
         *
         * @param color a packed color int, {@code AARRGGBB}, for the animation background color.
         * @return this {@link Builder}.
+6 −4
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import static android.view.WindowManager.TRANSIT_TO_FRONT;
import static android.view.WindowManager.TransitionFlags;
import static android.view.WindowManager.TransitionType;
import static android.view.WindowManager.transitTypeToString;
import static android.window.TaskFragmentAnimationParams.DEFAULT_ANIMATION_BACKGROUND_COLOR;
import static android.window.TransitionInfo.FLAG_DISPLAY_HAS_ALERT_WINDOWS;
import static android.window.TransitionInfo.FLAG_FILLS_TASK;
import static android.window.TransitionInfo.FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY;
@@ -1850,7 +1851,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
                        ? activityRecord.getOrganizedTaskFragment()
                        : taskFragment.getOrganizedTaskFragment();
                if (organizedTf != null && organizedTf.getAnimationParams()
                        .getAnimationBackgroundColor() != 0) {
                        .getAnimationBackgroundColor() != DEFAULT_ANIMATION_BACKGROUND_COLOR) {
                    // This window is embedded and has an animation background color set on the
                    // TaskFragment. Pass this color with this window, so the handler can use it as
                    // the animation background color if needed,
@@ -1862,10 +1863,11 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
                    final Task parentTask = activityRecord != null
                            ? activityRecord.getTask()
                            : taskFragment.getTask();
                    backgroundColor = ColorUtils.setAlphaComponent(
                            parentTask.getTaskDescription().getBackgroundColor(), 255);
                    backgroundColor = parentTask.getTaskDescription().getBackgroundColor();
                }
                change.setBackgroundColor(backgroundColor);
                // Set to opaque for animation background to prevent it from exposing the blank
                // background or content below.
                change.setBackgroundColor(ColorUtils.setAlphaComponent(backgroundColor, 255));
            }

            change.setRotation(info.mRotation, endRotation);
+8 −4
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import static android.os.UserHandle.USER_NULL;
import static android.view.SurfaceControl.Transaction;
import static android.view.WindowManager.LayoutParams.INVALID_WINDOW_TYPE;
import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.window.TaskFragmentAnimationParams.DEFAULT_ANIMATION_BACKGROUND_COLOR;

import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_ANIM;
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_APP_TRANSITIONS;
@@ -3217,7 +3218,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
                            ? activityRecord.getOrganizedTaskFragment()
                            : taskFragment.getOrganizedTaskFragment();
                    if (organizedTf != null && organizedTf.getAnimationParams()
                            .getAnimationBackgroundColor() != 0) {
                            .getAnimationBackgroundColor() != DEFAULT_ANIMATION_BACKGROUND_COLOR) {
                        // This window is embedded and has an animation background color set on the
                        // TaskFragment. Pass this color with this window, so the handler can use it
                        // as the animation background color if needed,
@@ -3230,11 +3231,14 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
                        final Task parentTask = activityRecord != null
                                ? activityRecord.getTask()
                                : taskFragment.getTask();
                        backgroundColorForTransition = ColorUtils.setAlphaComponent(
                                parentTask.getTaskDescription().getBackgroundColor(), 255);
                        backgroundColorForTransition = parentTask.getTaskDescription()
                                .getBackgroundColor();
                    }
                }
                animationRunnerBuilder.setTaskBackgroundColor(backgroundColorForTransition);
                // Set to opaque for animation background to prevent it from exposing the blank
                // background or content below.
                animationRunnerBuilder.setTaskBackgroundColor(ColorUtils.setAlphaComponent(
                        backgroundColorForTransition, 255));
            }

            animationRunnerBuilder.build()