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

Commit 82c1786e authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

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
parent 78cab5a5
Loading
Loading
Loading
Loading
+28 −1
Original line number Diff line number Diff line
@@ -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
+2 −1
Original line number Diff line number Diff line
@@ -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"
+2 −1
Original line number Diff line number Diff line
@@ -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"
+2 −1
Original line number Diff line number Diff line
@@ -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"
+2 −1
Original line number Diff line number Diff line
@@ -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"
Loading