Add Extensions API for animation params for SplitAttributes.

Also deprecate animation background from SplitAttributes in favor of
having animation background as a part of animation params.

Bug: 293658614
Test: SplitAttributesTest
RelNote: "
Allow extensions to take animation params for SplitAttributes so that the device can use it for animation transitions.
"

Change-Id: Iede006641fa40fe036cb1eb3c2a858a194b80f05
diff --git a/window/extensions/extensions/api/current.txt b/window/extensions/extensions/api/current.txt
index 5c85171..23159f4a 100644
--- a/window/extensions/extensions/api/current.txt
+++ b/window/extensions/extensions/api/current.txt
@@ -139,6 +139,23 @@
     method @ColorInt public int getColor();
   }
 
+  public final class AnimationParams {
+    method public androidx.window.extensions.embedding.AnimationBackground getAnimationBackground();
+    method @AnimRes public int getChangeAnimationResId();
+    method @AnimRes public int getCloseAnimationResId();
+    method @AnimRes public int getOpenAnimationResId();
+    field @AnimRes public static final int DEFAULT_ANIMATION_RESOURCES_ID = -1; // 0xffffffff
+  }
+
+  public static final class AnimationParams.Builder {
+    ctor public AnimationParams.Builder();
+    method public androidx.window.extensions.embedding.AnimationParams build();
+    method public androidx.window.extensions.embedding.AnimationParams.Builder setAnimationBackground(androidx.window.extensions.embedding.AnimationBackground);
+    method public androidx.window.extensions.embedding.AnimationParams.Builder setChangeAnimationResId(@AnimRes int);
+    method public androidx.window.extensions.embedding.AnimationParams.Builder setCloseAnimationResId(@AnimRes int);
+    method public androidx.window.extensions.embedding.AnimationParams.Builder setOpenAnimationResId(@AnimRes int);
+  }
+
   public final class DividerAttributes {
     method @ColorInt public int getDividerColor();
     method public int getDividerType();
@@ -181,7 +198,8 @@
   }
 
   public class SplitAttributes {
-    method public androidx.window.extensions.embedding.AnimationBackground getAnimationBackground();
+    method @Deprecated public androidx.window.extensions.embedding.AnimationBackground getAnimationBackground();
+    method public androidx.window.extensions.embedding.AnimationParams getAnimationParams();
     method public androidx.window.extensions.embedding.DividerAttributes? getDividerAttributes();
     method public int getLayoutDirection();
     method public androidx.window.extensions.embedding.SplitAttributes.SplitType getSplitType();
@@ -192,7 +210,8 @@
     ctor public SplitAttributes.Builder();
     ctor public SplitAttributes.Builder(androidx.window.extensions.embedding.SplitAttributes);
     method public androidx.window.extensions.embedding.SplitAttributes build();
-    method public androidx.window.extensions.embedding.SplitAttributes.Builder setAnimationBackground(androidx.window.extensions.embedding.AnimationBackground);
+    method @Deprecated public androidx.window.extensions.embedding.SplitAttributes.Builder setAnimationBackground(androidx.window.extensions.embedding.AnimationBackground);
+    method public androidx.window.extensions.embedding.SplitAttributes.Builder setAnimationParams(androidx.window.extensions.embedding.AnimationParams);
     method public androidx.window.extensions.embedding.SplitAttributes.Builder setDividerAttributes(androidx.window.extensions.embedding.DividerAttributes?);
     method public androidx.window.extensions.embedding.SplitAttributes.Builder setLayoutDirection(int);
     method public androidx.window.extensions.embedding.SplitAttributes.Builder setSplitType(androidx.window.extensions.embedding.SplitAttributes.SplitType);
diff --git a/window/extensions/extensions/api/restricted_current.txt b/window/extensions/extensions/api/restricted_current.txt
index 21e8e11..e005796 100644
--- a/window/extensions/extensions/api/restricted_current.txt
+++ b/window/extensions/extensions/api/restricted_current.txt
@@ -140,6 +140,23 @@
     method @ColorInt public int getColor();
   }
 
