diff options
2 files changed, 16 insertions, 5 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java index dbff20e6026a..0cacdfc835e6 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java @@ -183,10 +183,20 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin mRelayoutParams.mCaptionHeightId = getCaptionHeightId(); mRelayoutParams.mShadowRadiusId = shadowRadiusID; mRelayoutParams.mApplyStartTransactionOnDraw = applyStartTransactionOnDraw; - - mRelayoutParams.mWindowDecorConfig = DesktopTasksController.isDesktopDensityOverrideSet() - ? mContext.getResources().getConfiguration() // Use system context - : mTaskInfo.configuration; // Use task configuration + // The configuration used to lay out the window decoration. The system context's config is + // used when the task density has been overridden to a custom density so that the resources + // and views of the decoration aren't affected and match the rest of the System UI, if not + // then just use the task's configuration. A copy is made instead of using the original + // reference so that the configuration isn't mutated on config changes and diff checks can + // be made in WindowDecoration#relayout using the pre/post-relayout configuration. + // See b/301119301. + // TODO(b/301119301): consider moving the config data needed for diffs to relayout params + // instead of using a whole Configuration as a parameter. + final Configuration windowDecorConfig = new Configuration(); + windowDecorConfig.setTo(DesktopTasksController.isDesktopDensityOverrideSet() + ? mContext.getResources().getConfiguration() // Use system context. + : mTaskInfo.configuration); // Use task configuration. + mRelayoutParams.mWindowDecorConfig = windowDecorConfig; mRelayoutParams.mCornerRadius = (int) ScreenDecorationsUtils.getWindowCornerRadius(mContext); diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/WindowDecoration.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/WindowDecoration.java index a26927586b61..2d5ef72d2362 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/WindowDecoration.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/WindowDecoration.java @@ -196,7 +196,8 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer> final int oldDensityDpi = mWindowDecorConfig.densityDpi; mWindowDecorConfig = params.mWindowDecorConfig != null ? params.mWindowDecorConfig : mTaskInfo.getConfiguration(); - if (oldDensityDpi != mWindowDecorConfig.densityDpi + final int newDensityDpi = mWindowDecorConfig.densityDpi; + if (oldDensityDpi != newDensityDpi || mDisplay == null || mDisplay.getDisplayId() != mTaskInfo.displayId || oldLayoutResId != mLayoutResId) { |