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

Commit ab4a1706 authored by Pablo Gamito's avatar Pablo Gamito Committed by Android (Google) Code Review
Browse files

Merge changes from topic "showBackground-api"

* changes:
  Support backgrounds during animations in shell
  Add API to show background behind animating windows
parents 3c71e8fe 157738c8
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1314,6 +1314,7 @@ package android {
    field public static final int shouldDisableView = 16843246; // 0x10101ee
    field public static final int shouldUseDefaultUnfoldTransition = 16844364; // 0x101064c
    field public static final int showAsAction = 16843481; // 0x10102d9
    field public static final int showBackground;
    field public static final int showClockAndComplications;
    field public static final int showDefault = 16843258; // 0x10101fa
    field public static final int showDividers = 16843561; // 0x1010329
@@ -52508,6 +52509,7 @@ package android.view.animation {
    method public int getRepeatCount();
    method public int getRepeatMode();
    method protected float getScaleFactor();
    method public boolean getShowBackground();
    method public long getStartOffset();
    method public long getStartTime();
    method public boolean getTransformation(long, android.view.animation.Transformation);
@@ -52533,6 +52535,7 @@ package android.view.animation {
    method public void setInterpolator(android.view.animation.Interpolator);
    method public void setRepeatCount(int);
    method public void setRepeatMode(int);
    method public void setShowBackground(boolean);
    method public void setStartOffset(long);
    method public void setStartTime(long);
    method public void setZAdjustment(int);
+45 −0
Original line number Diff line number Diff line
@@ -209,6 +209,13 @@ public abstract class Animation implements Cloneable {
    private boolean mShowWallpaper;
    private boolean mHasRoundedCorners;

    /**
     * Whether to show a background behind the windows during the animation.
     * @see #getShowBackground()
     * @see #setShowBackground(boolean)
     */
    private boolean mShowBackground;

    private boolean mMore = true;
    private boolean mOneMoreTime = true;

@@ -266,6 +273,8 @@ public abstract class Animation implements Cloneable {
                a.getBoolean(com.android.internal.R.styleable.Animation_showWallpaper, false));
        setHasRoundedCorners(
                a.getBoolean(com.android.internal.R.styleable.Animation_hasRoundedCorners, false));
        setShowBackground(
                a.getBoolean(com.android.internal.R.styleable.Animation_showBackground, false));

        final int resID = a.getResourceId(com.android.internal.R.styleable.Animation_interpolator, 0);

@@ -697,6 +706,24 @@ public abstract class Animation implements Cloneable {
        mHasRoundedCorners = hasRoundedCorners;
    }

    /**
     * If showBackground is {@code true} and this animation is applied on a window, then the windows
     * in the animation will animate with the background associated with this window behind them.
     *
     * The background comes from the {@link android.R.styleable#Theme_colorBackground} that is
     * applied to this window through its theme.
     *
     * If multiple animating windows have showBackground set to {@code true} during an animation,
     * the top most window with showBackground set to {@code true} and a valid background color
     * takes precedence.
     *
     * @param showBackground Whether to show a background behind the windows during the animation.
     * @attr ref android.R.styleable#Animation_showBackground
     */
    public void setShowBackground(boolean showBackground) {
        mShowBackground = showBackground;
    }

    /**
     * Gets the acceleration curve type for this animation.
     *
@@ -837,6 +864,24 @@ public abstract class Animation implements Cloneable {
        return mHasRoundedCorners;
    }

    /**
     * If showBackground is {@code true} and this animation is applied on a window, then the windows
     * in the animation will animate with the background associated with this window behind them.
     *
     * The background comes from the {@link android.R.styleable#Theme_colorBackground} that is
     * applied to this window through its theme.
     *
     * If multiple animating windows have showBackground set to {@code true} during an animation,
     * the top most window with showBackground set to {@code true} and a valid background color
     * takes precedence.
     *
     * @return if the background of this window should be shown behind the animating windows.
     * @attr ref android.R.styleable#Animation_showBackground
     */
    public boolean getShowBackground() {
        return mShowBackground;
    }

    /**
     * <p>Indicates whether or not this animation will affect the transformation
     * matrix. For instance, a fade animation will not affect the matrix whereas
+15 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import static android.view.WindowManager.TransitionFlags;
import static android.view.WindowManager.TransitionType;
import static android.view.WindowManager.transitTypeToString;

import android.annotation.ColorInt;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -366,6 +367,7 @@ public final class TransitionInfo implements Parcelable {
        private int mStartRotation = ROTATION_UNDEFINED;
        private int mEndRotation = ROTATION_UNDEFINED;
        private int mRotationAnimation = ROTATION_ANIMATION_UNSPECIFIED;
        private @ColorInt int mBackgroundColor;

        public Change(@Nullable WindowContainerToken container, @NonNull SurfaceControl leash) {
            mContainer = container;
@@ -387,6 +389,7 @@ public final class TransitionInfo implements Parcelable {
            mStartRotation = in.readInt();
            mEndRotation = in.readInt();
            mRotationAnimation = in.readInt();
            mBackgroundColor = in.readInt();
        }

        /** Sets the parent of this change's container. The parent must be a participant or null. */
@@ -446,6 +449,11 @@ public final class TransitionInfo implements Parcelable {
            mRotationAnimation = anim;
        }

        /** Sets the background color of this change's container. */
        public void setBackgroundColor(@ColorInt int backgroundColor) {
            mBackgroundColor = backgroundColor;
        }

        /** @return the container that is changing. May be null if non-remotable (eg. activity) */
        @Nullable
        public WindowContainerToken getContainer() {
@@ -526,6 +534,12 @@ public final class TransitionInfo implements Parcelable {
            return mRotationAnimation;
        }

        /** @return get the background color of this change's container. */
        @ColorInt
        public int getBackgroundColor() {
            return mBackgroundColor;
        }

        /** @hide */
        @Override
        public void writeToParcel(@NonNull Parcel dest, int flags) {
@@ -542,6 +556,7 @@ public final class TransitionInfo implements Parcelable {
            dest.writeInt(mStartRotation);
            dest.writeInt(mEndRotation);
            dest.writeInt(mRotationAnimation);
            dest.writeInt(mBackgroundColor);
        }

        @NonNull
+3 −0
Original line number Diff line number Diff line
@@ -6884,6 +6884,9 @@
        <!-- Special option for window animations: whether window should have rounded corners.
             @see ScreenDecorationsUtils#getWindowCornerRadius(Resources) -->
        <attr name="hasRoundedCorners" format="boolean" />
        <!-- Special option for window animations: whether the window's background should be used as
             a background to the animation. -->
        <attr name="showBackground" format="boolean" />
    </declare-styleable>
    <declare-styleable name="AnimationSet">
+1 −0
Original line number Diff line number Diff line
@@ -3254,6 +3254,7 @@
    <!-- @hide @SystemApi -->
    <public name="gameSessionService" />
    <public name="localeConfig" />
    <public name="showBackground" />
  </staging-public-group>

  <staging-public-group type="id" first-id="0x01de0000">
Loading