diff --git a/core/proto/android/server/windowmanagerservice.proto b/core/proto/android/server/windowmanagerservice.proto index ec502c3c272fd..f26bf7cdb6c1d 100644 --- a/core/proto/android/server/windowmanagerservice.proto +++ b/core/proto/android/server/windowmanagerservice.proto @@ -337,7 +337,7 @@ message ActivityRecordProto { optional bool starting_displayed = 20; optional bool starting_moved = 201; optional bool visible_set_from_transferred_starting_window = 22; - repeated .android.graphics.RectProto frozen_bounds = 23; + repeated .android.graphics.RectProto frozen_bounds = 23 [deprecated=true]; optional bool visible = 24; reserved 25; // configuration_container optional IdentifierProto identifier = 26 [deprecated=true]; diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 33abcb478c777..dd5a19669f745 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -132,7 +132,6 @@ import static com.android.server.wm.ActivityRecordProto.CLIENT_VISIBLE; import static com.android.server.wm.ActivityRecordProto.DEFER_HIDING_CLIENT; import static com.android.server.wm.ActivityRecordProto.FILLS_PARENT; import static com.android.server.wm.ActivityRecordProto.FRONT_OF_TASK; -import static com.android.server.wm.ActivityRecordProto.FROZEN_BOUNDS; import static com.android.server.wm.ActivityRecordProto.IS_ANIMATING; import static com.android.server.wm.ActivityRecordProto.IS_WAITING_FOR_TRANSITION_START; import static com.android.server.wm.ActivityRecordProto.LAST_ALL_DRAWN; @@ -344,7 +343,6 @@ import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.lang.ref.WeakReference; -import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; @@ -732,9 +730,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // windows, where the app hasn't had time to set a value on the window. int mRotationAnimationHint = -1; - ArrayDeque mFrozenBounds = new ArrayDeque<>(); - ArrayDeque mFrozenMergedConfig = new ArrayDeque<>(); - private AppSaturationInfo mLastAppSaturationInfo; private final ColorDisplayService.ColorTransformController mColorTransformController = @@ -1035,10 +1030,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A pw.println(" mVisibleSetFromTransferredStartingWindow=" + mVisibleSetFromTransferredStartingWindow); } - if (!mFrozenBounds.isEmpty()) { - pw.print(prefix); pw.print("mFrozenBounds="); pw.println(mFrozenBounds); - pw.print(prefix); pw.print("mFrozenMergedConfig="); pw.println(mFrozenMergedConfig); - } if (mPendingRelaunchCount != 0) { pw.print(prefix); pw.print("mPendingRelaunchCount="); pw.println(mPendingRelaunchCount); } @@ -3359,56 +3350,18 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return mPendingRelaunchCount > 0; } - boolean shouldFreezeBounds() { - // For freeform windows, we can't freeze the bounds at the moment because this would make - // the resizing unresponsive. - if (task == null || task.inFreeformWindowingMode()) { - return false; - } - - // We freeze the bounds while drag resizing to deal with the time between - // the divider/drag handle being released, and the handling it's new - // configuration. If we are relaunched outside of the drag resizing state, - // we need to be careful not to do this. - return task.isDragResizing(); - } - @VisibleForTesting void startRelaunching() { if (mPendingRelaunchCount == 0) { mRelaunchStartTime = SystemClock.elapsedRealtime(); } - if (shouldFreezeBounds()) { - freezeBounds(); - } - clearAllDrawn(); mPendingRelaunchCount++; } - /** - * Freezes the task bounds. The size of this task reported the app will be fixed to the bounds - * freezed by {@link Task#prepareFreezingBounds} until {@link #unfreezeBounds} gets called, even - * if they change in the meantime. If the bounds are already frozen, the bounds will be frozen - * with a queue. - */ - private void freezeBounds() { - mFrozenBounds.offer(new Rect(task.mPreparedFrozenBounds)); - - if (task.mPreparedFrozenMergedConfig.equals(Configuration.EMPTY)) { - // We didn't call prepareFreezingBounds on the task, so use the current value. - mFrozenMergedConfig.offer(new Configuration(task.getConfiguration())); - } else { - mFrozenMergedConfig.offer(new Configuration(task.mPreparedFrozenMergedConfig)); - } - // Calling unset() to make it equal to Configuration.EMPTY. - task.mPreparedFrozenMergedConfig.unset(); - } - void finishRelaunching() { mTaskSupervisor.getActivityMetricsLogger().notifyActivityRelaunched(this); - unfreezeBounds(); if (mPendingRelaunchCount > 0) { mPendingRelaunchCount--; @@ -3430,29 +3383,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (mPendingRelaunchCount == 0) { return; } - unfreezeBounds(); mPendingRelaunchCount = 0; mRelaunchStartTime = 0; } - /** - * Unfreezes the previously frozen bounds. See {@link #freezeBounds}. - */ - private void unfreezeBounds() { - if (mFrozenBounds.isEmpty()) { - return; - } - mFrozenBounds.remove(); - if (!mFrozenMergedConfig.isEmpty()) { - mFrozenMergedConfig.remove(); - } - for (int i = mChildren.size() - 1; i >= 0; i--) { - final WindowState win = mChildren.get(i); - win.onUnfreezeBounds(); - } - mWmService.mWindowPlacerLocked.performSurfacePlacement(); - } - /** * Perform clean-up of service connections in an activity record. */ @@ -8214,9 +8148,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A proto.write(STARTING_MOVED, startingMoved); proto.write(VISIBLE_SET_FROM_TRANSFERRED_STARTING_WINDOW, mVisibleSetFromTransferredStartingWindow); - for (Rect bounds : mFrozenBounds) { - bounds.dumpDebug(proto, FROZEN_BOUNDS); - } proto.write(STATE, mState.toString()); proto.write(FRONT_OF_TASK, isRootOfTask()); diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java index a874dee2c7682..0c77d9f1f7248 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java @@ -4042,17 +4042,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { int updateGlobalConfigurationLocked(@NonNull Configuration values, boolean initLocale, boolean persistent, int userId) { - final DisplayContent defaultDisplay = - mRootWindowContainer.getDisplayContent(DEFAULT_DISPLAY); - mTempConfig.setTo(getGlobalConfiguration()); final int changes = mTempConfig.updateFrom(values); if (changes == 0) { - // Since calling to Activity.setRequestedOrientation leads to freezing the window with - // setting WindowManagerService.mWaitingForConfig to true, it is important that we call - // performDisplayOverrideConfigUpdate in order to send the new display configuration - // (even if there are no actual changes) to unfreeze the window. - defaultDisplay.performDisplayOverrideConfigUpdate(values); return 0; } diff --git a/services/core/java/com/android/server/wm/ConfigurationContainer.java b/services/core/java/com/android/server/wm/ConfigurationContainer.java index 309b5ec25f0ff..62a00802896f2 100644 --- a/services/core/java/com/android/server/wm/ConfigurationContainer.java +++ b/services/core/java/com/android/server/wm/ConfigurationContainer.java @@ -141,14 +141,17 @@ public abstract class ConfigurationContainer { mChangeListeners.get(i).onMergedOverrideConfigurationChanged( mMergedOverrideConfiguration); } - dispatchConfigurationToChildren(); + for (int i = getChildCount() - 1; i >= 0; --i) { + dispatchConfigurationToChild(getChildAt(i), mFullConfiguration); + } } - void dispatchConfigurationToChildren() { - for (int i = getChildCount() - 1; i >= 0; --i) { - final ConfigurationContainer child = getChildAt(i); - child.onConfigurationChanged(mFullConfiguration); - } + /** + * Dispatches the configuration to child when {@link #onConfigurationChanged(Configuration)} is + * called. This allows the derived classes to override how to dispatch the configuration. + */ + void dispatchConfigurationToChild(E child, Configuration config) { + child.onConfigurationChanged(config); } /** diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index eff4ea6536bd2..9d5c5bed04195 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -2943,10 +2943,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp return dockFrame.bottom - imeFrame.top; } - void prepareFreezingTaskBounds() { - forAllRootTasks(Task::prepareFreezingTaskBounds); - } - void rotateBounds(@Rotation int oldRotation, @Rotation int newRotation, Rect inOutBounds) { // Get display bounds on oldRotation as parent bounds for the rotation. getBounds(mTmpRect, oldRotation); diff --git a/services/core/java/com/android/server/wm/RootWindowContainer.java b/services/core/java/com/android/server/wm/RootWindowContainer.java index 3f9ea1fd2afd7..0e8cadbcbcdde 100644 --- a/services/core/java/com/android/server/wm/RootWindowContainer.java +++ b/services/core/java/com/android/server/wm/RootWindowContainer.java @@ -650,28 +650,12 @@ class RootWindowContainer extends WindowContainer } @Override - void dispatchConfigurationToChildren() { - final Configuration configuration = getConfiguration(); - for (int i = getChildCount() - 1; i >= 0; i--) { - final DisplayContent displayContent = getChildAt(i); - if (displayContent.isDefaultDisplay) { - // The global configuration is also the override configuration of default display. - displayContent.performDisplayOverrideConfigUpdate(configuration); - } else { - displayContent.onConfigurationChanged(configuration); - } - } - } - - @Override - public void onConfigurationChanged(Configuration newParentConfig) { - prepareFreezingTaskBounds(); - super.onConfigurationChanged(newParentConfig); - } - - private void prepareFreezingTaskBounds() { - for (int i = mChildren.size() - 1; i >= 0; i--) { - mChildren.get(i).prepareFreezingTaskBounds(); + void dispatchConfigurationToChild(DisplayContent child, Configuration config) { + if (child.isDefaultDisplay) { + // The global configuration is also the override configuration of default display. + child.performDisplayOverrideConfigUpdate(config); + } else { + child.onConfigurationChanged(config); } } diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index 68f5c58b4761d..5efbb0956823b 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -498,9 +498,6 @@ class Task extends WindowContainer { // TODO: Make final int mUserId; - final Rect mPreparedFrozenBounds = new Rect(); - final Configuration mPreparedFrozenMergedConfig = new Configuration(); - // Id of the previous display the root task was on. int mPrevDisplayId = INVALID_DISPLAY; @@ -1182,10 +1179,6 @@ class Task extends WindowContainer { mTaskSupervisor.mNoAnimActivities.add(topActivity); } - // We might trigger a configuration change. Save the current task bounds for freezing. - // TODO: Should this call be moved inside the resize method in WM? - toRootTask.prepareFreezingTaskBounds(); - if (toRootTaskWindowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY && moveRootTaskMode == REPARENT_KEEP_ROOT_TASK_AT_FRONT) { // Move recents to front so it is not behind root home task when going into docked @@ -3363,15 +3356,6 @@ class Task extends WindowContainer { return isResizeable(); } - /** - * Prepares the task bounds to be frozen with the current size. See - * {@link ActivityRecord#freezeBounds}. - */ - void prepareFreezingBounds() { - mPreparedFrozenBounds.set(getBounds()); - mPreparedFrozenMergedConfig.setTo(getConfiguration()); - } - @Override void getAnimationFrames(Rect outFrame, Rect outInsets, Rect outStableInsets, Rect outSurfaceInsets) { @@ -7503,10 +7487,6 @@ class Task extends WindowContainer { }); } - void prepareFreezingTaskBounds() { - forAllLeafTasks(Task::prepareFreezingBounds, true /* traverseTopToBottom */); - } - private int setBounds(Rect existing, Rect bounds) { if (equivalentBounds(existing, bounds)) { return BOUNDS_CHANGE_NONE; diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 2a9e08e90e981..a35f4dea643a7 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -1190,16 +1190,6 @@ class WindowState extends WindowContainer implements WindowManagerP layoutYDiff = 0; } else { windowFrames.mContainingFrame.set(getBounds()); - if (mActivityRecord != null && !mActivityRecord.mFrozenBounds.isEmpty()) { - - // If the bounds are frozen, we still want to translate the window freely and only - // freeze the size. - Rect frozen = mActivityRecord.mFrozenBounds.peek(); - windowFrames.mContainingFrame.right = - windowFrames.mContainingFrame.left + frozen.width(); - windowFrames.mContainingFrame.bottom = - windowFrames.mContainingFrame.top + frozen.height(); - } // IME is up and obscuring this window. Adjust the window position so it is visible. if (isImeTarget) { if (inFreeformWindowingMode()) { @@ -2068,23 +2058,6 @@ class WindowState extends WindowContainer implements WindowManagerP super.onResize(); } - void onUnfreezeBounds() { - for (int i = mChildren.size() - 1; i >= 0; --i) { - final WindowState c = mChildren.get(i); - c.onUnfreezeBounds(); - } - - if (!mHasSurface) { - return; - } - - mLayoutNeeded = true; - setDisplayLayoutNeeded(); - if (!mWmService.mResizingWindows.contains(this)) { - mWmService.mResizingWindows.add(this); - } - } - /** * If the window has moved due to its containing content frame changing, then notify the * listeners and optionally animate it. Simply checking a change of position is not enough, @@ -3579,10 +3552,6 @@ class WindowState extends WindowContainer implements WindowManagerP @Override public Configuration getConfiguration() { - if (mActivityRecord != null && mActivityRecord.mFrozenMergedConfig.size() > 0) { - return mActivityRecord.mFrozenMergedConfig.peek(); - } - // If the process has not registered to any display area to listen to the configuration // change, we can simply return the mFullConfiguration as default. if (!registeredForDisplayAreaConfigChanges()) { @@ -3944,14 +3913,8 @@ class WindowState extends WindowContainer implements WindowManagerP return true; } - // If the bounds are currently frozen, it means that the layout size that the app sees - // and the bounds we clip this window to might be different. In order to avoid holes, we - // simulate that we are still resizing so the app fills the hole with the resizing - // background. - return (getDisplayContent().mDividerControllerLocked.isResizing() - || mActivityRecord != null && !mActivityRecord.mFrozenBounds.isEmpty()) && - !task.inFreeformWindowingMode() && !isGoneForLayout(); - + return getDisplayContent().mDividerControllerLocked.isResizing() + && !task.inFreeformWindowingMode() && !isGoneForLayout(); } void setDragResizing() {