Expose mirror of wallpaper surface in WindowManagerGlobal.
Test: Manual Bug: 188222480 Change-Id: I92302053a797de76aec3c2a25e5d895cfc85e6d5
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -3791,6 +3791,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
|
||||
|
||||
Reference in New Issue
Block a user