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

Commit b72d2aa8 authored by Brian Isganitis's avatar Brian Isganitis Committed by Automerger Merge Worker
Browse files

Merge "Expose mirror of wallpaper surface in WindowManagerGlobal." into...

Merge "Expose mirror of wallpaper surface in WindowManagerGlobal." into sc-v2-dev am: e7129047 am: ed2b9623

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16079508

Change-Id: Ib2a951d63da6884ec409c3028bfdcf1f47081e6c
parents 11097e3c ed2b9623
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -346,6 +346,14 @@ interface IWindowManager
     */
    Bitmap screenshotWallpaper();

    /**
     * Mirrors the wallpaper for the given display.
     *
     * @param displayId ID of the display for the wallpaper.
     * @return A SurfaceControl for the parent of the mirrored wallpaper.
     */
    SurfaceControl mirrorWallpaperSurface(int displayId);

    /**
     * Registers a wallpaper visibility listener.
     * @return Current visibility.
+11 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.view;

import android.animation.ValueAnimator;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.ComponentCallbacks2;
@@ -709,6 +710,16 @@ public final class WindowManagerGlobal {
            }
        }
    }

    /** @hide */
    @Nullable
    public SurfaceControl mirrorWallpaperSurface(int displayId) {
        try {
            return getWindowManagerService().mirrorWallpaperSurface(displayId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }
}

final class WindowLeaked extends AndroidRuntimeException {
+12 −0
Original line number Diff line number Diff line
@@ -801,6 +801,18 @@ class WallpaperController {
                wallpaperBuffer.getHardwareBuffer(), wallpaperBuffer.getColorSpace());
    }

    /**
     * Mirrors the visible wallpaper if it's available.
     *
     * @return A SurfaceControl for the parent of the mirrored wallpaper.
     */
    SurfaceControl mirrorWallpaperSurface() {
        final WindowState wallpaperWindowState = getTopVisibleWallpaper();
        return wallpaperWindowState != null
                ? SurfaceControl.mirrorSurface(wallpaperWindowState.getSurfaceControl())
                : null;
    }

    WindowState getTopVisibleWallpaper() {
        mTmpTopWallpaper = null;

+8 −0
Original line number Diff line number Diff line
@@ -3786,6 +3786,14 @@ public class WindowManagerService extends IWindowManager.Stub
        }
    }

    @Override
    public SurfaceControl mirrorWallpaperSurface(int displayId) {
        synchronized (mGlobalLock) {
            final DisplayContent dc = mRoot.getDisplayContent(displayId);
            return dc.mWallpaperController.mirrorWallpaperSurface();
        }
    }

    /**
     * Takes a snapshot of the screen.  In landscape mode this grabs the whole screen.
     * In portrait mode, it grabs the upper region of the screen based on the vertical dimension