Add ability to show wallpaper during animation
In the new task switch animations, we'd like to show the wallpaper behind. For that, we add the ability to show the wallpaper for any animation via Animation.showWallpaper as an XML attribute. If the window of an app is animating, and the animation requests the wallpaper, it can also be a wallpaper. One remaning issue here is that we don't wait for the wallpaper to be drawn when waiting for the transition. However, usually this isn't an issue because the wallpaper is drawn in any case. To fix this we'd need to load the animation already and then make it a target before the animation starts, which is a bit involved /quirky. Test: Open/close task, observe wallpaper behind Test: go/wm-smoke Bug: 72396815 Change-Id: I676273a4e6627f8b5e0a1366fcd80a7c92018123
This commit is contained in:
@@ -206,6 +206,8 @@ public abstract class Animation implements Cloneable {
|
||||
*/
|
||||
private boolean mDetachWallpaper = false;
|
||||
|
||||
private boolean mShowWallpaper;
|
||||
|
||||
private boolean mMore = true;
|
||||
private boolean mOneMoreTime = true;
|
||||
|
||||
@@ -253,7 +255,10 @@ public abstract class Animation implements Cloneable {
|
||||
|
||||
setBackgroundColor(a.getInt(com.android.internal.R.styleable.Animation_background, 0));
|
||||
|
||||
setDetachWallpaper(a.getBoolean(com.android.internal.R.styleable.Animation_detachWallpaper, false));
|
||||
setDetachWallpaper(
|
||||
a.getBoolean(com.android.internal.R.styleable.Animation_detachWallpaper, false));
|
||||
setShowWallpaper(
|
||||
a.getBoolean(com.android.internal.R.styleable.Animation_showWallpaper, false));
|
||||
|
||||
final int resID = a.getResourceId(com.android.internal.R.styleable.Animation_interpolator, 0);
|
||||
|
||||
@@ -660,6 +665,18 @@ public abstract class Animation implements Cloneable {
|
||||
mDetachWallpaper = detachWallpaper;
|
||||
}
|
||||
|
||||
/**
|
||||
* If this animation is run as a window animation, this will make the wallpaper visible behind
|
||||
* the animation.
|
||||
*
|
||||
* @param showWallpaper Whether the wallpaper should be shown during the animation.
|
||||
* @attr ref android.R.styleable#Animation_detachWallpaper
|
||||
* @hide
|
||||
*/
|
||||
public void setShowWallpaper(boolean showWallpaper) {
|
||||
mShowWallpaper = showWallpaper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the acceleration curve type for this animation.
|
||||
*
|
||||
@@ -774,6 +791,16 @@ public abstract class Animation implements Cloneable {
|
||||
return mDetachWallpaper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return If run as a window animation, returns whether the wallpaper will be shown behind
|
||||
* during the animation.
|
||||
* @attr ref android.R.styleable#Animation_showWallpaper
|
||||
* @hide
|
||||
*/
|
||||
public boolean getShowWallpaper() {
|
||||
return mShowWallpaper;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Indicates whether or not this animation will affect the transformation
|
||||
* matrix. For instance, a fade animation will not affect the matrix whereas
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false"
|
||||
android:zAdjustment="top">
|
||||
android:zAdjustment="top"
|
||||
android:showWallpaper="true">
|
||||
|
||||
<alpha
|
||||
android:fromAlpha="1"
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
-->
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false">
|
||||
android:shareInterpolator="false"
|
||||
android:showWallpaper="true">
|
||||
|
||||
<alpha
|
||||
android:fromAlpha="1.0"
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
<!-- This should in sync with cross_profile_apps_thumbnail_enter.xml -->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false"
|
||||
android:zAdjustment="top">
|
||||
android:zAdjustment="top"
|
||||
android:showWallpaper="true">
|
||||
|
||||
<alpha
|
||||
android:fromAlpha="1"
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
<!-- This should in sync with task_open_enter.xml -->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false"
|
||||
android:zAdjustment="top">
|
||||
android:zAdjustment="top"
|
||||
android:showWallpaper="true">
|
||||
|
||||
<alpha
|
||||
android:fromAlpha="1"
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
-->
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false">
|
||||
android:shareInterpolator="false"
|
||||
android:showWallpaper="true">
|
||||
|
||||
<alpha
|
||||
android:fromAlpha="1.0"
|
||||
|
||||
@@ -6328,6 +6328,9 @@
|
||||
<!-- Special option for window animations: if this window is on top
|
||||
of a wallpaper, don't animate the wallpaper with it. -->
|
||||
<attr name="detachWallpaper" format="boolean" />
|
||||
<!-- Special option for window animations: show the wallpaper behind when running this
|
||||
animation. -->
|
||||
<attr name="showWallpaper" format="boolean" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="AnimationSet">
|
||||
|
||||
@@ -38,6 +38,12 @@ interface AnimationAdapter {
|
||||
*/
|
||||
boolean getDetachWallpaper();
|
||||
|
||||
/**
|
||||
* @return Whether we should show the wallpaper during the animation.
|
||||
* @see Animation#getShowWallpaper()
|
||||
*/
|
||||
boolean getShowWallpaper();
|
||||
|
||||
/**
|
||||
* @return The background color behind the animation.
|
||||
*/
|
||||
|
||||
@@ -1668,6 +1668,9 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
|
||||
}
|
||||
if (adapter != null) {
|
||||
startAnimation(getPendingTransaction(), adapter, !isVisible());
|
||||
if (adapter.getShowWallpaper()) {
|
||||
mDisplayContent.pendingLayoutChanges |= FINISH_LAYOUT_REDO_WALLPAPER;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cancelAnimation();
|
||||
|
||||
@@ -42,6 +42,11 @@ class LocalAnimationAdapter implements AnimationAdapter {
|
||||
return mSpec.getDetachWallpaper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getShowWallpaper() {
|
||||
return mSpec.getShowWallpaper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBackgroundColor() {
|
||||
return mSpec.getBackgroundColor();
|
||||
@@ -81,6 +86,13 @@ class LocalAnimationAdapter implements AnimationAdapter {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AnimationAdapter#getShowWallpaper
|
||||
*/
|
||||
default boolean getShowWallpaper() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AnimationAdapter#getBackgroundColor
|
||||
*/
|
||||
|
||||
@@ -367,6 +367,11 @@ public class RecentsAnimationController {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getShowWallpaper() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBackgroundColor() {
|
||||
return 0;
|
||||
|
||||
@@ -220,6 +220,11 @@ class RemoteAnimationController {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getShowWallpaper() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBackgroundColor() {
|
||||
return 0;
|
||||
|
||||
@@ -606,8 +606,11 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
|
||||
// If we are ready to perform an app transition, check through all of the app tokens to be
|
||||
// shown and see if they are ready to go.
|
||||
if (mService.mAppTransition.isReady()) {
|
||||
defaultDisplay.pendingLayoutChanges |=
|
||||
surfacePlacer.handleAppTransitionReadyLocked();
|
||||
// This needs to be split into two expressions, as handleAppTransitionReadyLocked may
|
||||
// modify dc.pendingLayoutChanges, which would get lost when writing
|
||||
// defaultDisplay.pendingLayoutChanges |= handleAppTransitionReadyLocked()
|
||||
final int layoutChanges = surfacePlacer.handleAppTransitionReadyLocked();
|
||||
defaultDisplay.pendingLayoutChanges |= layoutChanges;
|
||||
if (DEBUG_LAYOUT_REPEATS)
|
||||
surfacePlacer.debugLayoutRepeats("after handleAppTransitionReadyLocked",
|
||||
defaultDisplay.pendingLayoutChanges);
|
||||
|
||||
@@ -151,7 +151,10 @@ class WallpaperController {
|
||||
|
||||
final RecentsAnimationController recentsAnimationController =
|
||||
mService.getRecentsAnimationController();
|
||||
final boolean hasWallpaper = (w.mAttrs.flags & FLAG_SHOW_WALLPAPER) != 0;
|
||||
final boolean animationWallpaper = w.mAppToken != null && w.mAppToken.getAnimation() != null
|
||||
&& w.mAppToken.getAnimation().getShowWallpaper();
|
||||
final boolean hasWallpaper = (w.mAttrs.flags & FLAG_SHOW_WALLPAPER) != 0
|
||||
|| animationWallpaper;
|
||||
final boolean isRecentsTransitionTarget = (recentsAnimationController != null
|
||||
&& recentsAnimationController.isWallpaperVisible(w));
|
||||
if (isRecentsTransitionTarget) {
|
||||
|
||||
@@ -68,6 +68,11 @@ public class WindowAnimationSpec implements AnimationSpec {
|
||||
return mAnimation.getDetachWallpaper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getShowWallpaper() {
|
||||
return mAnimation.getShowWallpaper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBackgroundColor() {
|
||||
return mAnimation.getBackgroundColor();
|
||||
|
||||
Reference in New Issue
Block a user