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
diff --git a/core/java/android/window/TaskFragmentAnimationParams.java b/core/java/android/window/TaskFragmentAnimationParams.java
index 12ad914..c8f6327 100644
--- a/core/java/android/window/TaskFragmentAnimationParams.java
+++ b/core/java/android/window/TaskFragmentAnimationParams.java
@@ -33,6 +33,13 @@
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 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}.
diff --git a/libs/WindowManager/Jetpack/window-extensions-release.aar b/libs/WindowManager/Jetpack/window-extensions-release.aar
index 7cd5dd6..c3b6916 100644
--- a/libs/WindowManager/Jetpack/window-extensions-release.aar
+++ b/libs/WindowManager/Jetpack/window-extensions-release.aar
Binary files differ
diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java
index 71bb99c..b28e807 100644
--- a/services/core/java/com/android/server/wm/Transition.java
+++ b/services/core/java/com/android/server/wm/Transition.java
@@ -41,6 +41,7 @@
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 @@
? 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 @@
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);
diff --git a/services/core/java/com/android/server/wm/WindowContainer.java b/services/core/java/com/android/server/wm/WindowContainer.java
index eec9973..bb706ec 100644
--- a/services/core/java/com/android/server/wm/WindowContainer.java
+++ b/services/core/java/com/android/server/wm/WindowContainer.java
@@ -33,6 +33,7 @@
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 @@
? 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 @@
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()