Skip letterboxing if the activity below is embedded
Embedded activities are resize-able and won't be letterboxed
Bug: 270681405
fixes: 280898266
Test: SizeCompatTests
Test: manual - repro step in bug
Merged-In: Ic7b1c4b40960fd04de9efbf4f6d7abee45c93025
Change-Id: Ic7b1c4b40960fd04de9efbf4f6d7abee45c93025
(cherry picked from commit b828087bbc)
This commit is contained in:
committed by
Charles Chen
parent
402d56a97f
commit
ad7d89c22b
@@ -1595,9 +1595,9 @@ final class LetterboxUiController {
|
|||||||
FIRST_OPAQUE_NOT_FINISHING_ACTIVITY_PREDICATE /* callback */,
|
FIRST_OPAQUE_NOT_FINISHING_ACTIVITY_PREDICATE /* callback */,
|
||||||
mActivityRecord /* boundary */, false /* includeBoundary */,
|
mActivityRecord /* boundary */, false /* includeBoundary */,
|
||||||
true /* traverseTopToBottom */);
|
true /* traverseTopToBottom */);
|
||||||
if (firstOpaqueActivityBeneath == null) {
|
if (firstOpaqueActivityBeneath == null || firstOpaqueActivityBeneath.isEmbedded()) {
|
||||||
// We skip letterboxing if the translucent activity doesn't have any opaque
|
// We skip letterboxing if the translucent activity doesn't have any opaque
|
||||||
// activities beneath
|
// activities beneath or the activity below is embedded which never has letterbox.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
inheritConfiguration(firstOpaqueActivityBeneath);
|
inheritConfiguration(firstOpaqueActivityBeneath);
|
||||||
|
|||||||
@@ -475,7 +475,25 @@ public class SizeCompatTests extends WindowTestsBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTranslucentActivitiesDontGoInSizeCompatMode() {
|
public void testNotApplyStrategyToTranslucentActivitiesOverEmbeddedActivities() {
|
||||||
|
mWm.mLetterboxConfiguration.setTranslucentLetterboxingOverrideEnabled(true);
|
||||||
|
setUpDisplaySizeWithApp(2000, 1000);
|
||||||
|
mActivity.info.screenOrientation = SCREEN_ORIENTATION_PORTRAIT;
|
||||||
|
mActivity.mDisplayContent.setIgnoreOrientationRequest(true /* ignoreOrientationRequest */);
|
||||||
|
// Mock the activity as embedded without additional TaskFragment layer in the task for
|
||||||
|
// simplicity.
|
||||||
|
doReturn(true).when(mActivity).isEmbedded();
|
||||||
|
// Translucent Activity
|
||||||
|
final ActivityRecord translucentActivity = new ActivityBuilder(mAtm).build();
|
||||||
|
doReturn(false).when(translucentActivity).matchParentBounds();
|
||||||
|
doReturn(false).when(translucentActivity).fillsParent();
|
||||||
|
mTask.addChild(translucentActivity);
|
||||||
|
// Check the strategy has not being applied
|
||||||
|
assertFalse(translucentActivity.mLetterboxUiController.hasInheritedLetterboxBehavior());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTranslucentActivitiesDontGoInSizeCompactMode() {
|
||||||
mWm.mLetterboxConfiguration.setTranslucentLetterboxingOverrideEnabled(true);
|
mWm.mLetterboxConfiguration.setTranslucentLetterboxingOverrideEnabled(true);
|
||||||
setUpDisplaySizeWithApp(2800, 1400);
|
setUpDisplaySizeWithApp(2800, 1400);
|
||||||
mActivity.mDisplayContent.setIgnoreOrientationRequest(true /* ignoreOrientationRequest */);
|
mActivity.mDisplayContent.setIgnoreOrientationRequest(true /* ignoreOrientationRequest */);
|
||||||
|
|||||||
Reference in New Issue
Block a user