Update the split layout while density changed

According to mDividerSnapAlgorithm, the density change results in the
position of the driver bar changed, but the split layout is changed
only in the legacy transition environment. This CL updates the split
layout when the display density changed.

Bug: 273430199
Test: atest SplitLayoutTests
      atest StageCoordinatorTests
Change-Id: I767c499494c3498de36c007c7d3f1a0c275f776b
This commit is contained in:
Jeff Chang
2023-03-19 17:24:44 +08:00
parent c111807c2b
commit 6149641c1e
2 changed files with 12 additions and 0 deletions

View File

@@ -717,6 +717,10 @@ 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

@@ -2183,6 +2183,14 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
return;
}
mDisplayLayout.set(mDisplayController.getDisplayLayout(displayId));
if (mSplitLayout != null && mSplitLayout.isDensityChanged(newConfig.densityDpi)
&& mMainStage.isActive()
&& mSplitLayout.updateConfiguration(newConfig)
&& ENABLE_SHELL_TRANSITIONS) {
mSplitLayout.update(null /* t */);
onLayoutSizeChanged(mSplitLayout);
}
}
void updateSurfaces(SurfaceControl.Transaction transaction) {