+  public final class AnimationParams {
+    method public androidx.window.extensions.embedding.AnimationBackground getAnimationBackground();
+    method @AnimRes public int getChangeAnimationResId();
+    method @AnimRes public int getCloseAnimationResId();
+    method @AnimRes public int getOpenAnimationResId();
+    field @AnimRes public static final int DEFAULT_ANIMATION_RESOURCES_ID = -1; // 0xffffffff
+  }
+
+  public static final class AnimationParams.Builder {
+    ctor public AnimationParams.Builder();
+    method public androidx.window.extensions.embedding.AnimationParams build();
+    method public androidx.window.extensions.embedding.AnimationParams.Builder setAnimationBackground(androidx.window.extensions.embedding.AnimationBackground);
+    method public androidx.window.extensions.embedding.AnimationParams.Builder setChangeAnimationResId(@AnimRes int);
+    method public androidx.window.extensions.embedding.AnimationParams.Builder setCloseAnimationResId(@AnimRes int);
+    method public androidx.window.extensions.embedding.AnimationParams.Builder setOpenAnimationResId(@AnimRes int);
+  }
+
   public final class DividerAttributes {
     method @ColorInt public int getDividerColor();
     method public int getDividerType();
@@ -182,7 +199,8 @@
   }
 
   public class SplitAttributes {
-    method public androidx.window.extensions.embedding.AnimationBackground getAnimationBackground();
+    method @Deprecated public androidx.window.extensions.embedding.AnimationBackground getAnimationBackground();
+    method public androidx.window.extensions.embedding.AnimationParams getAnimationParams();
     method public androidx.window.extensions.embedding.DividerAttributes? getDividerAttributes();
     method public int getLayoutDirection();
     method public androidx.window.extensions.embedding.SplitAttributes.SplitType getSplitType();
@@ -193,7 +211,8 @@
     ctor public SplitAttributes.Builder();
     ctor public SplitAttributes.Builder(androidx.window.extensions.embedding.SplitAttributes);
     method public androidx.window.extensions.embedding.SplitAttributes build();
-    method public androidx.window.extensions.embedding.SplitAttributes.Builder setAnimationBackground(androidx.window.extensions.embedding.AnimationBackground);
+    method @Deprecated public androidx.window.extensions.embedding.SplitAttributes.Builder setAnimationBackground(androidx.window.extensions.embedding.AnimationBackground);
+    method public androidx.window.extensions.embedding.SplitAttributes.Builder setAnimationParams(androidx.window.extensions.embedding.AnimationParams);
     method public androidx.window.extensions.embedding.SplitAttributes.Builder setDividerAttributes(androidx.window.extensions.embedding.DividerAttributes?);
     method public androidx.window.extensions.embedding.SplitAttributes.Builder setLayoutDirection(int);
     method public androidx.window.extensions.embedding.SplitAttributes.Builder setSplitType(androidx.window.extensions.embedding.SplitAttributes.SplitType);
diff --git a/window/extensions/extensions/src/main/java/androidx/window/extensions/embedding/AnimationParams.java b/window/extensions/extensions/src/main/java/androidx/window/extensions/embedding/AnimationParams.java
new file mode 100644
index 0000000..53aedbb
--- /dev/null
+++ b/window/extensions/extensions/src/main/java/androidx/window/extensions/embedding/AnimationParams.java
@@ -0,0 +1,249 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.window.extensions.embedding;
+
+import android.content.res.Resources;
+
+import androidx.annotation.AnimRes;
+import androidx.annotation.NonNull;
+import androidx.window.extensions.RequiresVendorApiLevel;
+
+import java.util.Objects;
+
+/**
+ * A class to represent the animation parameters to use while animating embedding activity
+ * containers.
+ *
+ * @see SplitAttributes.Builder#setAnimationParams
+ */
+public final class AnimationParams {
+
+    /**
+     * The default value for animation resources ID, which means to use the system default
+     * animation.
+     */
+    @RequiresVendorApiLevel(level = 7)
+    @SuppressWarnings("ResourceType") // Use as a hint to use the system default animation.
+    @AnimRes
+    public static final int DEFAULT_ANIMATION_RESOURCES_ID = 0xFFFFFFFF;
+
+    @NonNull
+    private final AnimationBackground mAnimationBackground;
+
+    @AnimRes
+    private final int mOpenAnimationResId;
+
+    @AnimRes
+    private final int mCloseAnimationResId;
+
+    @AnimRes
+    private final int mChangeAnimationResId;
+
+    /**
+     * Creates an instance of this {@code AnimationParams}.
+     *
+     * @param animationBackground   The {@link AnimationBackground} to use for the animation
+     *                              involving this {@code AnimationParams} object.
+     * @param openAnimationResId    The animation resources ID from the "android" package to use for
+     *                              open transitions.
+     * @param closeAnimationResId   The animation resources ID from the "android" package to use for
+     *                              close transitions.
+     * @param changeAnimationResId  The animation resources ID from the "android" package to use for
+     *                              change (resize or move) transitions.
+     */
+    private AnimationParams(@NonNull AnimationBackground animationBackground,
+            @AnimRes int openAnimationResId, @AnimRes int closeAnimationResId,
+            @AnimRes int changeAnimationResId) {
+        mAnimationBackground = animationBackground;
+        mOpenAnimationResId = openAnimationResId;
+        mCloseAnimationResId = closeAnimationResId;
+        mChangeAnimationResId = changeAnimationResId;
+    }
+
+    /**
+     * Returns the {@link AnimationBackground} to use for the background during the animation.
+     */
+    @RequiresVendorApiLevel(level = 7)
+    @NonNull
+    public AnimationBackground getAnimationBackground() {
+        return mAnimationBackground;
+    }
+
+    /**
+     * Gets the open animation.
+     *
+     * @return the open animation transition resources ID from the "android" package.
+     */
+    @RequiresVendorApiLevel(level = 7)
+    @AnimRes
+    public int getOpenAnimationResId() {
+        return mOpenAnimationResId;
+    }
+
+    /**
+     * Gets the close animation.
+     *
+     * @return the close animation transition resources ID from the "android" package.
+     */
+    @RequiresVendorApiLevel(level = 7)
+    @AnimRes
+    public int getCloseAnimationResId() {
+        return mCloseAnimationResId;
+    }
+
+    /**
+     * Gets the change (resize or move) animation.
+     *
+     * @return the change (resize or move) animation transition resources ID from the "android"
+     * package.
+     */
+    @RequiresVendorApiLevel(level = 7)
+    @AnimRes
+    public int getChangeAnimationResId() {
+        return mChangeAnimationResId;
+    }
+
+    /**
+     * Builder for creating an instance of {@link AnimationParams}.
+     *
+     * - The default animation background is to use the current theme window background color.
+     * - The default animation resources ID's for transitions is the system default.
+     */
+    public static final class Builder {
+        @NonNull
+        private AnimationBackground mAnimationBackground =
+                AnimationBackground.ANIMATION_BACKGROUND_DEFAULT;
+
+        @AnimRes
+        private int mOpenAnimationResId = DEFAULT_ANIMATION_RESOURCES_ID;
+
+        @AnimRes
+        private int mCloseAnimationResId = DEFAULT_ANIMATION_RESOURCES_ID;
+
+        @AnimRes
+        private int mChangeAnimationResId = DEFAULT_ANIMATION_RESOURCES_ID;
+
+        /** Creates a new {@link AnimationParams.Builder} to create {@link AnimationParams}. */
+        @RequiresVendorApiLevel(level = 7)
+        public Builder() {
+        }
+
+        /**
+         * Sets the {@link AnimationBackground} to use for the background during the animation.
+         * The default value is {@link AnimationBackground#ANIMATION_BACKGROUND_DEFAULT}, which
+         * means to use the current theme window background color.
+         *
+         * @param background An {@link AnimationBackground} to be used for the animation.
+         * @return this {@code Builder}.
+         */
+        @RequiresVendorApiLevel(level = 7)
+        @NonNull
+        public AnimationParams.Builder setAnimationBackground(
+                @NonNull AnimationBackground background) {
+            mAnimationBackground = background;
+            return this;
+        }
+
+        /**
+         * Sets the open animation.
+         * Use {@link #DEFAULT_ANIMATION_RESOURCES_ID} for the system default animation.
+         * Use {@code 0} or {@link Resources#ID_NULL} for no animation.
+         *
+         * @param resId The resources ID to set from the "android" package.
+         * @return this {@code Builder}.
+         */
+        @RequiresVendorApiLevel(level = 7)
+        @NonNull
+        public AnimationParams.Builder setOpenAnimationResId(@AnimRes int resId) {
+            mOpenAnimationResId = resId;
+            return this;
+        }
+
+        /**
+         * Sets the close animation.
+         * Use {@link #DEFAULT_ANIMATION_RESOURCES_ID} for the system default animation.
+         * Use {@code 0} or {@link Resources#ID_NULL} for no animation.
+         *
+         * @param resId The resources ID to set from the "android" package.
+         * @return this {@code Builder}.
+         */
+        @RequiresVendorApiLevel(level = 7)
+        @NonNull
+        public AnimationParams.Builder setCloseAnimationResId(@AnimRes int resId) {
+            mCloseAnimationResId = resId;
+            return this;
+        }
+
+        /**
+         * Sets the change (resize or move) animation.
+         * Use {@link #DEFAULT_ANIMATION_RESOURCES_ID} for the system default animation.
+         * Use {@code 0} or {@link Resources#ID_NULL} for no animation.
+         *
+         * @param resId The resources ID to set from the "android" package.
+         * @return this {@code Builder}.
+         */
+        @RequiresVendorApiLevel(level = 7)
+        @NonNull
+        public AnimationParams.Builder setChangeAnimationResId(@AnimRes int resId) {
+            mChangeAnimationResId = resId;
+            return this;
+        }
+
+        /**
+         * Builds a {@link AnimationParams} instance with the attributes
+         * specified by {@link #setAnimationBackground(AnimationBackground)},
+         * {@link #setOpenAnimationResId(int)}, {@link #setCloseAnimationResId(int)},
+         * and {@link #setChangeAnimationResId(int)}.
+         *
+         * @return the new {@code AnimationParams} instance.
+         */
+        @RequiresVendorApiLevel(level = 7)
+        @NonNull
+        public AnimationParams build() {
+            return new AnimationParams(mAnimationBackground, mOpenAnimationResId,
+                    mCloseAnimationResId, mChangeAnimationResId);
+        }
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof AnimationParams)) return false;
+        AnimationParams that = (AnimationParams) o;
+        return mAnimationBackground.equals(that.mAnimationBackground)
+                && mOpenAnimationResId == that.mOpenAnimationResId
+                && mCloseAnimationResId == that.mCloseAnimationResId
+                && mChangeAnimationResId == that.mChangeAnimationResId;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(mAnimationBackground, mOpenAnimationResId, mCloseAnimationResId,
+                mChangeAnimationResId);
+    }
+
+    @NonNull
+    @Override
+    public String toString() {
+        return AnimationParams.class.getSimpleName() + "{"
+                + "animationBackground=" + mAnimationBackground
+                + ", openAnimation=" + mOpenAnimationResId
+                + ", closeAnimation=" + mCloseAnimationResId
+                + ", changeAnimation=" + mChangeAnimationResId
+                + "}";
+    }
+}
diff --git a/window/extensions/extensions/src/main/java/androidx/window/extensions/embedding/SplitAttributes.java b/window/extensions/extensions/src/main/java/androidx/window/extensions/embedding/SplitAttributes.java
index 2c1464c..6d43da8 100644
--- a/window/extensions/extensions/src/main/java/androidx/window/extensions/embedding/SplitAttributes.java
+++ b/window/extensions/extensions/src/main/java/androidx/window/extensions/embedding/SplitAttributes.java
@@ -65,7 +65,7 @@
  *
  * @see SplitAttributes.SplitType
  * @see SplitAttributes.LayoutDirection
