Loading services/core/java/com/android/server/wm/WallpaperController.java +7 −6 Original line number Diff line number Diff line Loading @@ -659,12 +659,13 @@ class WallpaperController { // AND any starting window associated with it, AND below the // maximum layer the policy allows for wallpapers. while (wallpaperTargetIndex > 0) { WindowState wb = windows.get(wallpaperTargetIndex - 1); if (wb.mBaseLayer < maxLayer && wb.mParentWindow != wallpaperTarget && (wallpaperTarget.mParentWindow == null || wb.mParentWindow != wallpaperTarget.mParentWindow) && (wb.mAttrs.type != TYPE_APPLICATION_STARTING final WindowState wb = windows.get(wallpaperTargetIndex - 1); final WindowState wbParentWindow = wb.getParentWindow(); final WindowState wallpaperParentWindow = wallpaperTarget.getParentWindow(); if (wb.mBaseLayer < maxLayer && wbParentWindow != wallpaperTarget && (wallpaperParentWindow == null || wbParentWindow != wallpaperParentWindow) && (wb.mAttrs.type != TYPE_APPLICATION_STARTING || wallpaperTarget.mToken == null || wb.mToken != wallpaperTarget.mToken)) { // This window is not related to the previous one in any Loading services/core/java/com/android/server/wm/WindowManagerService.java +11 −16 Original line number Diff line number Diff line Loading @@ -1353,18 +1353,17 @@ public class WindowManagerService extends IWindowManager.Stub mWindowsChanged = true; } private void addAttachedWindowToListLocked(final WindowState win, boolean addToToken) { private void addChildWindowToListLocked(final WindowState win, boolean addToToken) { final WindowToken token = win.mToken; final DisplayContent displayContent = win.getDisplayContent(); if (displayContent == null) { return; } final WindowState attached = win.mParentWindow; final WindowState parentWindow = win.getParentWindow(); WindowList tokenWindowList = getTokenWindowsOnDisplay(token, displayContent); // Figure out this window's ordering relative to the window // it is attached to. // Figure out this window's ordering relative to the parent window. final int NA = tokenWindowList.size(); final int sublayer = win.mSubLayer; int largestSublayer = Integer.MIN_VALUE; Loading @@ -1378,19 +1377,17 @@ public class WindowManagerService extends IWindowManager.Stub windowWithLargestSublayer = w; } if (sublayer < 0) { // For negative sublayers, we go below all windows // in the same sublayer. // For negative sublayers, we go below all windows in the same sublayer. if (wSublayer >= sublayer) { if (addToToken) { if (DEBUG_ADD_REMOVE) Slog.v(TAG_WM, "Adding " + win + " to " + token); token.windows.add(i, win); } placeWindowBefore(wSublayer >= 0 ? attached : w, win); placeWindowBefore(wSublayer >= 0 ? parentWindow : w, win); break; } } else { // For positive sublayers, we go above all windows // in the same sublayer. // For positive sublayers, we go above all windows in the same sublayer. if (wSublayer > sublayer) { if (addToToken) { if (DEBUG_ADD_REMOVE) Slog.v(TAG_WM, "Adding " + win + " to " + token); Loading @@ -1407,12 +1404,10 @@ public class WindowManagerService extends IWindowManager.Stub token.windows.add(win); } if (sublayer < 0) { placeWindowBefore(attached, win); placeWindowBefore(parentWindow, win); } else { placeWindowAfter(largestSublayer >= 0 ? windowWithLargestSublayer : attached, win); placeWindowAfter( largestSublayer >= 0 ? windowWithLargestSublayer : parentWindow, win); } } } Loading @@ -1433,7 +1428,7 @@ public class WindowManagerService extends IWindowManager.Stub token.windows.add(tokenWindowsPos, win); } } else { addAttachedWindowToListLocked(win, addToToken); addChildWindowToListLocked(win, addToToken); } final AppWindowToken appToken = win.mAppToken; Loading Loading @@ -1684,7 +1679,7 @@ public class WindowManagerService extends IWindowManager.Stub if (mInputMethodWindow != null) { while (pos < windows.size()) { WindowState wp = windows.get(pos); if (wp == mInputMethodWindow || wp.mParentWindow == mInputMethodWindow) { if (wp == mInputMethodWindow || wp.getParentWindow() == mInputMethodWindow) { pos++; continue; } Loading services/core/java/com/android/server/wm/WindowState.java +19 −17 Original line number Diff line number Diff line Loading @@ -160,7 +160,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 mParentWindow; private final WindowState mParentWindow; private final WindowList mChildWindows = new WindowList(); final int mBaseLayer; final int mSubLayer; Loading Loading @@ -341,8 +341,6 @@ final class WindowState implements WindowManagerPolicy.WindowState { */ final Rect mInsetFrame = new Rect(); private static final Rect sTmpRect = new Rect(); boolean mContentChanged; // If a window showing a wallpaper: the requested offset for the Loading Loading @@ -619,10 +617,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { mIsFloatingLayer = mIsImWindow || mIsWallpaper; } WindowState appWin = this; while (appWin.isChildWindow()) { appWin = appWin.mParentWindow; } final WindowState appWin = getTopParentWindow(); WindowToken appToken = appWin.mToken; while (appToken.appWindowToken == null) { WindowToken parent = mService.mTokenMap.get(appToken.token); Loading Loading @@ -1048,11 +1043,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { @Override public int getBaseType() { WindowState win = this; while (win.isChildWindow()) { win = win.mParentWindow; } return win.mAttrs.type; return getTopParentWindow().mAttrs.type; } @Override Loading Loading @@ -2187,11 +2178,8 @@ final class WindowState implements WindowManagerPolicy.WindowState { } boolean isHiddenFromUserLocked() { // Attached windows are evaluated based on the window that they are attached to. WindowState win = this; while (win.isChildWindow()) { win = win.mParentWindow; } // Child windows are evaluated based on their parent window. final WindowState win = getTopParentWindow(); if (win.mAttrs.type < WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW && win.mAppToken != null && win.mAppToken.showForAllUsers) { Loading Loading @@ -2883,6 +2871,20 @@ final class WindowState implements WindowManagerPolicy.WindowState { return isChildWindow() && (mAttrs.privateFlags & PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME) != 0; } /** Returns the parent window if this is a child of another window, else null. */ WindowState getParentWindow() { return mParentWindow; } /** Returns the topmost parent window if this is a child of another window, else this. */ WindowState getTopParentWindow() { WindowState w = this; while (w.isChildWindow()) { w = w.getParentWindow(); } return w; } boolean isParentWindowHidden() { return (mParentWindow != null) ? mParentWindow.mHidden : false; } Loading services/core/java/com/android/server/wm/WindowStateAnimator.java +8 −8 Original line number Diff line number Diff line Loading @@ -258,7 +258,7 @@ class WindowStateAnimator { } mWin = win; mParentWinAnimator = !win.isChildWindow() ? null : win.mParentWindow.mWinAnimator; mParentWinAnimator = !win.isChildWindow() ? null : win.getParentWindow().mWinAnimator; mAppAnimator = win.mAppToken == null ? null : win.mAppToken.mAppAnimator; mSession = win.mSession; mAttrType = win.mAttrs.type; Loading Loading @@ -1080,7 +1080,7 @@ class WindowStateAnimator { // Initialize the decor rect to the entire frame. if (w.isDockedResizing() || (w.isChildWindow() && w.mParentWindow.isDockedResizing())) { (w.isChildWindow() && w.getParentWindow().isDockedResizing())) { // If we are resizing with the divider, the task bounds might be smaller than the // stack bounds. The system decor is used to clip to the task bounds, which we don't Loading Loading @@ -1883,8 +1883,7 @@ class WindowStateAnimator { mDeferTransactionUntilFrame = frameNumber; mDeferTransactionTime = System.currentTimeMillis(); mSurfaceController.deferTransactionUntil( mWin.mParentWindow.mWinAnimator.mSurfaceController.getHandle(), frameNumber); mWin.getParentWindow().mWinAnimator.mSurfaceController.getHandle(), frameNumber); } // Defer the current transaction to the frame number of the last saved transaction. Loading @@ -1903,7 +1902,7 @@ class WindowStateAnimator { mDeferTransactionUntilFrame = -1; } else { mSurfaceController.deferTransactionUntil( mWin.mParentWindow.mWinAnimator.mSurfaceController.getHandle(), mWin.getParentWindow().mWinAnimator.mSurfaceController.getHandle(), mDeferTransactionUntilFrame); } } Loading Loading @@ -1989,8 +1988,9 @@ class WindowStateAnimator { frameRect.set(x, y, x + width, y + height); transform.mapRect(frameRect); w.mAttrs.x = (int) frameRect.left - w.mParentWindow.mFrame.left; w.mAttrs.y = (int) frameRect.top - w.mParentWindow.mFrame.top; final Rect parentWindowFrame = w.getParentWindow().mFrame; w.mAttrs.x = (int) frameRect.left - parentWindowFrame.left; w.mAttrs.y = (int) frameRect.top - parentWindowFrame.top; w.mAttrs.width = (int) Math.ceil(frameRect.width()); w.mAttrs.height = (int) Math.ceil(frameRect.height()); Loading services/core/java/com/android/server/wm/WindowSurfacePlacer.java +3 −3 Original line number Diff line number Diff line Loading @@ -663,8 +663,8 @@ class WindowSurfacePlacer { for (int i = windows.size() - 1; i >= 0; i--) { WindowState w = windows.get(i); if (w.mHasSurface) { mService.mPolicy.applyPostLayoutPolicyLw(w, w.mAttrs, w.mParentWindow); mService.mPolicy.applyPostLayoutPolicyLw( w, w.mAttrs, w.getParentWindow()); } } displayContent.pendingLayoutChanges |= Loading Loading @@ -1040,7 +1040,7 @@ class WindowSurfacePlacer { } win.mLayoutNeeded = false; win.prelayout(); mService.mPolicy.layoutWindowLw(win, win.mParentWindow); mService.mPolicy.layoutWindowLw(win, win.getParentWindow()); win.mLayoutSeq = seq; if (DEBUG_LAYOUT) Slog.v(TAG, " LAYOUT: mFrame=" + win.mFrame + " mContainingFrame=" Loading Loading
services/core/java/com/android/server/wm/WallpaperController.java +7 −6 Original line number Diff line number Diff line Loading @@ -659,12 +659,13 @@ class WallpaperController { // AND any starting window associated with it, AND below the // maximum layer the policy allows for wallpapers. while (wallpaperTargetIndex > 0) { WindowState wb = windows.get(wallpaperTargetIndex - 1); if (wb.mBaseLayer < maxLayer && wb.mParentWindow != wallpaperTarget && (wallpaperTarget.mParentWindow == null || wb.mParentWindow != wallpaperTarget.mParentWindow) && (wb.mAttrs.type != TYPE_APPLICATION_STARTING final WindowState wb = windows.get(wallpaperTargetIndex - 1); final WindowState wbParentWindow = wb.getParentWindow(); final WindowState wallpaperParentWindow = wallpaperTarget.getParentWindow(); if (wb.mBaseLayer < maxLayer && wbParentWindow != wallpaperTarget && (wallpaperParentWindow == null || wbParentWindow != wallpaperParentWindow) && (wb.mAttrs.type != TYPE_APPLICATION_STARTING || wallpaperTarget.mToken == null || wb.mToken != wallpaperTarget.mToken)) { // This window is not related to the previous one in any Loading
services/core/java/com/android/server/wm/WindowManagerService.java +11 −16 Original line number Diff line number Diff line Loading @@ -1353,18 +1353,17 @@ public class WindowManagerService extends IWindowManager.Stub mWindowsChanged = true; } private void addAttachedWindowToListLocked(final WindowState win, boolean addToToken) { private void addChildWindowToListLocked(final WindowState win, boolean addToToken) { final WindowToken token = win.mToken; final DisplayContent displayContent = win.getDisplayContent(); if (displayContent == null) { return; } final WindowState attached = win.mParentWindow; final WindowState parentWindow = win.getParentWindow(); WindowList tokenWindowList = getTokenWindowsOnDisplay(token, displayContent); // Figure out this window's ordering relative to the window // it is attached to. // Figure out this window's ordering relative to the parent window. final int NA = tokenWindowList.size(); final int sublayer = win.mSubLayer; int largestSublayer = Integer.MIN_VALUE; Loading @@ -1378,19 +1377,17 @@ public class WindowManagerService extends IWindowManager.Stub windowWithLargestSublayer = w; } if (sublayer < 0) { // For negative sublayers, we go below all windows // in the same sublayer. // For negative sublayers, we go below all windows in the same sublayer. if (wSublayer >= sublayer) { if (addToToken) { if (DEBUG_ADD_REMOVE) Slog.v(TAG_WM, "Adding " + win + " to " + token); token.windows.add(i, win); } placeWindowBefore(wSublayer >= 0 ? attached : w, win); placeWindowBefore(wSublayer >= 0 ? parentWindow : w, win); break; } } else { // For positive sublayers, we go above all windows // in the same sublayer. // For positive sublayers, we go above all windows in the same sublayer. if (wSublayer > sublayer) { if (addToToken) { if (DEBUG_ADD_REMOVE) Slog.v(TAG_WM, "Adding " + win + " to " + token); Loading @@ -1407,12 +1404,10 @@ public class WindowManagerService extends IWindowManager.Stub token.windows.add(win); } if (sublayer < 0) { placeWindowBefore(attached, win); placeWindowBefore(parentWindow, win); } else { placeWindowAfter(largestSublayer >= 0 ? windowWithLargestSublayer : attached, win); placeWindowAfter( largestSublayer >= 0 ? windowWithLargestSublayer : parentWindow, win); } } } Loading @@ -1433,7 +1428,7 @@ public class WindowManagerService extends IWindowManager.Stub token.windows.add(tokenWindowsPos, win); } } else { addAttachedWindowToListLocked(win, addToToken); addChildWindowToListLocked(win, addToToken); } final AppWindowToken appToken = win.mAppToken; Loading Loading @@ -1684,7 +1679,7 @@ public class WindowManagerService extends IWindowManager.Stub if (mInputMethodWindow != null) { while (pos < windows.size()) { WindowState wp = windows.get(pos); if (wp == mInputMethodWindow || wp.mParentWindow == mInputMethodWindow) { if (wp == mInputMethodWindow || wp.getParentWindow() == mInputMethodWindow) { pos++; continue; } Loading
services/core/java/com/android/server/wm/WindowState.java +19 −17 Original line number Diff line number Diff line Loading @@ -160,7 +160,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 mParentWindow; private final WindowState mParentWindow; private final WindowList mChildWindows = new WindowList(); final int mBaseLayer; final int mSubLayer; Loading Loading @@ -341,8 +341,6 @@ final class WindowState implements WindowManagerPolicy.WindowState { */ final Rect mInsetFrame = new Rect(); private static final Rect sTmpRect = new Rect(); boolean mContentChanged; // If a window showing a wallpaper: the requested offset for the Loading Loading @@ -619,10 +617,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { mIsFloatingLayer = mIsImWindow || mIsWallpaper; } WindowState appWin = this; while (appWin.isChildWindow()) { appWin = appWin.mParentWindow; } final WindowState appWin = getTopParentWindow(); WindowToken appToken = appWin.mToken; while (appToken.appWindowToken == null) { WindowToken parent = mService.mTokenMap.get(appToken.token); Loading Loading @@ -1048,11 +1043,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { @Override public int getBaseType() { WindowState win = this; while (win.isChildWindow()) { win = win.mParentWindow; } return win.mAttrs.type; return getTopParentWindow().mAttrs.type; } @Override Loading Loading @@ -2187,11 +2178,8 @@ final class WindowState implements WindowManagerPolicy.WindowState { } boolean isHiddenFromUserLocked() { // Attached windows are evaluated based on the window that they are attached to. WindowState win = this; while (win.isChildWindow()) { win = win.mParentWindow; } // Child windows are evaluated based on their parent window. final WindowState win = getTopParentWindow(); if (win.mAttrs.type < WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW && win.mAppToken != null && win.mAppToken.showForAllUsers) { Loading Loading @@ -2883,6 +2871,20 @@ final class WindowState implements WindowManagerPolicy.WindowState { return isChildWindow() && (mAttrs.privateFlags & PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME) != 0; } /** Returns the parent window if this is a child of another window, else null. */ WindowState getParentWindow() { return mParentWindow; } /** Returns the topmost parent window if this is a child of another window, else this. */ WindowState getTopParentWindow() { WindowState w = this; while (w.isChildWindow()) { w = w.getParentWindow(); } return w; } boolean isParentWindowHidden() { return (mParentWindow != null) ? mParentWindow.mHidden : false; } Loading
services/core/java/com/android/server/wm/WindowStateAnimator.java +8 −8 Original line number Diff line number Diff line Loading @@ -258,7 +258,7 @@ class WindowStateAnimator { } mWin = win; mParentWinAnimator = !win.isChildWindow() ? null : win.mParentWindow.mWinAnimator; mParentWinAnimator = !win.isChildWindow() ? null : win.getParentWindow().mWinAnimator; mAppAnimator = win.mAppToken == null ? null : win.mAppToken.mAppAnimator; mSession = win.mSession; mAttrType = win.mAttrs.type; Loading Loading @@ -1080,7 +1080,7 @@ class WindowStateAnimator { // Initialize the decor rect to the entire frame. if (w.isDockedResizing() || (w.isChildWindow() && w.mParentWindow.isDockedResizing())) { (w.isChildWindow() && w.getParentWindow().isDockedResizing())) { // If we are resizing with the divider, the task bounds might be smaller than the // stack bounds. The system decor is used to clip to the task bounds, which we don't Loading Loading @@ -1883,8 +1883,7 @@ class WindowStateAnimator { mDeferTransactionUntilFrame = frameNumber; mDeferTransactionTime = System.currentTimeMillis(); mSurfaceController.deferTransactionUntil( mWin.mParentWindow.mWinAnimator.mSurfaceController.getHandle(), frameNumber); mWin.getParentWindow().mWinAnimator.mSurfaceController.getHandle(), frameNumber); } // Defer the current transaction to the frame number of the last saved transaction. Loading @@ -1903,7 +1902,7 @@ class WindowStateAnimator { mDeferTransactionUntilFrame = -1; } else { mSurfaceController.deferTransactionUntil( mWin.mParentWindow.mWinAnimator.mSurfaceController.getHandle(), mWin.getParentWindow().mWinAnimator.mSurfaceController.getHandle(), mDeferTransactionUntilFrame); } } Loading Loading @@ -1989,8 +1988,9 @@ class WindowStateAnimator { frameRect.set(x, y, x + width, y + height); transform.mapRect(frameRect); w.mAttrs.x = (int) frameRect.left - w.mParentWindow.mFrame.left; w.mAttrs.y = (int) frameRect.top - w.mParentWindow.mFrame.top; final Rect parentWindowFrame = w.getParentWindow().mFrame; w.mAttrs.x = (int) frameRect.left - parentWindowFrame.left; w.mAttrs.y = (int) frameRect.top - parentWindowFrame.top; w.mAttrs.width = (int) Math.ceil(frameRect.width()); w.mAttrs.height = (int) Math.ceil(frameRect.height()); Loading
services/core/java/com/android/server/wm/WindowSurfacePlacer.java +3 −3 Original line number Diff line number Diff line Loading @@ -663,8 +663,8 @@ class WindowSurfacePlacer { for (int i = windows.size() - 1; i >= 0; i--) { WindowState w = windows.get(i); if (w.mHasSurface) { mService.mPolicy.applyPostLayoutPolicyLw(w, w.mAttrs, w.mParentWindow); mService.mPolicy.applyPostLayoutPolicyLw( w, w.mAttrs, w.getParentWindow()); } } displayContent.pendingLayoutChanges |= Loading Loading @@ -1040,7 +1040,7 @@ class WindowSurfacePlacer { } win.mLayoutNeeded = false; win.prelayout(); mService.mPolicy.layoutWindowLw(win, win.mParentWindow); mService.mPolicy.layoutWindowLw(win, win.getParentWindow()); win.mLayoutSeq = seq; if (DEBUG_LAYOUT) Slog.v(TAG, " LAYOUT: mFrame=" + win.mFrame + " mContainingFrame=" Loading