Loading services/core/java/com/android/server/wm/Task.java +26 −0 Original line number Original line Diff line number Diff line Loading @@ -322,6 +322,32 @@ class Task implements DimLayer.DimLayerUser { mPreparedFrozenBounds.set(mBounds); mPreparedFrozenBounds.set(mBounds); } } /** * Align the task to the adjusted bounds. * * @param adjustedBounds Adjusted bounds to which the task should be aligned. * @param tempInsetBounds Insets bounds for the task. * @param alignBottom True if the task's bottom should be aligned to the adjusted * bounds's bottom; false if the task's top should be aligned * the adjusted bounds's top. */ void alignToAdjustedBounds( Rect adjustedBounds, Rect tempInsetBounds, boolean alignBottom) { if (!isResizeable() || mOverrideConfig == Configuration.EMPTY) { return; } getBounds(mTmpRect2); if (alignBottom) { int offsetY = adjustedBounds.bottom - mTmpRect2.bottom; mTmpRect2.offset(0, offsetY); } else { mTmpRect2.offsetTo(adjustedBounds.left, adjustedBounds.top); } setTempInsetBounds(tempInsetBounds); resizeLocked(mTmpRect2, mOverrideConfig, false /* forced */); } void resetScrollLocked() { void resetScrollLocked() { if (mScrollValid) { if (mScrollValid) { mScrollValid = false; mScrollValid = false; Loading services/core/java/com/android/server/wm/TaskStack.java +16 −13 Original line number Original line Diff line number Diff line Loading @@ -240,7 +240,7 @@ public class TaskStack implements DimLayer.DimLayerUser, Rect insetBounds = null; Rect insetBounds = null; if (adjusted && isAdjustedForMinimizedDock()) { if (adjusted && isAdjustedForMinimizedDock()) { insetBounds = mBounds; insetBounds = mBounds; } else if (adjusted && isAdjustedForIme()) { } else if (adjusted && mAdjustedForIme) { if (mImeGoingAway) { if (mImeGoingAway) { insetBounds = mBounds; insetBounds = mBounds; } else { } else { Loading @@ -264,16 +264,9 @@ public class TaskStack implements DimLayer.DimLayerUser, task.resizeLocked(null, null, false /* forced */); task.resizeLocked(null, null, false /* forced */); task.getBounds(mTmpRect2); task.getBounds(mTmpRect2); task.scrollLocked(mTmpRect2); task.scrollLocked(mTmpRect2); } else if (task.isResizeable() && task.mOverrideConfig != Configuration.EMPTY) { task.getBounds(mTmpRect2); if (mAdjustedForIme && getDockSide() == DOCKED_TOP) { int offsetY = adjustedBounds.bottom - mTmpRect2.bottom; mTmpRect2.offset(0, offsetY); } else { } else { mTmpRect2.offsetTo(adjustedBounds.left, adjustedBounds.top); final boolean alignBottom = mAdjustedForIme && getDockSide() == DOCKED_TOP; } task.alignToAdjustedBounds(adjustedBounds, tempInsetBounds, alignBottom); task.setTempInsetBounds(tempInsetBounds); task.resizeLocked(mTmpRect2, task.mOverrideConfig, false /* forced */); } } } } } } Loading Loading @@ -868,7 +861,7 @@ public class TaskStack implements DimLayer.DimLayerUser, } } boolean isAdjustedForIme() { boolean isAdjustedForIme() { return mAdjustedForIme || mImeGoingAway; return mAdjustedForIme; } } boolean isAnimatingForIme() { boolean isAnimatingForIme() { Loading Loading @@ -1083,7 +1076,7 @@ public class TaskStack implements DimLayer.DimLayerUser, /** /** * Updates the adjustment depending on it's current state. * Updates the adjustment depending on it's current state. */ */ void updateAdjustedBounds() { private void updateAdjustedBounds() { boolean adjust = false; boolean adjust = false; if (mMinimizeAmount != 0f) { if (mMinimizeAmount != 0f) { adjust = adjustForMinimizedDockedStack(mMinimizeAmount); adjust = adjustForMinimizedDockedStack(mMinimizeAmount); Loading @@ -1103,6 +1096,16 @@ public class TaskStack implements DimLayer.DimLayerUser, } } } } void applyAdjustForImeIfNeeded(Task task) { if (mMinimizeAmount != 0f || !mAdjustedForIme || mAdjustedBounds.isEmpty()) { return; } final Rect insetBounds = mImeGoingAway ? mBounds : mFullyAdjustedImeBounds; task.alignToAdjustedBounds(mAdjustedBounds, insetBounds, getDockSide() == DOCKED_TOP); mDisplayContent.layoutNeeded = true; } boolean isAdjustedForMinimizedDockedStack() { boolean isAdjustedForMinimizedDockedStack() { return mMinimizeAmount != 0f; return mMinimizeAmount != 0f; } } Loading services/core/java/com/android/server/wm/WindowManagerService.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -2083,6 +2083,10 @@ public class WindowManagerService extends IWindowManager.Stub // we need to update this new window's scroll position when it's added. // we need to update this new window's scroll position when it's added. win.applyScrollIfNeeded(); win.applyScrollIfNeeded(); // If the window is being added to a stack that's currently adjusted for IME, // make sure to apply the same adjust to this new window. win.applyAdjustForImeIfNeeded(); if (type == TYPE_DOCK_DIVIDER) { if (type == TYPE_DOCK_DIVIDER) { getDefaultDisplayContentLocked().getDockedDividerController().setWindow(win); getDefaultDisplayContentLocked().getDockedDividerController().setWindow(win); } } Loading services/core/java/com/android/server/wm/WindowState.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -1620,6 +1620,13 @@ final class WindowState implements WindowManagerPolicy.WindowState { } } } } void applyAdjustForImeIfNeeded() { final Task task = getTask(); if (task != null && task.mStack != null && task.mStack.isAdjustedForIme()) { task.mStack.applyAdjustForImeIfNeeded(task); } } int getTouchableRegion(Region region, int flags) { int getTouchableRegion(Region region, int flags) { final boolean modal = (flags & (FLAG_NOT_TOUCH_MODAL | FLAG_NOT_FOCUSABLE)) == 0; final boolean modal = (flags & (FLAG_NOT_TOUCH_MODAL | FLAG_NOT_FOCUSABLE)) == 0; if (modal && mAppToken != null) { if (modal && mAppToken != null) { Loading Loading
services/core/java/com/android/server/wm/Task.java +26 −0 Original line number Original line Diff line number Diff line Loading @@ -322,6 +322,32 @@ class Task implements DimLayer.DimLayerUser { mPreparedFrozenBounds.set(mBounds); mPreparedFrozenBounds.set(mBounds); } } /** * Align the task to the adjusted bounds. * * @param adjustedBounds Adjusted bounds to which the task should be aligned. * @param tempInsetBounds Insets bounds for the task. * @param alignBottom True if the task's bottom should be aligned to the adjusted * bounds's bottom; false if the task's top should be aligned * the adjusted bounds's top. */ void alignToAdjustedBounds( Rect adjustedBounds, Rect tempInsetBounds, boolean alignBottom) { if (!isResizeable() || mOverrideConfig == Configuration.EMPTY) { return; } getBounds(mTmpRect2); if (alignBottom) { int offsetY = adjustedBounds.bottom - mTmpRect2.bottom; mTmpRect2.offset(0, offsetY); } else { mTmpRect2.offsetTo(adjustedBounds.left, adjustedBounds.top); } setTempInsetBounds(tempInsetBounds); resizeLocked(mTmpRect2, mOverrideConfig, false /* forced */); } void resetScrollLocked() { void resetScrollLocked() { if (mScrollValid) { if (mScrollValid) { mScrollValid = false; mScrollValid = false; Loading
services/core/java/com/android/server/wm/TaskStack.java +16 −13 Original line number Original line Diff line number Diff line Loading @@ -240,7 +240,7 @@ public class TaskStack implements DimLayer.DimLayerUser, Rect insetBounds = null; Rect insetBounds = null; if (adjusted && isAdjustedForMinimizedDock()) { if (adjusted && isAdjustedForMinimizedDock()) { insetBounds = mBounds; insetBounds = mBounds; } else if (adjusted && isAdjustedForIme()) { } else if (adjusted && mAdjustedForIme) { if (mImeGoingAway) { if (mImeGoingAway) { insetBounds = mBounds; insetBounds = mBounds; } else { } else { Loading @@ -264,16 +264,9 @@ public class TaskStack implements DimLayer.DimLayerUser, task.resizeLocked(null, null, false /* forced */); task.resizeLocked(null, null, false /* forced */); task.getBounds(mTmpRect2); task.getBounds(mTmpRect2); task.scrollLocked(mTmpRect2); task.scrollLocked(mTmpRect2); } else if (task.isResizeable() && task.mOverrideConfig != Configuration.EMPTY) { task.getBounds(mTmpRect2); if (mAdjustedForIme && getDockSide() == DOCKED_TOP) { int offsetY = adjustedBounds.bottom - mTmpRect2.bottom; mTmpRect2.offset(0, offsetY); } else { } else { mTmpRect2.offsetTo(adjustedBounds.left, adjustedBounds.top); final boolean alignBottom = mAdjustedForIme && getDockSide() == DOCKED_TOP; } task.alignToAdjustedBounds(adjustedBounds, tempInsetBounds, alignBottom); task.setTempInsetBounds(tempInsetBounds); task.resizeLocked(mTmpRect2, task.mOverrideConfig, false /* forced */); } } } } } } Loading Loading @@ -868,7 +861,7 @@ public class TaskStack implements DimLayer.DimLayerUser, } } boolean isAdjustedForIme() { boolean isAdjustedForIme() { return mAdjustedForIme || mImeGoingAway; return mAdjustedForIme; } } boolean isAnimatingForIme() { boolean isAnimatingForIme() { Loading Loading @@ -1083,7 +1076,7 @@ public class TaskStack implements DimLayer.DimLayerUser, /** /** * Updates the adjustment depending on it's current state. * Updates the adjustment depending on it's current state. */ */ void updateAdjustedBounds() { private void updateAdjustedBounds() { boolean adjust = false; boolean adjust = false; if (mMinimizeAmount != 0f) { if (mMinimizeAmount != 0f) { adjust = adjustForMinimizedDockedStack(mMinimizeAmount); adjust = adjustForMinimizedDockedStack(mMinimizeAmount); Loading @@ -1103,6 +1096,16 @@ public class TaskStack implements DimLayer.DimLayerUser, } } } } void applyAdjustForImeIfNeeded(Task task) { if (mMinimizeAmount != 0f || !mAdjustedForIme || mAdjustedBounds.isEmpty()) { return; } final Rect insetBounds = mImeGoingAway ? mBounds : mFullyAdjustedImeBounds; task.alignToAdjustedBounds(mAdjustedBounds, insetBounds, getDockSide() == DOCKED_TOP); mDisplayContent.layoutNeeded = true; } boolean isAdjustedForMinimizedDockedStack() { boolean isAdjustedForMinimizedDockedStack() { return mMinimizeAmount != 0f; return mMinimizeAmount != 0f; } } Loading
services/core/java/com/android/server/wm/WindowManagerService.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -2083,6 +2083,10 @@ public class WindowManagerService extends IWindowManager.Stub // we need to update this new window's scroll position when it's added. // we need to update this new window's scroll position when it's added. win.applyScrollIfNeeded(); win.applyScrollIfNeeded(); // If the window is being added to a stack that's currently adjusted for IME, // make sure to apply the same adjust to this new window. win.applyAdjustForImeIfNeeded(); if (type == TYPE_DOCK_DIVIDER) { if (type == TYPE_DOCK_DIVIDER) { getDefaultDisplayContentLocked().getDockedDividerController().setWindow(win); getDefaultDisplayContentLocked().getDockedDividerController().setWindow(win); } } Loading
services/core/java/com/android/server/wm/WindowState.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -1620,6 +1620,13 @@ final class WindowState implements WindowManagerPolicy.WindowState { } } } } void applyAdjustForImeIfNeeded() { final Task task = getTask(); if (task != null && task.mStack != null && task.mStack.isAdjustedForIme()) { task.mStack.applyAdjustForImeIfNeeded(task); } } int getTouchableRegion(Region region, int flags) { int getTouchableRegion(Region region, int flags) { final boolean modal = (flags & (FLAG_NOT_TOUCH_MODAL | FLAG_NOT_FOCUSABLE)) == 0; final boolean modal = (flags & (FLAG_NOT_TOUCH_MODAL | FLAG_NOT_FOCUSABLE)) == 0; if (modal && mAppToken != null) { if (modal && mAppToken != null) { Loading