- * @see AnimationBackground
+ * @see AnimationParams
  */
 @RequiresVendorApiLevel(level = 2)
 public class SplitAttributes {
@@ -378,7 +378,7 @@
     private final SplitType mSplitType;
 
     @NonNull
-    private final AnimationBackground mAnimationBackground;
+    private final AnimationParams mAnimationParams;
 
     @NonNull
     private final WindowAttributes mWindowAttributes;
@@ -395,9 +395,8 @@
      * @param layoutDirection     The layout direction of the split, such as left to
      *                            right or top to bottom. See
      *                            {@link SplitAttributes.LayoutDirection}.
-     * @param animationBackground The {@link AnimationBackground} to use for the during animation
-     *                            of the split involving this {@code SplitAttributes} object if the
-     *                            animation requires a background.
+     * @param animationParams     The {@link AnimationParams} to use for the during animation
+     *                            of the split involving this {@code SplitAttributes} object.
      * @param attributes          The {@link WindowAttributes} of the split, such as dim area
      *                            behavior.
      * @param dividerAttributes   The {@link DividerAttributes}. If {@code null}, no divider is
@@ -406,13 +405,13 @@
     SplitAttributes(
             @NonNull SplitType splitType,
             @ExtLayoutDirection int layoutDirection,
-            @NonNull AnimationBackground animationBackground,
+            @NonNull AnimationParams animationParams,
             @NonNull WindowAttributes attributes,
             @Nullable DividerAttributes dividerAttributes
     ) {
         mSplitType = splitType;
         mLayoutDirection = layoutDirection;
-        mAnimationBackground = animationBackground;
+        mAnimationParams = animationParams;
         mWindowAttributes = attributes;
         mDividerAttributes = dividerAttributes;
     }
@@ -438,13 +437,25 @@
     }
 
     /**
-     * Returns the {@link AnimationBackground} to use for the background during the
-     * animation of the split involving this {@code SplitAttributes} object.
+     * @deprecated Use {@link #getAnimationParams()} starting with vendor API level 7. Only used if
+     * {@link #getAnimationParams()} can't be called on vendor API level 5 and 6.
      */
     @NonNull
