Merge changes I5309c225,Id706da34 into udc-dev
* changes: Adjust top wallpaper and wallpaper visibility according to keyguard state Inform window manager of the wallpaper flag change
This commit is contained in:
committed by
Android (Google) Code Review
commit
17b2bb996f
@@ -923,6 +923,8 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
|
|||||||
if (DEBUG) Slog.v(TAG, "Adding window token: " + mToken);
|
if (DEBUG) Slog.v(TAG, "Adding window token: " + mToken);
|
||||||
mWindowManagerInternal.addWindowToken(mToken, TYPE_WALLPAPER, mDisplayId,
|
mWindowManagerInternal.addWindowToken(mToken, TYPE_WALLPAPER, mDisplayId,
|
||||||
null /* options */);
|
null /* options */);
|
||||||
|
mWindowManagerInternal.setWallpaperShowWhenLocked(
|
||||||
|
mToken, (wallpaper.mWhich & FLAG_LOCK) != 0);
|
||||||
final DisplayData wpdData =
|
final DisplayData wpdData =
|
||||||
mWallpaperDisplayHelper.getDisplayDataOrCreate(mDisplayId);
|
mWallpaperDisplayHelper.getDisplayDataOrCreate(mDisplayId);
|
||||||
try {
|
try {
|
||||||
@@ -1415,12 +1417,13 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
|
|||||||
try {
|
try {
|
||||||
if (connector.mEngine != null) {
|
if (connector.mEngine != null) {
|
||||||
connector.mEngine.setWallpaperFlags(which);
|
connector.mEngine.setWallpaperFlags(which);
|
||||||
|
mWindowManagerInternal.setWallpaperShowWhenLocked(
|
||||||
|
connector.mToken, (which & FLAG_LOCK) != 0);
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.e(TAG, "Failed to update wallpaper engine flags", e);
|
Slog.e(TAG, "Failed to update wallpaper engine flags", e);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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 static com.android.server.wm.WindowManagerService.H.WALLPAPER_DRAW_PENDING_TIMEOUT;
|
||||||
|
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
@@ -55,6 +56,7 @@ import android.view.WindowManager;
|
|||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.window.ScreenCapture;
|
import android.window.ScreenCapture;
|
||||||
|
|
||||||
|
import com.android.internal.R;
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.protolog.ProtoLogImpl;
|
import com.android.internal.protolog.ProtoLogImpl;
|
||||||
import com.android.internal.protolog.common.ProtoLog;
|
import com.android.internal.protolog.common.ProtoLog;
|
||||||
@@ -72,7 +74,7 @@ import java.util.function.Consumer;
|
|||||||
class WallpaperController {
|
class WallpaperController {
|
||||||
private static final String TAG = TAG_WITH_CLASS_NAME ? "WallpaperController" : TAG_WM;
|
private static final String TAG = TAG_WITH_CLASS_NAME ? "WallpaperController" : TAG_WM;
|
||||||
private WindowManagerService mService;
|
private WindowManagerService mService;
|
||||||
private final DisplayContent mDisplayContent;
|
private DisplayContent mDisplayContent;
|
||||||
|
|
||||||
private final ArrayList<WallpaperWindowToken> mWallpaperTokens = new ArrayList<>();
|
private final ArrayList<WallpaperWindowToken> mWallpaperTokens = new ArrayList<>();
|
||||||
|
|
||||||
@@ -120,9 +122,19 @@ class WallpaperController {
|
|||||||
|
|
||||||
private boolean mShouldOffsetWallpaperCenter;
|
private boolean mShouldOffsetWallpaperCenter;
|
||||||
|
|
||||||
|
final boolean mEnableSeparateLockScreenEngine;
|
||||||
|
|
||||||
private final ToBooleanFunction<WindowState> mFindWallpaperTargetFunction = w -> {
|
private final ToBooleanFunction<WindowState> mFindWallpaperTargetFunction = w -> {
|
||||||
if ((w.mAttrs.type == TYPE_WALLPAPER)) {
|
if ((w.mAttrs.type == TYPE_WALLPAPER)) {
|
||||||
if (mFindResults.topWallpaper == null || mFindResults.resetTopWallpaper) {
|
if (mFindResults.topWallpaper == null || mFindResults.resetTopWallpaper) {
|
||||||
|
WallpaperWindowToken token = w.mToken.asWallpaperToken();
|
||||||
|
if (token == null) {
|
||||||
|
Slog.w(TAG, "Window " + w + " has wallpaper type but not wallpaper token");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!token.canShowWhenLocked() && mDisplayContent.isKeyguardLocked()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
mFindResults.setTopWallpaper(w);
|
mFindResults.setTopWallpaper(w);
|
||||||
mFindResults.resetTopWallpaper = false;
|
mFindResults.resetTopWallpaper = false;
|
||||||
}
|
}
|
||||||
@@ -249,11 +261,14 @@ class WallpaperController {
|
|||||||
WallpaperController(WindowManagerService service, DisplayContent displayContent) {
|
WallpaperController(WindowManagerService service, DisplayContent displayContent) {
|
||||||
mService = service;
|
mService = service;
|
||||||
mDisplayContent = displayContent;
|
mDisplayContent = displayContent;
|
||||||
mMaxWallpaperScale = service.mContext.getResources()
|
Resources resources = service.mContext.getResources();
|
||||||
.getFloat(com.android.internal.R.dimen.config_wallpaperMaxScale);
|
mMaxWallpaperScale =
|
||||||
mShouldOffsetWallpaperCenter = service.mContext.getResources()
|
resources.getFloat(com.android.internal.R.dimen.config_wallpaperMaxScale);
|
||||||
.getBoolean(
|
mShouldOffsetWallpaperCenter =
|
||||||
|
resources.getBoolean(
|
||||||
com.android.internal.R.bool.config_offsetWallpaperToCenterOfLargestDisplay);
|
com.android.internal.R.bool.config_offsetWallpaperToCenterOfLargestDisplay);
|
||||||
|
mEnableSeparateLockScreenEngine =
|
||||||
|
resources.getBoolean(R.bool.config_independentLockscreenLiveWallpaper);
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetLargestDisplay(Display display) {
|
void resetLargestDisplay(Display display) {
|
||||||
@@ -753,10 +768,10 @@ class WallpaperController {
|
|||||||
result.setWallpaperTarget(wallpaperTarget);
|
result.setWallpaperTarget(wallpaperTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateWallpaperTokens(boolean visible) {
|
private void updateWallpaperTokens(boolean visibility, boolean locked) {
|
||||||
for (int curTokenNdx = mWallpaperTokens.size() - 1; curTokenNdx >= 0; curTokenNdx--) {
|
for (int curTokenNdx = mWallpaperTokens.size() - 1; curTokenNdx >= 0; curTokenNdx--) {
|
||||||
final WallpaperWindowToken token = mWallpaperTokens.get(curTokenNdx);
|
final WallpaperWindowToken token = mWallpaperTokens.get(curTokenNdx);
|
||||||
token.updateWallpaperWindows(visible);
|
token.updateWallpaperWindows(visibility && (!locked || token.canShowWhenLocked()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -794,7 +809,13 @@ class WallpaperController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateWallpaperTokens(visible);
|
// Keep both wallpapers visible unless the keyguard is locked (then hide private wp)
|
||||||
|
updateWallpaperTokens(visible, mDisplayContent.isKeyguardLocked());
|
||||||
|
|
||||||
|
if (DEBUG_WALLPAPER) {
|
||||||
|
Slog.v(TAG, "adjustWallpaperWindows: wallpaper visibility " + visible
|
||||||
|
+ ", lock visibility " + mDisplayContent.isKeyguardLocked());
|
||||||
|
}
|
||||||
|
|
||||||
if (visible && mLastFrozen != mFindResults.isWallpaperTargetForLetterbox) {
|
if (visible && mLastFrozen != mFindResults.isWallpaperTargetForLetterbox) {
|
||||||
mLastFrozen = mFindResults.isWallpaperTargetForLetterbox;
|
mLastFrozen = mFindResults.isWallpaperTargetForLetterbox;
|
||||||
@@ -896,7 +917,6 @@ class WallpaperController {
|
|||||||
mWallpaperTokens.remove(token);
|
mWallpaperTokens.remove(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
boolean canScreenshotWallpaper() {
|
boolean canScreenshotWallpaper() {
|
||||||
return canScreenshotWallpaper(getTopVisibleWallpaper());
|
return canScreenshotWallpaper(getTopVisibleWallpaper());
|
||||||
|
|||||||
@@ -76,15 +76,19 @@ class WallpaperWindowToken extends WindowToken {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mShowWhenLocked = showWhenLocked;
|
mShowWhenLocked = showWhenLocked;
|
||||||
|
if (mDisplayContent.mWallpaperController.mEnableSeparateLockScreenEngine) {
|
||||||
// Move the window token to the front (private) or back (showWhenLocked). This is possible
|
// Move the window token to the front (private) or back (showWhenLocked). This is
|
||||||
// because the DisplayArea underneath TaskDisplayArea only contains TYPE_WALLPAPER windows.
|
// possible
|
||||||
|
// because the DisplayArea underneath TaskDisplayArea only contains TYPE_WALLPAPER
|
||||||
|
// windows.
|
||||||
final int position = showWhenLocked ? POSITION_BOTTOM : POSITION_TOP;
|
final int position = showWhenLocked ? POSITION_BOTTOM : POSITION_TOP;
|
||||||
|
|
||||||
// Note: Moving all the way to the front or back breaks ordering based on addition times.
|
// 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.
|
// We should never have more than one non-animating token of each type.
|
||||||
getParent().positionChildAt(position, this /* child */, false /*includingParents */);
|
getParent().positionChildAt(position, this /* child */, false /*includingParents */);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
boolean canShowWhenLocked() {
|
boolean canShowWhenLocked() {
|
||||||
return mShowWhenLocked;
|
return mShowWhenLocked;
|
||||||
|
|||||||
Reference in New Issue
Block a user