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

Commit a03dae77 authored by Ben Lin's avatar Ben Lin
Browse files

Update DisplayContext for SplitWindowManager when needed.

When we get a new display configuration, we need to also update the mContext object on SplitWindowManager in order for all the views inflation on the next cycle to be done correctly.

Bug: 438264865
Test: Manual - Splitscreen on external display now has correct rounded corners
Flag: com.android.window.flags.enable_non_default_display_split
Change-Id: I54cac923d3925501178c6dae274efdb30944bc38
parent 388691dd
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import static android.view.WindowManager.DOCKED_TOP;

import static com.android.internal.jank.InteractionJankMonitor.CUJ_SPLIT_SCREEN_DOUBLE_TAP_DIVIDER;
import static com.android.internal.jank.InteractionJankMonitor.CUJ_SPLIT_SCREEN_RESIZE;
import static com.android.window.flags.Flags.enableNonDefaultDisplaySplit;
import static com.android.wm.shell.common.split.DividerSnapAlgorithm.SNAP_FLEXIBLE_HYBRID;
import static com.android.wm.shell.shared.animation.Interpolators.EMPHASIZED;
import static com.android.wm.shell.shared.animation.Interpolators.FAST_OUT_SLOW_IN;
@@ -521,7 +522,13 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
            return false;
        }

        mContext = mContext.createConfigurationContext(configuration);
        final Context displayContext = enableNonDefaultDisplaySplit()
                && mDisplayController.getDisplayContext(displayId) != null
                ? mDisplayController.getDisplayContext(displayId) : mContext;
        mContext = displayContext.createConfigurationContext(configuration);
        if ((enableNonDefaultDisplaySplit())) {
            mSplitWindowManager.updateDisplayContext(mContext);
        }
        mSplitWindowManager.setConfiguration(configuration);
        mOrientation = orientation;
        mTempRect.set(mRootBounds);
+3 −1
Original line number Diff line number Diff line
@@ -218,7 +218,9 @@ public class SplitScreenUtils {

        Configuration displayConfiguration = displayAreaInfo.configuration;
        if (splitLayout != null) {
            splitLayout.updateConfiguration(displayConfiguration, displayId);
            if (splitLayout.updateConfiguration(displayConfiguration, displayId)) {
                splitLayout.update(null /* t */, false /* resetImePosition */);
            }
        }
    }
}
+13 −0
Original line number Diff line number Diff line
@@ -91,6 +91,19 @@ public final class SplitWindowManager extends WindowlessWindowManager {
        return super.getSurfaceControl(window);
    }

    /**
     * Update the display Context if the previous one's display and the new one are different.
     *
     * Since changing the display almost certainly means the {@link DividerView} is out of date,
     * also call on release to teardown the {@link DividerView}.
     */
    public void updateDisplayContext(Context displayContext) {
        if (displayContext.getDisplayId() != mContext.getDisplayId()) {
            mContext = displayContext;
            release(null /* Transaction */);
        }
    }

    @Override
    public void setConfiguration(Configuration configuration) {
        super.setConfiguration(configuration);