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

Commit 0dd6e025 authored by Tony Huang's avatar Tony Huang
Browse files

Fix split layout didn't update config when rotation

We use display callback to update split layout config when rotate
case, but the DisplayInfo is nullable so we cannot ensure it is
always updated, so we still need to handle it on onTaskInfoChanged
if configuration changed case.

Fix: 274050160
Fix: 277180049
Test: manual
Test: pass existing tests
Change-Id: Icd5d6c485ae769ebb3aa59ba76c100a4efbf3f8a
parent 3490e6fb
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -722,10 +722,6 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
        return bounds.width() > bounds.height();
    }

    public boolean isDensityChanged(int densityDpi) {
        return mDensity != densityDpi;
    }

    /**
     * Return if this layout is landscape.
     */
+1 −17
Original line number Diff line number Diff line
@@ -83,7 +83,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.LauncherApps;
import android.content.pm.ShortcutInfo;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.hardware.devicestate.DeviceStateManager;
import android.os.Bundle;
@@ -1779,8 +1778,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        mRootTaskInfo = taskInfo;
        if (mSplitLayout != null
                && mSplitLayout.updateConfiguration(mRootTaskInfo.configuration)
                && mMainStage.isActive()
                && !ENABLE_SHELL_TRANSITIONS) {
                && mMainStage.isActive()) {
            // Clear the divider remote animating flag as the divider will be re-rendered to apply
            // the new rotation config.
            mIsDividerRemoteAnimating = false;
@@ -2218,20 +2216,6 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        mDisplayController.addDisplayChangingController(this::onDisplayChange);
    }

    @Override
    public void onDisplayConfigurationChanged(int displayId, Configuration newConfig) {
        if (displayId != DEFAULT_DISPLAY) {
            return;
        }
        if (mSplitLayout != null && mSplitLayout.isDensityChanged(newConfig.densityDpi)
                && mMainStage.isActive()
                && mSplitLayout.updateConfiguration(newConfig)
                && ENABLE_SHELL_TRANSITIONS) {
            mSplitLayout.update(null /* t */);
            onLayoutSizeChanged(mSplitLayout);
        }
    }

    /**
     * Update surfaces of the split screen layout based on the current state
     * @param transaction to write the updates to