-    @RequiresVendorApiLevel(level = 5)
+    @RequiresVendorApiLevel(level = 5, deprecatedSince = 7)
+    @Deprecated
+    @SuppressWarnings("Deprecation")
     public AnimationBackground getAnimationBackground() {
-        return mAnimationBackground;
+        return mAnimationParams.getAnimationBackground();
+    }
+
+    /**
+     * Returns the {@link AnimationParams} to use during the animation of the split involving
+     * this {@code SplitAttributes} object.
+     */
+    @NonNull
+    @RequiresVendorApiLevel(level = 7)
+    public AnimationParams getAnimationParams() {
+        return mAnimationParams;
     }
 
     /**
@@ -478,8 +489,7 @@
         private int mLayoutDirection = LOCALE;
 
         @NonNull
-        private AnimationBackground mAnimationBackground =
-                AnimationBackground.ANIMATION_BACKGROUND_DEFAULT;
+        private AnimationParams mAnimationParams = new AnimationParams.Builder().build();
 
         @NonNull
         private WindowAttributes mWindowAttributes =
@@ -501,7 +511,7 @@
         public Builder(@NonNull SplitAttributes original) {
             mSplitType = original.mSplitType;
             mLayoutDirection = original.mLayoutDirection;
-            mAnimationBackground = original.mAnimationBackground;
+            mAnimationParams = original.mAnimationParams;
             mWindowAttributes = original.mWindowAttributes;
             mDividerAttributes = original.mDividerAttributes;
         }
@@ -546,21 +556,31 @@
         }
 
         /**
-         * Sets the {@link AnimationBackground} to use for the background during the
-         * animation of the split involving this {@code SplitAttributes} object
-         * if the animation requires a background.
+         * @deprecated Use {@link #setAnimationParams(AnimationParams)} starting with vendor API
+         * level 7. Only used if {@link #setAnimationParams(AnimationParams)} can't be called on
+         * vendor API level 5 and 6.
+         */
+        @NonNull
+        @RequiresVendorApiLevel(level = 5, deprecatedSince = 7)
+        @Deprecated
+        @SuppressWarnings("Deprecation")
+        public Builder setAnimationBackground(@NonNull AnimationBackground background) {
+            mAnimationParams =
+                    new AnimationParams.Builder().setAnimationBackground(background).build();
+            return this;
+        }
+
+        /**
+         * Sets the {@link AnimationParams} to use during the animation of the split involving this
+         * {@code SplitAttributes} object.
          *
-         * The default value is {@link AnimationBackground#ANIMATION_BACKGROUND_DEFAULT}, which
-         * means to use the current theme window background color.
-         *
-         * @param background An {@link AnimationBackground} to be used for the animation of the
-         *                   split.
+         * @param params The {@link AnimationParams} to be used for the animation of the split.
          * @return This {@code Builder}.
          */
         @NonNull
