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

Commit f5130b49 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Arrange WallpaperTokens by show-when-locked"

parents 6f39a4ed a8e328bd
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -4417,6 +4417,12 @@
      "group": "WM_DEBUG_TASKS",
      "at": "com\/android\/server\/wm\/RootWindowContainer.java"
    },
    "2043434284": {
      "message": "setWallpaperShowWhenLocked: non-existent wallpaper token: %s",
      "level": "WARN",
      "group": "WM_ERROR",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    "2045641491": {
      "message": "Checking %d opening apps (frozen=%b timeout=%b)...",
      "level": "VERBOSE",
+25 −0
Original line number Diff line number Diff line
@@ -41,6 +41,8 @@ class WallpaperWindowToken extends WindowToken {

    private static final String TAG = TAG_WITH_CLASS_NAME ? "WallpaperWindowToken" : TAG_WM;

    private boolean mShowWhenLocked = false;

    WallpaperWindowToken(WindowManagerService service, IBinder token, boolean explicit,
            DisplayContent dc, boolean ownerCanManageAppTokens) {
        this(service, token, explicit, dc, ownerCanManageAppTokens, null /* options */);
@@ -65,6 +67,29 @@ class WallpaperWindowToken extends WindowToken {
        mDisplayContent.mWallpaperController.removeWallpaperToken(this);
    }

    /**
     * Controls whether this wallpaper shows underneath the keyguard or is hidden and only
     * revealed once keyguard is dismissed.
     */
    void setShowWhenLocked(boolean showWhenLocked) {
        if (showWhenLocked == mShowWhenLocked) {
            return;
        }
        mShowWhenLocked = showWhenLocked;

        // 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 */);
    }

    boolean canShowWhenLocked() {
        return mShowWhenLocked;
    }

    void sendWindowWallpaperCommand(
            String action, int x, int y, int z, Bundle extras, boolean sync) {
        for (int wallpaperNdx = mChildren.size() - 1; wallpaperNdx >= 0; wallpaperNdx--) {
+11 −0
Original line number Diff line number Diff line
@@ -656,6 +656,17 @@ public abstract class WindowManagerInternal {
     */
    public abstract int getWindowOwnerUserId(IBinder windowToken);

    /**
     * Control visilibility of a {@link WallpaperWindowToken} {@code} binder on the lock screen.
     *
     * <p>This will also affect its Z-ordering as {@code showWhenLocked} wallpaper tokens are
     * arranged underneath non-{@code showWhenLocked} wallpaper tokens.
     *
     * @param windowToken wallpaper token previously added via {@link #addWindowToken}
     * @param showWhenLocked whether {@param token} can continue to be shown on the lock screen.
     */
    public abstract void setWallpaperShowWhenLocked(IBinder windowToken, boolean showWhenLocked);

    /**
     * Returns {@code true} if a Window owned by {@code uid} has focus.
     */
+13 −0
Original line number Diff line number Diff line
@@ -8044,6 +8044,19 @@ public class WindowManagerService extends IWindowManager.Stub
            }
        }

        @Override
        public void setWallpaperShowWhenLocked(IBinder binder, boolean showWhenLocked) {
            synchronized (mGlobalLock) {
                final WindowToken token = mRoot.getWindowToken(binder);
                if (token == null || token.asWallpaperToken() == null) {
                    ProtoLog.w(WM_ERROR,
                            "setWallpaperShowWhenLocked: non-existent wallpaper token: %s", binder);
                    return;
                }
                token.asWallpaperToken().setShowWhenLocked(showWhenLocked);
            }
        }

        @Override
        public boolean isUidFocused(int uid) {
            synchronized (mGlobalLock) {