diff options
| author | 2022-12-15 07:15:23 +0000 | |
|---|---|---|
| committer | 2022-12-15 07:15:23 +0000 | |
| commit | 3b1cd4771aea077694c606e60f9232e43f35eff3 (patch) | |
| tree | 9aad01d13344f0fbcc9a5e06450a994aafc5ffa2 | |
| parent | 8b6e7bb6136e325fd8eb46d7a375f89c45315061 (diff) | |
| parent | c7237c1b0ef9d8471784c5c28551aa9611583371 (diff) | |
Merge "Inherit smallest width if TF is not multi-window without bounds override" into tm-qpr-dev am: c7237c1b0e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20729658
Change-Id: Iccc577aa2e7acada99f06bbfc84fdeaa30f497df
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | services/core/java/com/android/server/wm/TaskFragment.java | 3 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/TaskFragmentTest.java | 22 |
2 files changed, 20 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/wm/TaskFragment.java b/services/core/java/com/android/server/wm/TaskFragment.java index 58ea825f1f50..fd0a772d0478 100644 --- a/services/core/java/com/android/server/wm/TaskFragment.java +++ b/services/core/java/com/android/server/wm/TaskFragment.java @@ -2223,7 +2223,8 @@ class TaskFragment extends WindowContainer<WindowContainer> { // task, because they should not be affected by insets. inOutConfig.smallestScreenWidthDp = (int) (0.5f + Math.min(mTmpFullBounds.width(), mTmpFullBounds.height()) / density); - } else if (isEmbedded()) { + } else if (windowingMode == WINDOWING_MODE_MULTI_WINDOW + && isEmbeddedWithBoundsOverride()) { // For embedded TFs, the smallest width should be updated. Otherwise, inherit // from the parent task would result in applications loaded wrong resource. inOutConfig.smallestScreenWidthDp = diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskFragmentTest.java b/services/tests/wmtests/src/com/android/server/wm/TaskFragmentTest.java index 11ac929327b9..c8932550d877 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TaskFragmentTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/TaskFragmentTest.java @@ -38,6 +38,7 @@ import static com.android.server.wm.WindowContainer.POSITION_TOP; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyInt; @@ -98,12 +99,25 @@ public class TaskFragmentTest extends WindowTestsBase { } @Test - public void testOnConfigurationChanged_updateSurface() { - final Rect bounds = new Rect(100, 100, 1100, 1100); + public void testOnConfigurationChanged() { + final Configuration parentConfig = mTaskFragment.getParent().getConfiguration(); + final Rect parentBounds = parentConfig.windowConfiguration.getBounds(); + parentConfig.smallestScreenWidthDp += 10; + final int parentSw = parentConfig.smallestScreenWidthDp; + final Rect bounds = new Rect(parentBounds); + bounds.inset(100, 100); mTaskFragment.setBounds(bounds); + mTaskFragment.setWindowingMode(WINDOWING_MODE_MULTI_WINDOW); + // Calculate its own sw with smaller bounds in multi-window mode. + assertNotEquals(parentSw, mTaskFragment.getConfiguration().smallestScreenWidthDp); - verify(mTransaction).setPosition(mLeash, 100, 100); - verify(mTransaction).setWindowCrop(mLeash, 1000, 1000); + verify(mTransaction).setPosition(mLeash, bounds.left, bounds.top); + verify(mTransaction).setWindowCrop(mLeash, bounds.width(), bounds.height()); + + mTaskFragment.setBounds(parentBounds); + mTaskFragment.setWindowingMode(WINDOWING_MODE_FULLSCREEN); + // Inherit parent's sw in fullscreen mode. + assertEquals(parentSw, mTaskFragment.getConfiguration().smallestScreenWidthDp); } @Test |