Merge "Handle tranlucent strategy on back" into tm-qpr-dev am: 0b5d2db6e9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21154290 Change-Id: I4061c23e953b05b7fd8176d9d69d5b876980a0f1 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -3906,6 +3906,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
}
|
||||
}
|
||||
|
||||
boolean isFinishing() {
|
||||
return finishing;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is to only be called from the client via binder when the activity is destroyed
|
||||
* AND finished.
|
||||
|
||||
@@ -105,6 +105,7 @@ import com.android.server.wm.LetterboxConfiguration.LetterboxBackgroundType;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/** Controls behaviour of the letterbox UI for {@link mActivityRecord}. */
|
||||
// TODO(b/185262487): Improve test coverage of this class. Parts of it are tested in
|
||||
@@ -114,6 +115,9 @@ import java.util.function.BooleanSupplier;
|
||||
// TODO(b/263021211): Consider renaming to more generic CompatUIController.
|
||||
final class LetterboxUiController {
|
||||
|
||||
private static final Predicate<ActivityRecord> FIRST_OPAQUE_NOT_FINISHING_ACTIVITY_PREDICATE =
|
||||
activityRecord -> activityRecord.fillsParent() && !activityRecord.isFinishing();
|
||||
|
||||
private static final String TAG = TAG_WITH_CLASS_NAME ? "LetterboxUiController" : TAG_ATM;
|
||||
|
||||
private static final float UNDEFINED_ASPECT_RATIO = 0f;
|
||||
@@ -1390,7 +1394,8 @@ final class LetterboxUiController {
|
||||
return;
|
||||
}
|
||||
final ActivityRecord firstOpaqueActivityBeneath = mActivityRecord.getTask().getActivity(
|
||||
ActivityRecord::fillsParent, mActivityRecord, false /* includeBoundary */,
|
||||
FIRST_OPAQUE_NOT_FINISHING_ACTIVITY_PREDICATE /* callback */,
|
||||
mActivityRecord /* boundary */, false /* includeBoundary */,
|
||||
true /* traverseTopToBottom */);
|
||||
if (firstOpaqueActivityBeneath == null) {
|
||||
// We skip letterboxing if the translucent activity doesn't have any opaque
|
||||
|
||||
@@ -254,6 +254,22 @@ public class SizeCompatTests extends WindowTestsBase {
|
||||
assertFalse(translucentActivity.inSizeCompatMode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCheckOpaqueIsLetterboxedWhenStrategyIsApplied() {
|
||||
mWm.mLetterboxConfiguration.setTranslucentLetterboxingOverrideEnabled(true);
|
||||
setUpDisplaySizeWithApp(2000, 1000);
|
||||
prepareUnresizable(mActivity, SCREEN_ORIENTATION_PORTRAIT);
|
||||
mActivity.mDisplayContent.setIgnoreOrientationRequest(true /* ignoreOrientationRequest */);
|
||||
// Translucent Activity
|
||||
final ActivityRecord translucentActivity = new ActivityBuilder(mAtm)
|
||||
.setLaunchedFromUid(mActivity.getUid())
|
||||
.build();
|
||||
doReturn(false).when(translucentActivity).fillsParent();
|
||||
spyOn(mActivity);
|
||||
mTask.addChild(translucentActivity);
|
||||
verify(mActivity).isFinishing();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRestartProcessIfVisible() {
|
||||
setUpDisplaySizeWithApp(1000, 2500);
|
||||
|
||||
Reference in New Issue
Block a user