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
This commit is contained in:
Tony Huang
2023-07-24 17:33:48 +08:00
parent 3490e6fb8f
commit 0dd6e025f9
2 changed files with 1 additions and 21 deletions

View File

@@ -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.
*/

View File

@@ -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