diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java index 7a733592b30c1..c9eef387eeb29 100644 --- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java @@ -923,6 +923,8 @@ public class WallpaperManagerService extends IWallpaperManager.Stub if (DEBUG) Slog.v(TAG, "Adding window token: " + mToken); mWindowManagerInternal.addWindowToken(mToken, TYPE_WALLPAPER, mDisplayId, null /* options */); + mWindowManagerInternal.setWallpaperShowWhenLocked( + mToken, (wallpaper.mWhich & FLAG_LOCK) != 0); final DisplayData wpdData = mWallpaperDisplayHelper.getDisplayDataOrCreate(mDisplayId); try { @@ -1415,12 +1417,13 @@ public class WallpaperManagerService extends IWallpaperManager.Stub try { if (connector.mEngine != null) { connector.mEngine.setWallpaperFlags(which); + mWindowManagerInternal.setWallpaperShowWhenLocked( + connector.mToken, (which & FLAG_LOCK) != 0); } } catch (RemoteException e) { Slog.e(TAG, "Failed to update wallpaper engine flags", e); } - } - ); + }); } } diff --git a/services/core/java/com/android/server/wm/WallpaperController.java b/services/core/java/com/android/server/wm/WallpaperController.java index 16541c10d9db4..90940d2464fa3 100644 --- a/services/core/java/com/android/server/wm/WallpaperController.java +++ b/services/core/java/com/android/server/wm/WallpaperController.java @@ -37,6 +37,7 @@ import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; import static com.android.server.wm.WindowManagerService.H.WALLPAPER_DRAW_PENDING_TIMEOUT; import android.annotation.Nullable; +import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Point; import android.graphics.Rect; @@ -55,6 +56,7 @@ import android.view.WindowManager; import android.view.animation.Animation; import android.window.ScreenCapture; +import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.protolog.ProtoLogImpl; import com.android.internal.protolog.common.ProtoLog; @@ -120,6 +122,8 @@ class WallpaperController { private boolean mShouldOffsetWallpaperCenter; + final boolean mEnableSeparateLockScreenEngine; + private final ToBooleanFunction mFindWallpaperTargetFunction = w -> { if ((w.mAttrs.type == TYPE_WALLPAPER)) { if (mFindResults.topWallpaper == null || mFindResults.resetTopWallpaper) { @@ -249,11 +253,14 @@ class WallpaperController { WallpaperController(WindowManagerService service, DisplayContent displayContent) { mService = service; mDisplayContent = displayContent; - mMaxWallpaperScale = service.mContext.getResources() - .getFloat(com.android.internal.R.dimen.config_wallpaperMaxScale); - mShouldOffsetWallpaperCenter = service.mContext.getResources() - .getBoolean( + Resources resources = service.mContext.getResources(); + mMaxWallpaperScale = + resources.getFloat(com.android.internal.R.dimen.config_wallpaperMaxScale); + mShouldOffsetWallpaperCenter = + resources.getBoolean( com.android.internal.R.bool.config_offsetWallpaperToCenterOfLargestDisplay); + mEnableSeparateLockScreenEngine = + resources.getBoolean(R.bool.config_independentLockscreenLiveWallpaper); } void resetLargestDisplay(Display display) { diff --git a/services/core/java/com/android/server/wm/WallpaperWindowToken.java b/services/core/java/com/android/server/wm/WallpaperWindowToken.java index 8708f73980c6f..17ab551b5c1e3 100644 --- a/services/core/java/com/android/server/wm/WallpaperWindowToken.java +++ b/services/core/java/com/android/server/wm/WallpaperWindowToken.java @@ -76,14 +76,18 @@ class WallpaperWindowToken extends WindowToken { return; } mShowWhenLocked = showWhenLocked; + if (mDisplayContent.mWallpaperController.mEnableSeparateLockScreenEngine) { + // Move the window token to the front (private) or back (showWhenLocked). This is + // possible + // because the DisplayArea underneath TaskDisplayArea only contains TYPE_WALLPAPER + // windows. + final int position = showWhenLocked ? POSITION_BOTTOM : POSITION_TOP; - // Move the window token to the front (private) or back (showWhenLocked). This is possible - // because the DisplayArea underneath TaskDisplayArea only contains TYPE_WALLPAPER windows. - final int position = showWhenLocked ? POSITION_BOTTOM : POSITION_TOP; - - // Note: Moving all the way to the front or back breaks ordering based on addition times. - // We should never have more than one non-animating token of each type. - getParent().positionChildAt(position, this /* child */, false /*includingParents */); + // Note: Moving all the way to the front or back breaks ordering based on addition + // times. + // We should never have more than one non-animating token of each type. + getParent().positionChildAt(position, this /* child */, false /*includingParents */); + } } boolean canShowWhenLocked() {