Skip to content

Commit 3642ff8

Browse files
Louis ChangAndroid Build Coastguard Worker
authored andcommitted
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 (cherry picked from commit b828087) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:ad7d89c22bf53fbcfd1f8d5a1ae2c611c376e9b3) Merged-In: Ic7b1c4b40960fd04de9efbf4f6d7abee45c93025 Change-Id: Ic7b1c4b40960fd04de9efbf4f6d7abee45c93025
1 parent eef3898 commit 3642ff8

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

services/core/java/com/android/server/wm/LetterboxUiController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,9 +1595,9 @@ void onActivityParentChanged(WindowContainer<?> parent) {
15951595
FIRST_OPAQUE_NOT_FINISHING_ACTIVITY_PREDICATE /* callback */,
15961596
mActivityRecord /* boundary */, false /* includeBoundary */,
15971597
true /* traverseTopToBottom */);
1598-
if (firstOpaqueActivityBeneath == null) {
1598+
if (firstOpaqueActivityBeneath == null || firstOpaqueActivityBeneath.isEmbedded()) {
15991599
// We skip letterboxing if the translucent activity doesn't have any opaque
1600-
// activities beneath
1600+
// activities beneath or the activity below is embedded which never has letterbox.
16011601
return;
16021602
}
16031603
inheritConfiguration(firstOpaqueActivityBeneath);

services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,25 @@ public void testApplyStrategyToMultipleTranslucentActivities() {
475475
}
476476

477477
@Test
478-
public void testTranslucentActivitiesDontGoInSizeCompatMode() {
478+
public void testNotApplyStrategyToTranslucentActivitiesOverEmbeddedActivities() {
479+
mWm.mLetterboxConfiguration.setTranslucentLetterboxingOverrideEnabled(true);
480+
setUpDisplaySizeWithApp(2000, 1000);
481+
mActivity.info.screenOrientation = SCREEN_ORIENTATION_PORTRAIT;
482+
mActivity.mDisplayContent.setIgnoreOrientationRequest(true /* ignoreOrientationRequest */);
483+
// Mock the activity as embedded without additional TaskFragment layer in the task for
484+
// simplicity.
485+
doReturn(true).when(mActivity).isEmbedded();
486+
// Translucent Activity
487+
final ActivityRecord translucentActivity = new ActivityBuilder(mAtm).build();
488+
doReturn(false).when(translucentActivity).matchParentBounds();
489+
doReturn(false).when(translucentActivity).fillsParent();
490+
mTask.addChild(translucentActivity);
491+
// Check the strategy has not being applied
492+
assertFalse(translucentActivity.mLetterboxUiController.hasInheritedLetterboxBehavior());
493+
}
494+
495+
@Test
496+
public void testTranslucentActivitiesDontGoInSizeCompactMode() {
479497
mWm.mLetterboxConfiguration.setTranslucentLetterboxingOverrideEnabled(true);
480498
setUpDisplaySizeWithApp(2800, 1400);
481499
mActivity.mDisplayContent.setIgnoreOrientationRequest(true /* ignoreOrientationRequest */);

0 commit comments

Comments
 (0)