diff options
| author | 2022-10-12 03:14:15 +0000 | |
|---|---|---|
| committer | 2022-10-12 03:14:15 +0000 | |
| commit | 14bc57382c64c23aa68b5f26de35855e81a601dc (patch) | |
| tree | ba3dba425605f9d561c1a331d3ee0b58b7a50ae6 | |
| parent | cdcefab35121ea2156bbb4db4ff43ffc344ea0df (diff) | |
| parent | b3d7ef6d859b914cc40e45c1245c56aff63bfd3a (diff) | |
Merge "Update split context when display size changed" into tm-qpr-dev
2 files changed, 13 insertions, 0 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java index 419e62daf586..c2ad1a98d167 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java @@ -118,6 +118,7 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange private boolean mFreezeDividerWindow = false; private int mOrientation; private int mRotation; + private int mDensity; private final boolean mDimNonImeSide; @@ -290,9 +291,11 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange final int rotation = configuration.windowConfiguration.getRotation(); final Rect rootBounds = configuration.windowConfiguration.getBounds(); final int orientation = configuration.orientation; + final int density = configuration.densityDpi; if (mOrientation == orientation && mRotation == rotation + && mDensity == density && mRootBounds.equals(rootBounds)) { return false; } @@ -303,6 +306,7 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange mTempRect.set(mRootBounds); mRootBounds.set(rootBounds); mRotation = rotation; + mDensity = density; mDividerSnapAlgorithm = getSnapAlgorithm(mContext, mRootBounds, null); initDividerPosition(mTempRect); updateInvisibleRect(); diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/split/SplitLayoutTests.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/split/SplitLayoutTests.java index 695550dd8fa5..f6d6c03bc2ee 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/split/SplitLayoutTests.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/split/SplitLayoutTests.java @@ -16,6 +16,7 @@ package com.android.wm.shell.common.split; +import static android.content.res.Configuration.ORIENTATION_LANDSCAPE; import static android.content.res.Configuration.ORIENTATION_PORTRAIT; import static com.google.common.truth.Truth.assertThat; @@ -91,6 +92,14 @@ public class SplitLayoutTests extends ShellTestCase { // Verify updateConfiguration returns true if the root bounds changed. config.windowConfiguration.setBounds(new Rect(0, 0, 2160, 1080)); assertThat(mSplitLayout.updateConfiguration(config)).isTrue(); + + // Verify updateConfiguration returns true if the orientation changed. + config.orientation = ORIENTATION_LANDSCAPE; + assertThat(mSplitLayout.updateConfiguration(config)).isTrue(); + + // Verify updateConfiguration returns true if the density changed. + config.densityDpi = 123; + assertThat(mSplitLayout.updateConfiguration(config)).isTrue(); } @Test |