Merge "Clear mInheritedCompatDisplayInsets when clearing size compat mode" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
451856db69
@@ -8071,6 +8071,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
mSizeCompatScale = 1f;
|
||||
mSizeCompatBounds = null;
|
||||
mCompatDisplayInsets = null;
|
||||
mLetterboxUiController.clearInheritedCompatDisplayInsets();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -1494,6 +1494,10 @@ final class LetterboxUiController {
|
||||
return mInheritedCompatDisplayInsets;
|
||||
}
|
||||
|
||||
void clearInheritedCompatDisplayInsets() {
|
||||
mInheritedCompatDisplayInsets = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* In case of translucent activities, it consumes the {@link ActivityRecord} of the first opaque
|
||||
* activity beneath using the given consumer and returns {@code true}.
|
||||
|
||||
@@ -64,6 +64,8 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
@@ -485,6 +487,33 @@ public class SizeCompatTests extends WindowTestsBase {
|
||||
assertEquals(translucentActivity.getBounds(), mActivity.getBounds());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTranslucentActivity_clearSizeCompatMode_inheritedCompatDisplayInsetsCleared() {
|
||||
mWm.mLetterboxConfiguration.setTranslucentLetterboxingOverrideEnabled(true);
|
||||
setUpDisplaySizeWithApp(2800, 1400);
|
||||
mActivity.mDisplayContent.setIgnoreOrientationRequest(true /* ignoreOrientationRequest */);
|
||||
prepareUnresizable(mActivity, -1f /* maxAspect */, SCREEN_ORIENTATION_PORTRAIT);
|
||||
// Rotate to put activity in size compat mode.
|
||||
rotateDisplay(mActivity.mDisplayContent, ROTATION_90);
|
||||
assertTrue(mActivity.inSizeCompatMode());
|
||||
|
||||
// We launch a transparent activity
|
||||
final ActivityRecord translucentActivity = new ActivityBuilder(mAtm)
|
||||
.setLaunchedFromUid(mActivity.getUid())
|
||||
.setScreenOrientation(SCREEN_ORIENTATION_PORTRAIT)
|
||||
.build();
|
||||
doReturn(false).when(translucentActivity).fillsParent();
|
||||
mTask.addChild(translucentActivity);
|
||||
|
||||
// The transparent activity inherits the compat display insets of the opaque activity
|
||||
// beneath it
|
||||
assertNotNull(translucentActivity.getCompatDisplayInsets());
|
||||
|
||||
// Clearing SCM should also clear the inherited compat display insets
|
||||
translucentActivity.clearSizeCompatMode();
|
||||
assertNull(translucentActivity.getCompatDisplayInsets());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRestartProcessIfVisible() {
|
||||
setUpDisplaySizeWithApp(1000, 2500);
|
||||
|
||||
Reference in New Issue
Block a user