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

Commit a2eb0a98 authored by Louis Chang's avatar Louis Chang
Browse files

Fixes incorrect task bounds while moving a split-screen task to desk

Instead of preventing the request-override-config state change,
let’s clear the override bounds while resolving the
resolved-override-config.

Bug: 443079762
Bug: 427245857
Test: EnterDesktopFromSplitScreenWithAppHandleMenuFlickerTest
Flag: EXEMPT BUGFIX
Change-Id: I13eef9eeee3bbe10307b089c1719e9ce0f204510
parent c9a9dc62
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -1238,7 +1238,7 @@ class Task extends TaskFragment {
        mRootWindowContainer.updateUIDsPresentOnDisplay();
    }

    private boolean isOverrideBoundsAllowed() {
    boolean isOverrideBoundsAllowed() {
        Task parentTask = getParent() != null ? getParent().asTask() : null;
        while (parentTask != null) {
            if (parentTask.mDisallowOverrideBoundsForChildren) {
@@ -2177,16 +2177,6 @@ class Task extends TaskFragment {
        }
    }

    @Override
    public void onRequestedOverrideConfigurationChanged(
            @NonNull Configuration overrideConfiguration) {
        if (!overrideConfiguration.windowConfiguration.getBounds().isEmpty()
                && !isOverrideBoundsAllowed()) {
            overrideConfiguration.windowConfiguration.setBounds(new Rect());
        }
        super.onRequestedOverrideConfigurationChanged(overrideConfiguration);
    }

    @Override
    public void onConfigurationChanged(Configuration newParentConfig) {
        if (mDisplayContent != null
+6 −1
Original line number Diff line number Diff line
@@ -2375,6 +2375,12 @@ class TaskFragment extends WindowContainer<WindowContainer> {
        mTmpBounds.set(getResolvedOverrideConfiguration().windowConfiguration.getBounds());
        super.resolveOverrideConfiguration(newParentConfig);
        final Configuration resolvedConfig = getResolvedOverrideConfiguration();
        final Task thisTask = asTask();
        if (!resolvedConfig.windowConfiguration.getBounds().isEmpty() && thisTask != null
                && !thisTask.isOverrideBoundsAllowed()) {
            // clear the bounds if it is not allowed from its ancestors.
            resolvedConfig.windowConfiguration.setBounds(new Rect());
        }

        if (mRelativeEmbeddedBounds != null && !mRelativeEmbeddedBounds.isEmpty()) {
            // For embedded TaskFragment, make sure the bounds is set based on the relative bounds.
@@ -2402,7 +2408,6 @@ class TaskFragment extends WindowContainer<WindowContainer> {
            }
        }

        final Task thisTask = asTask();
        if (thisTask != null) {
            thisTask.resolveLeafTaskOnlyOverrideConfigs(newParentConfig,
                    mTmpBounds /* previousBounds */);