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

Commit a48a8db9 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Fixed bug with black background when exiting a wallpaper window.

* Defer hiding the wallpaper until all animations are done. We were
previously hiding the wallpaper once the closing app animation is
done which leads to the background of the opening app animation
going black since there is nothing to show there.

* Don't set the wallpaper_close_enter animation blackground
to black. This will also cause the background of the opening app
animation to go black once the wallpaper closing app animation is
done.

* Don't set task_open_enter animation blackground to black. This
can cause an undesired black frame during transition if the new
task is created on the home stack instead of an application stack.

Bug: 17098816
Bug: 19454410
Change-Id: I0e63d72b1748d7d2424119b3176f48476293af92
parent 6bac04ab
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
-->

<set xmlns:android="http://schemas.android.com/apk/res/android"
        android:background="#ff000000" android:shareInterpolator="false" android:zAdjustment="top">
        android:shareInterpolator="false" android:zAdjustment="top">

    <alpha android:fromAlpha="0" android:toAlpha="1.0"
            android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
-->

<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:background="#ff000000" android:shareInterpolator="false" android:zAdjustment="top">
    android:shareInterpolator="false" android:zAdjustment="top">

    <alpha android:fromAlpha="0" android:toAlpha="1.0"
        android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
+27 −5
Original line number Diff line number Diff line
@@ -624,6 +624,12 @@ public class WindowManagerService extends IWindowManager.Stub
    static final int WALLPAPER_DRAW_TIMEOUT = 2;
    int mWallpaperDrawState = WALLPAPER_DRAW_NORMAL;

    // Set to the wallpaper window we would like to hide once the transition animations are done.
    // This is useful in cases where we don't want the wallpaper to be hidden when the close app
    // is a wallpaper target and is done animating out, but the opening app isn't a wallpaper
    // target and isn't done animating in.
    WindowState mDeferredHideWallpaper = null;

    AppWindowToken mFocusedApp = null;

    PowerManager mPowerManager;
@@ -1781,17 +1787,24 @@ public class WindowManagerService extends IWindowManager.Stub
    }

    void hideWallpapersLocked(final WindowState winGoingAway) {
        if (mWallpaperTarget != null &&
                (mWallpaperTarget != winGoingAway || mLowerWallpaperTarget != null)) {
        if (mWallpaperTarget != null
                && (mWallpaperTarget != winGoingAway || mLowerWallpaperTarget != null)) {
            return;
        }
        if (mAppTransition.isRunning()) {
            // Defer hiding the wallpaper when app transition is running until the animations
            // are done.
            mDeferredHideWallpaper = winGoingAway;
            return;
        }

        final boolean wasDeferred = (mDeferredHideWallpaper == winGoingAway);
        for (int i = mWallpaperTokens.size() - 1; i >= 0; i--) {
            final WindowToken token = mWallpaperTokens.get(i);
            for (int j = token.windows.size() - 1; j >= 0; j--) {
                final WindowState wallpaper = token.windows.get(j);
                final WindowStateAnimator winAnimator = wallpaper.mWinAnimator;
                if (!winAnimator.mLastHidden) {
                if (!winAnimator.mLastHidden || wasDeferred) {
                    winAnimator.hide();
                    dispatchWallpaperVisibility(wallpaper, false);
                    final DisplayContent displayContent = wallpaper.getDisplayContent();
@@ -2270,12 +2283,15 @@ public class WindowManagerService extends IWindowManager.Stub
    }

    /**
     * Check wallpaper for visiblity change and notify window if so.
     * Check wallpaper for visibility change and notify window if so.
     * @param wallpaper The wallpaper to test and notify.
     * @param visible Current visibility.
     */
    void dispatchWallpaperVisibility(final WindowState wallpaper, final boolean visible) {
        if (wallpaper.mWallpaperVisible != visible) {
        // Only send notification if the visibility actually changed and we are not trying to hide
        // the wallpaper when we are deferring hiding of the wallpaper.
        if (wallpaper.mWallpaperVisible != visible
                && (mDeferredHideWallpaper == null || visible)) {
            wallpaper.mWallpaperVisible = visible;
            try {
                if (DEBUG_VISIBILITY || DEBUG_WALLPAPER_LIGHT) Slog.v(TAG,
@@ -9523,6 +9539,12 @@ public class WindowManagerService extends IWindowManager.Stub
        int changes = 0;

        mAppTransition.setIdle();

        if (mDeferredHideWallpaper != null) {
            hideWallpapersLocked(mDeferredHideWallpaper);
            mDeferredHideWallpaper = null;
        }

        // Restore window app tokens to the ActivityManager views
        ArrayList<TaskStack> stacks = getDefaultDisplayContentLocked().getStacks();
        for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) {