Merge "Don't override child task bounds when rotation changed" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-02-05 00:00:10 +00:00
committed by Android (Google) Code Review
2 changed files with 3 additions and 35 deletions

View File

@@ -2319,12 +2319,9 @@ class Task extends WindowContainer<WindowContainer> {
return;
}
final boolean windowingModeChanged = prevWindowingMode != getWindowingMode();
final int overrideWindowingMode = getRequestedOverrideWindowingMode();
// Update bounds if applicable
boolean hasNewOverrideBounds = false;
// Use override windowing mode to prevent extra bounds changes if inheriting the mode.
if ((overrideWindowingMode != WINDOWING_MODE_PINNED)
final int overrideWindowingMode = getRequestedOverrideWindowingMode();
if (overrideWindowingMode != WINDOWING_MODE_PINNED
&& !getRequestedOverrideBounds().isEmpty()) {
// If the parent (display) has rotated, rotate our bounds to best-fit where their
// bounds were on the pre-rotated display.
@@ -2334,22 +2331,10 @@ class Task extends WindowContainer<WindowContainer> {
mDisplayContent.rotateBounds(
newParentConfig.windowConfiguration.getBounds(), prevRotation, newRotation,
newBounds);
hasNewOverrideBounds = true;
setBounds(newBounds);
}
}
if (windowingModeChanged) {
taskDisplayArea.onRootTaskWindowingModeChanged(this);
}
if (hasNewOverrideBounds) {
if (inSplitScreenWindowingMode()) {
setBounds(newBounds);
} else if (overrideWindowingMode != WINDOWING_MODE_PINNED) {
// For root pinned task, resize is now part of the {@link
// WindowContainerTransaction}
resize(new Rect(newBounds), PRESERVE_WINDOWS, true /* deferResume */);
}
}
if (prevIsAlwaysOnTop != isAlwaysOnTop()) {
// Since always on top is only on when the root task is freeform or pinned, the state
// can be toggled when the windowing mode changes. We must make sure the root task is

View File

@@ -416,11 +416,7 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
new Configuration(container.getRequestedOverrideConfiguration());
c.setTo(change.getConfiguration(), configMask, windowMask);
container.onRequestedOverrideConfigurationChanged(c);
// TODO(b/145675353): remove the following once we could apply new bounds to the
// root pinned task together with its children.
}
resizeRootPinnedTaskIfNeeded(container, configMask, windowMask,
container.getRequestedOverrideConfiguration());
effects |= TRANSACT_EFFECTS_CLIENT_CONFIG;
}
if ((change.getChangeMask() & WindowContainerTransaction.Change.CHANGE_FOCUSABLE) != 0) {
@@ -670,19 +666,6 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
return effects;
}
private void resizeRootPinnedTaskIfNeeded(ConfigurationContainer container, int configMask,
int windowMask, Configuration config) {
if ((container instanceof Task)
&& ((configMask & ActivityInfo.CONFIG_WINDOW_CONFIGURATION) != 0)
&& ((windowMask & WindowConfiguration.WINDOW_CONFIG_BOUNDS) != 0)) {
final Task rootTask = (Task) container;
if (rootTask.inPinnedWindowingMode()) {
rootTask.resize(config.windowConfiguration.getBounds(),
PRESERVE_WINDOWS, true /* deferResume */);
}
}
}
@Override
public ITaskOrganizerController getTaskOrganizerController() {
enforceTaskPermission("getTaskOrganizerController()");