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

Commit 7ed4d37b authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Rename WindowState.mAttachedWindow to WindowState.mParentWindow

Helps with code clarity and reduces confusion for upcoming WM
object modeling changes.
Also, along the same lines changes locations that check to see if
WS.mAttachedWindow wasn't null to determine if the window is a child
window to use WS.isChildWindow method instead.

Bug: 30060889
Change-Id: I9b975ab9ff9bf09cdd3c0dcaddd3bf9232e88be8
parent e4da41e6
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -389,7 +389,7 @@ final class AccessibilityController {
            if (spec != null && !spec.isNop()) {
                WindowManagerPolicy policy = mWindowManagerService.mPolicy;
                final int windowType = windowState.mAttrs.type;
                if (!policy.isTopLevelWindow(windowType) && windowState.mAttachedWindow != null
                if (!policy.isTopLevelWindow(windowType) && windowState.isChildWindow()
                        && !policy.canMagnifyWindow(windowType)) {
                    return null;
                }
@@ -1205,9 +1205,8 @@ final class AccessibilityController {
            window.title = windowState.mAttrs.accessibilityTitle;
            window.accessibilityIdOfAnchor = windowState.mAttrs.accessibilityIdOfAnchor;

            WindowState attachedWindow = windowState.mAttachedWindow;
            if (attachedWindow != null) {
                window.parentToken = attachedWindow.mClient.asBinder();
            if (windowState.isChildWindow()) {
                window.parentToken = windowState.mParentWindow.mClient.asBinder();
            }

            window.focused = windowState.isFocused();
+3 −3
Original line number Diff line number Diff line
@@ -661,9 +661,9 @@ class WallpaperController {
            while (wallpaperTargetIndex > 0) {
                WindowState wb = windows.get(wallpaperTargetIndex - 1);
                if (wb.mBaseLayer < maxLayer &&
                        wb.mAttachedWindow != wallpaperTarget &&
                        (wallpaperTarget.mAttachedWindow == null ||
                                wb.mAttachedWindow != wallpaperTarget.mAttachedWindow) &&
                        wb.mParentWindow != wallpaperTarget &&
                        (wallpaperTarget.mParentWindow == null ||
                                wb.mParentWindow != wallpaperTarget.mParentWindow) &&
                        (wb.mAttrs.type != TYPE_APPLICATION_STARTING
                                || wallpaperTarget.mToken == null
                                || wb.mToken != wallpaperTarget.mToken)) {
+2 −2
Original line number Diff line number Diff line
@@ -370,7 +370,7 @@ public class WindowAnimator {
                                && !mPostKeyguardExitAnimation.hasEnded()
                                && !winAnimator.mKeyguardGoingAwayAnimation
                                && win.hasDrawnLw()
                                && win.mAttachedWindow == null
                                && !win.isChildWindow()
                                && !win.mIsImWindow
                                && displayId == Display.DEFAULT_DISPLAY;

@@ -388,7 +388,7 @@ public class WindowAnimator {
                        if (DEBUG_KEYGUARD || DEBUG_VISIBILITY) Slog.v(TAG,
                                "Now policy shown: " + win);
                        if ((mBulkUpdateParams & SET_FORCE_HIDING_CHANGED) != 0
                                && win.mAttachedWindow == null) {
                                && !win.isChildWindow()) {
                            if (unForceHiding == null) {
                                unForceHiding = new ArrayList<>();
                            }
+5 −5
Original line number Diff line number Diff line
@@ -1365,7 +1365,7 @@ public class WindowManagerService extends IWindowManager.Stub
        if (displayContent == null) {
            return;
        }
        final WindowState attached = win.mAttachedWindow;
        final WindowState attached = win.mParentWindow;

        WindowList tokenWindowList = getTokenWindowsOnDisplay(token, displayContent);

@@ -1426,7 +1426,7 @@ public class WindowManagerService extends IWindowManager.Stub
    private void addWindowToListInOrderLocked(final WindowState win, boolean addToToken) {
        if (DEBUG_FOCUS) Slog.d(TAG_WM, "addWindowToListInOrderLocked: win=" + win +
                " Callers=" + Debug.getCallers(4));
        if (win.mAttachedWindow == null) {
        if (!win.isChildWindow()) {
            final WindowToken token = win.mToken;
            int tokenWindowsPos = 0;
            if (token.appWindowToken != null) {
@@ -1714,7 +1714,7 @@ public class WindowManagerService extends IWindowManager.Stub
            if (mInputMethodWindow != null) {
                while (pos < windows.size()) {
                    WindowState wp = windows.get(pos);
                    if (wp == mInputMethodWindow || wp.mAttachedWindow == mInputMethodWindow) {
                    if (wp == mInputMethodWindow || wp.mParentWindow == mInputMethodWindow) {
                        pos++;
                        continue;
                    }
@@ -2711,7 +2711,7 @@ public class WindowManagerService extends IWindowManager.Stub
                if (win == null) {
                    return;
                }
                if (win.mAttachedWindow == null) {
                if (!win.isChildWindow()) {
                    throw new IllegalArgumentException(
                            "repositionChild called but window is not"
                            + "attached to a parent win=" + win);
@@ -3096,7 +3096,7 @@ public class WindowManagerService extends IWindowManager.Stub
            // resizing (as we only have one full-screen surface). So there is no need
            // to preserve and destroy windows which are attached to another, they
            // will keep their surface and its size may change over time.
            if (win.mHasSurface && win.mAttachedWindow == null) {
            if (win.mHasSurface && !win.isChildWindow()) {
                winAnimator.preserveSurfaceLocked();
                result |= WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME;
            }
+19 −19
Original line number Diff line number Diff line
@@ -150,7 +150,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
    // modified they will need to be locked.
    final WindowManager.LayoutParams mAttrs = new WindowManager.LayoutParams();
    final DeathRecipient mDeathRecipient;
    final WindowState mAttachedWindow;
    final WindowState mParentWindow;
    final WindowList mChildWindows = new WindowList();
    final int mBaseLayer;
    final int mSubLayer;
@@ -504,7 +504,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
    boolean mSeamlesslyRotated = false;

    WindowState(WindowManagerService service, Session s, IWindow c, WindowToken token,
           WindowState attachedWindow, int appOp, int seq, WindowManager.LayoutParams a,
           WindowState parentWindow, int appOp, int seq, WindowManager.LayoutParams a,
           int viewVisibility, final DisplayContent displayContent) {
        mService = service;
        mSession = s;
@@ -541,7 +541,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
            c.asBinder().linkToDeath(deathRecipient, 0);
        } catch (RemoteException e) {
            mDeathRecipient = null;
            mAttachedWindow = null;
            mParentWindow = null;
            mLayoutAttached = false;
            mIsImWindow = false;
            mIsWallpaper = false;
@@ -559,13 +559,13 @@ final class WindowState implements WindowManagerPolicy.WindowState {
            // The multiplier here is to reserve space for multiple
            // windows in the same type layer.
            mBaseLayer = mPolicy.windowTypeToLayerLw(
                    attachedWindow.mAttrs.type) * WindowManagerService.TYPE_LAYER_MULTIPLIER
                    parentWindow.mAttrs.type) * WindowManagerService.TYPE_LAYER_MULTIPLIER
                    + WindowManagerService.TYPE_LAYER_OFFSET;
            mSubLayer = mPolicy.subWindowTypeToLayerLw(a.type);
            mAttachedWindow = attachedWindow;
            if (DEBUG_ADD_REMOVE) Slog.v(TAG, "Adding " + this + " to " + mAttachedWindow);
            mParentWindow = parentWindow;
            if (DEBUG_ADD_REMOVE) Slog.v(TAG, "Adding " + this + " to " + mParentWindow);

            final WindowList childWindows = mAttachedWindow.mChildWindows;
            final WindowList childWindows = mParentWindow.mChildWindows;
            final int numChildWindows = childWindows.size();
            if (numChildWindows == 0) {
                childWindows.add(this);
@@ -590,9 +590,9 @@ final class WindowState implements WindowManagerPolicy.WindowState {

            mLayoutAttached = mAttrs.type !=
                    WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
            mIsImWindow = attachedWindow.mAttrs.type == TYPE_INPUT_METHOD
                    || attachedWindow.mAttrs.type == TYPE_INPUT_METHOD_DIALOG;
            mIsWallpaper = attachedWindow.mAttrs.type == TYPE_WALLPAPER;
            mIsImWindow = parentWindow.mAttrs.type == TYPE_INPUT_METHOD
                    || parentWindow.mAttrs.type == TYPE_INPUT_METHOD_DIALOG;
            mIsWallpaper = parentWindow.mAttrs.type == TYPE_WALLPAPER;
            mIsFloatingLayer = mIsImWindow || mIsWallpaper;
        } else {
            // The multiplier here is to reserve space for multiple
@@ -601,7 +601,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
                    * WindowManagerService.TYPE_LAYER_MULTIPLIER
                    + WindowManagerService.TYPE_LAYER_OFFSET;
            mSubLayer = 0;
            mAttachedWindow = null;
            mParentWindow = null;
            mLayoutAttached = false;
            mIsImWindow = mAttrs.type == TYPE_INPUT_METHOD
                    || mAttrs.type == TYPE_INPUT_METHOD_DIALOG;
@@ -611,7 +611,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {

        WindowState appWin = this;
        while (appWin.isChildWindow()) {
            appWin = appWin.mAttachedWindow;
            appWin = appWin.mParentWindow;
        }
        WindowToken appToken = appWin.mToken;
        while (appToken.appWindowToken == null) {
@@ -1040,7 +1040,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
    public int getBaseType() {
        WindowState win = this;
        while (win.isChildWindow()) {
            win = win.mAttachedWindow;
            win = win.mParentWindow;
        }
        return win.mAttrs.type;
    }
@@ -1406,7 +1406,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
        return mHasSurface && (mContentChanged || mMovedByResize)
                && !mAnimatingExit && mService.okToDisplay()
                && (mFrame.top != mLastFrame.top || mFrame.left != mLastFrame.left)
                && (mAttachedWindow == null || !mAttachedWindow.hasMoved());
                && (!isChildWindow() || !mParentWindow.hasMoved());
    }

    boolean isObscuringFullscreen(final DisplayInfo displayInfo) {
@@ -1451,8 +1451,8 @@ final class WindowState implements WindowManagerPolicy.WindowState {
        disposeInputChannel();

        if (isChildWindow()) {
            if (DEBUG_ADD_REMOVE) Slog.v(TAG, "Removing " + this + " from " + mAttachedWindow);
            mAttachedWindow.mChildWindows.remove(this);
            if (DEBUG_ADD_REMOVE) Slog.v(TAG, "Removing " + this + " from " + mParentWindow);
            mParentWindow.mChildWindows.remove(this);
        }
        mWinAnimator.destroyDeferredSurfaceLocked();
        mWinAnimator.destroySurfaceLocked();
@@ -2170,7 +2170,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
        // Attached windows are evaluated based on the window that they are attached to.
        WindowState win = this;
        while (win.isChildWindow()) {
            win = win.mAttachedWindow;
            win = win.mParentWindow;
        }
        if (win.mAttrs.type < WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW
                && win.mAppToken != null && win.mAppToken.showForAllUsers) {
@@ -2549,7 +2549,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
                    pw.print(" h="); pw.println(mLastRequestedHeight);
        }
        if (isChildWindow() || mLayoutAttached) {
            pw.print(prefix); pw.print("mAttachedWindow="); pw.print(mAttachedWindow);
            pw.print(prefix); pw.print("mParentWindow="); pw.print(mParentWindow);
                    pw.print(" mLayoutAttached="); pw.println(mLayoutAttached);
        }
        if (mIsImWindow || mIsWallpaper || mIsFloatingLayer) {
@@ -2838,7 +2838,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
    }

    boolean isChildWindow() {
        return mAttachedWindow != null;
        return mParentWindow != null;
    }

    boolean layoutInParentFrame() {
Loading