Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d911f3a2 authored by Jorge Gil's avatar Jorge Gil Committed by Android (Google) Code Review
Browse files

Merge "Use immutable window decor Configuration in RelayoutParams" into main

parents 8fc6b172 bbe3d7d2
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -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);
+2 −1
Original line number Diff line number Diff line
@@ -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) {