Merge "Handle tranlucent strategy on back" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
0b5d2db6e9
@@ -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
|
* This method is to only be called from the client via binder when the activity is destroyed
|
||||||
* AND finished.
|
* AND finished.
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ import com.android.server.wm.LetterboxConfiguration.LetterboxBackgroundType;
|
|||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.function.BooleanSupplier;
|
import java.util.function.BooleanSupplier;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
/** Controls behaviour of the letterbox UI for {@link mActivityRecord}. */
|
/** Controls behaviour of the letterbox UI for {@link mActivityRecord}. */
|
||||||
// TODO(b/185262487): Improve test coverage of this class. Parts of it are tested in
|
// 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.
|
// TODO(b/263021211): Consider renaming to more generic CompatUIController.
|
||||||
final class LetterboxUiController {
|
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 String TAG = TAG_WITH_CLASS_NAME ? "LetterboxUiController" : TAG_ATM;
|
||||||
|
|
||||||
private static final float UNDEFINED_ASPECT_RATIO = 0f;
|
private static final float UNDEFINED_ASPECT_RATIO = 0f;
|
||||||
@@ -1390,7 +1394,8 @@ final class LetterboxUiController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final ActivityRecord firstOpaqueActivityBeneath = mActivityRecord.getTask().getActivity(
|
final ActivityRecord firstOpaqueActivityBeneath = mActivityRecord.getTask().getActivity(
|
||||||
ActivityRecord::fillsParent, mActivityRecord, false /* includeBoundary */,
|
FIRST_OPAQUE_NOT_FINISHING_ACTIVITY_PREDICATE /* callback */,
|
||||||
|
mActivityRecord /* boundary */, false /* includeBoundary */,
|
||||||
true /* traverseTopToBottom */);
|
true /* traverseTopToBottom */);
|
||||||
if (firstOpaqueActivityBeneath == null) {
|
if (firstOpaqueActivityBeneath == null) {
|
||||||
// We skip letterboxing if the translucent activity doesn't have any opaque
|
// We skip letterboxing if the translucent activity doesn't have any opaque
|
||||||
|
|||||||
@@ -254,6 +254,22 @@ public class SizeCompatTests extends WindowTestsBase {
|
|||||||
assertFalse(translucentActivity.inSizeCompatMode());
|
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
|
@Test
|
||||||
public void testRestartProcessIfVisible() {
|
public void testRestartProcessIfVisible() {
|
||||||
setUpDisplaySizeWithApp(1000, 2500);
|
setUpDisplaySizeWithApp(1000, 2500);
|
||||||
|
|||||||
Reference in New Issue
Block a user