Merge "Inherit smallest width if TF is not multi-window without bounds override" into tm-qpr-dev
This commit is contained in:
@@ -2223,7 +2223,8 @@ class TaskFragment extends WindowContainer<WindowContainer> {
|
|||||||
// task, because they should not be affected by insets.
|
// task, because they should not be affected by insets.
|
||||||
inOutConfig.smallestScreenWidthDp = (int) (0.5f
|
inOutConfig.smallestScreenWidthDp = (int) (0.5f
|
||||||
+ Math.min(mTmpFullBounds.width(), mTmpFullBounds.height()) / density);
|
+ 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
|
// For embedded TFs, the smallest width should be updated. Otherwise, inherit
|
||||||
// from the parent task would result in applications loaded wrong resource.
|
// from the parent task would result in applications loaded wrong resource.
|
||||||
inOutConfig.smallestScreenWidthDp =
|
inOutConfig.smallestScreenWidthDp =
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import static com.android.server.wm.WindowContainer.POSITION_TOP;
|
|||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertNotEquals;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
@@ -98,12 +99,25 @@ public class TaskFragmentTest extends WindowTestsBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOnConfigurationChanged_updateSurface() {
|
public void testOnConfigurationChanged() {
|
||||||
final Rect bounds = new Rect(100, 100, 1100, 1100);
|
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.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).setPosition(mLeash, bounds.left, bounds.top);
|
||||||
verify(mTransaction).setWindowCrop(mLeash, 1000, 1000);
|
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
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user