-        @RequiresVendorApiLevel(level = 5)
-        public Builder setAnimationBackground(@NonNull AnimationBackground background) {
-            mAnimationBackground = background;
+        @RequiresVendorApiLevel(level = 7)
+        public Builder setAnimationParams(@NonNull AnimationParams params) {
+            mAnimationParams = params;
             return this;
         }
 
@@ -590,13 +610,13 @@
         /**
          * Builds a {@link SplitAttributes} instance with the attributes
          * specified by {@link #setSplitType}, {@link #setLayoutDirection}, and
-         * {@link #setAnimationBackground}.
+         * {@link #setAnimationParams}.
          *
          * @return The new {@code SplitAttributes} instance.
          */
         @NonNull
         public SplitAttributes build() {
-            return new SplitAttributes(mSplitType, mLayoutDirection, mAnimationBackground,
+            return new SplitAttributes(mSplitType, mLayoutDirection, mAnimationParams,
                     mWindowAttributes, mDividerAttributes);
         }
     }
@@ -607,14 +627,14 @@
         if (!(o instanceof SplitAttributes)) return false;
         SplitAttributes that = (SplitAttributes) o;
         return mLayoutDirection == that.mLayoutDirection && mSplitType.equals(that.mSplitType)
-                && mAnimationBackground.equals(that.mAnimationBackground)
+                && Objects.equals(mAnimationParams, that.mAnimationParams)
                 && mWindowAttributes.equals(that.mWindowAttributes)
                 && Objects.equals(mDividerAttributes, that.mDividerAttributes);
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(mLayoutDirection, mSplitType, mAnimationBackground, mWindowAttributes,
+        return Objects.hash(mLayoutDirection, mSplitType, mAnimationParams, mWindowAttributes,
                 mDividerAttributes);
     }
 
@@ -624,7 +644,7 @@
         return SplitAttributes.class.getSimpleName() + "{"
                 + "layoutDir=" + layoutDirectionToString()
                 + ", splitType=" + mSplitType
-                + ", animationBackground=" + mAnimationBackground
+                + ", animationParams=" + mAnimationParams
                 + ", windowAttributes=" + mWindowAttributes
                 + ", dividerAttributes=" + mDividerAttributes
                 + "}";
diff --git a/window/extensions/extensions/src/test/java/androidx/window/extensions/embedding/SplitAttributesTest.java b/window/extensions/extensions/src/test/java/androidx/window/extensions/embedding/SplitAttributesTest.java
index f6d34fa..7bffb2b 100644
--- a/window/extensions/extensions/src/test/java/androidx/window/extensions/embedding/SplitAttributesTest.java
+++ b/window/extensions/extensions/src/test/java/androidx/window/extensions/embedding/SplitAttributesTest.java
@@ -36,30 +36,51 @@
 public class SplitAttributesTest {
     @Test
     public void testSplitAttributesEquals() {
+        final AnimationParams animParams1 =
+                new AnimationParams.Builder()
+                        .setAnimationBackground(AnimationBackground.ANIMATION_BACKGROUND_DEFAULT)
+                        .setOpenAnimationResId(AnimationParams.DEFAULT_ANIMATION_RESOURCES_ID)
+                        .build();
         final SplitAttributes attrs1 = new SplitAttributes.Builder()
                 .setSplitType(splitEqually())
                 .setLayoutDirection(LayoutDirection.LOCALE)
-                .setAnimationBackground(AnimationBackground.ANIMATION_BACKGROUND_DEFAULT)
+                .setAnimationParams(animParams1)
                 .build();
+        final AnimationParams animParams2 =
+                new AnimationParams.Builder()
+                        .setAnimationBackground(AnimationBackground.ANIMATION_BACKGROUND_DEFAULT)
+                        .setOpenAnimationResId(AnimationParams.DEFAULT_ANIMATION_RESOURCES_ID)
+                        .build();
         final SplitAttributes attrs2 = new SplitAttributes.Builder()
                 .setSplitType(new SplitAttributes.SplitType.HingeSplitType(splitEqually()))
                 .setLayoutDirection(LayoutDirection.LOCALE)
-                .setAnimationBackground(AnimationBackground.ANIMATION_BACKGROUND_DEFAULT)
+                .setAnimationParams(animParams2)
                 .build();
+        final AnimationParams animParams3 =
+                new AnimationParams.Builder()
+                        .setAnimationBackground(AnimationBackground.ANIMATION_BACKGROUND_DEFAULT)
+                        .setOpenAnimationResId(AnimationParams.DEFAULT_ANIMATION_RESOURCES_ID)
+                        .build();
         final SplitAttributes attrs3 = new SplitAttributes.Builder()
                 .setSplitType(new SplitAttributes.SplitType.HingeSplitType(splitEqually()))
                 .setLayoutDirection(LayoutDirection.TOP_TO_BOTTOM)
-                .setAnimationBackground(AnimationBackground.ANIMATION_BACKGROUND_DEFAULT)
+                .setAnimationParams(animParams3)
                 .build();
+        final AnimationParams animParams4and5 =
+                new AnimationParams.Builder()
+                        .setAnimationBackground(
+                                AnimationBackground.createColorBackground(Color.BLUE))
+                        .setOpenAnimationResId(android.R.anim.fade_in)
+                        .build();
         final SplitAttributes attrs4 = new SplitAttributes.Builder()
                 .setSplitType(new SplitAttributes.SplitType.HingeSplitType(splitEqually()))
                 .setLayoutDirection(LayoutDirection.TOP_TO_BOTTOM)
-                .setAnimationBackground(AnimationBackground.createColorBackground(Color.BLUE))
+                .setAnimationParams(animParams4and5)
                 .build();
         final SplitAttributes attrs5 = new SplitAttributes.Builder()
                 .setSplitType(new SplitAttributes.SplitType.HingeSplitType(splitEqually()))
                 .setLayoutDirection(LayoutDirection.TOP_TO_BOTTOM)
-                .setAnimationBackground(AnimationBackground.createColorBackground(Color.BLUE))
+                .setAnimationParams(animParams4and5)
                 .build();
 
         assertNotEquals(attrs1, attrs2);
@@ -80,10 +101,11 @@
 
     @Test
     public void testSplitAttributesEqualsUsingBuilderFromExistingInstance() {
+        final AnimationParams animParamsDefault = new AnimationParams.Builder().build();
         final SplitAttributes attrs1 = new SplitAttributes.Builder()
                 .setSplitType(splitEqually())
                 .setLayoutDirection(LayoutDirection.LOCALE)
-                .setAnimationBackground(AnimationBackground.ANIMATION_BACKGROUND_DEFAULT)
+                .setAnimationParams(animParamsDefault)
                 .build();
         final SplitAttributes attrs2 = new SplitAttributes.Builder(attrs1).build();
         assertEquals(attrs1, attrs2);
diff --git a/window/window/src/androidTest/java/androidx/window/embedding/EmbeddingAdapterTest.kt b/window/window/src/androidTest/java/androidx/window/embedding/EmbeddingAdapterTest.kt
index 96b4a08..e9d9598 100644
--- a/window/window/src/androidTest/java/androidx/window/embedding/EmbeddingAdapterTest.kt
+++ b/window/window/src/androidTest/java/androidx/window/embedding/EmbeddingAdapterTest.kt
@@ -329,6 +329,7 @@
     }
 
     @Test
+    @Suppress("DEPRECATION")
     fun testTranslateAnimationBackgroundWithApiLevel5() {
         WindowTestUtils.assumeAtLeastVendorApiLevel(5)
 
@@ -373,6 +374,7 @@
     }
 
     @Test
+    @Suppress("DEPRECATION")
     fun testTranslateAnimationBackgroundBeforeApiLevel5() {
         WindowTestUtils.assumeAtLeastVendorApiLevel(2)
         WindowTestUtils.assumeBeforeVendorApiLevel(5)
diff --git a/window/window/src/main/java/androidx/window/embedding/EmbeddingAdapter.kt b/window/window/src/main/java/androidx/window/embedding/EmbeddingAdapter.kt
index 9f03807..dba7b47 100644
--- a/window/window/src/main/java/androidx/window/embedding/EmbeddingAdapter.kt
+++ b/window/window/src/main/java/androidx/window/embedding/EmbeddingAdapter.kt
@@ -119,6 +119,7 @@
     internal fun translate(activityStacks: List<OEMActivityStack>): List<ActivityStack> =
         activityStacks.map(this::translate)
 
+    @Suppress("DEPRECATION") // To compat with device with extension versions 5 and 6.
     internal fun translate(splitAttributes: OEMSplitAttributes): SplitAttributes {
         val builder =
             SplitAttributes.Builder()
@@ -292,6 +293,7 @@
     }
 
     @OptIn(ExperimentalWindowApi::class)
+    @Suppress("DEPRECATION") // To compat with device with extension versions 5 and 6.
     fun translateSplitAttributes(splitAttributes: SplitAttributes): OEMSplitAttributes {
         require(extensionVersion >= 2)
         // To workaround the "unused" error in ktlint. It is necessary to translate SplitAttributes