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

Commit 6080c7a1 authored by Ben Lin's avatar Ben Lin Committed by Android (Google) Code Review
Browse files

Merge "Update DisplayContext for SplitWindowManager when needed." into main

parents 013399dd a03dae77
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);