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

Commit 21fdd916 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Make wallpaper visible in freeform mode.

The system requires at less one window to be
a wallpaper target in order to make the wallpaper visible.
For example the home and recents activities are both
wallpaper targets. For the case of the freeform workspace
there is no activity/window that is a wallpaper target.
We now make the wallpaper window target itself when in freeform
mode so we don't need an additional window to make it visible.

Change-Id: I6553c0fcec770e931c08bed8ef5c533b47afe1b8
parent 576d7f11
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.wm;

import static android.app.ActivityManager.FREEFORM_WORKSPACE_STACK_ID;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
@@ -474,15 +475,18 @@ class WallpaperController {
        result.reset();
        WindowState w = null;
        int windowDetachedI = -1;
        boolean resetTopWallpaper = false;
        boolean inFreeformSpace = false;
        for (int i = windows.size() - 1; i >= 0; i--) {
            w = windows.get(i);
            if ((w.mAttrs.type == TYPE_WALLPAPER)) {
                if (result.topWallpaper == null) {
                if (result.topWallpaper == null || resetTopWallpaper) {
                    result.setTopWallpaper(w, i);
                    resetTopWallpaper = false;
                }
                continue;
            }
            result.topWallpaper = null;
            resetTopWallpaper = true;
            if (w != winAnimator.mWindowDetachedWallpaper && w.mAppToken != null) {
                // If this window's app token is hidden and not animating,
                // it is of no interest to us.
@@ -495,6 +499,11 @@ class WallpaperController {
            if (DEBUG_WALLPAPER) Slog.v(TAG, "Win #" + i + " " + w + ": isOnScreen="
                    + w.isOnScreen() + " mDrawState=" + w.mWinAnimator.mDrawState);

            if (!inFreeformSpace) {
                TaskStack stack = w.getStack();
                inFreeformSpace = stack != null && stack.mStackId == FREEFORM_WORKSPACE_STACK_ID;
            }

            // If the app is executing an animation because the keyguard is going away,
            // keep the wallpaper during the animation so it doesn't flicker out.
            final boolean hasWallpaper = (w.mAttrs.flags & FLAG_SHOW_WALLPAPER) != 0
@@ -521,6 +530,11 @@ class WallpaperController {
                    "Found animating detached wallpaper activity: #" + windowDetachedI + "=" + w);
            result.setWallpaperTarget(w, windowDetachedI);
        }
        if (result.wallpaperTarget == null && inFreeformSpace) {
            // In freeform mode we set the wallpaper as its own target, so we don't need an
            // additional window to make it visible.
            result.setWallpaperTarget(result.topWallpaper, result.topWallpaperIndex);
        }
    }

    private boolean updateWallpaperWindowsTarget(