Change Size Compat mode resizability heuristic to look at top activity
Size Compat mode should be based only on top activity properties to improve debugging and predictability for the developer. The current policy of looking at the root activity was too aggressive and counter intuitive to developers, so we are changing the heuristic for resizability to look at the top activity instead. Now it will be easier to predict through the code analysis in an IDE that an activity will go in SCM since that will depend only on activity properties defined in the manifest and not on the order in which activities are launched. Fix: 227795096 Test: manually with a test app Test: atest WmTests:SizeCompatTests#testShouldCreateCompatDisplayInsetsWhenUnresizeableAndSupportsSizeChangesFalse Change-Id: I5f57936ce65ceb5052d78398f3602eae669ea3cb
This commit is contained in:
@@ -7973,11 +7973,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Activity should be resizable if the task is.
|
||||
final boolean isResizeable = task != null
|
||||
? task.isResizeable() || isResizeable()
|
||||
: isResizeable();
|
||||
return !isResizeable && (info.isFixedOrientation() || hasFixedAspectRatio())
|
||||
return !isResizeable() && (info.isFixedOrientation() || hasFixedAspectRatio())
|
||||
// The configuration of non-standard type should be enforced by system.
|
||||
// {@link WindowConfiguration#ACTIVITY_TYPE_STANDARD} is set when this activity is
|
||||
// added to a task, but this function is called when resolving the launch params, at
|
||||
|
||||
@@ -809,7 +809,7 @@ public class SizeCompatTests extends WindowTestsBase {
|
||||
.setResizeMode(ActivityInfo.RESIZE_MODE_UNRESIZEABLE)
|
||||
.setScreenOrientation(SCREEN_ORIENTATION_PORTRAIT)
|
||||
.build();
|
||||
assertFalse(activity.shouldCreateCompatDisplayInsets());
|
||||
assertTrue(activity.shouldCreateCompatDisplayInsets());
|
||||
|
||||
// The non-resizable activity should not be size compat because it is on a resizable task
|
||||
// in multi-window mode.
|
||||
@@ -842,7 +842,7 @@ public class SizeCompatTests extends WindowTestsBase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShouldNotCreateCompatDisplayInsetsWhenRootActivityIsResizeable() {
|
||||
public void testShouldCreateCompatDisplayInsetsWhenUnresizeableAndSupportsSizeChangesFalse() {
|
||||
setUpDisplaySizeWithApp(1000, 2500);
|
||||
|
||||
// Make the task root resizable.
|
||||
@@ -851,7 +851,7 @@ public class SizeCompatTests extends WindowTestsBase {
|
||||
// Create an activity on the same task.
|
||||
final ActivityRecord activity = buildActivityRecord(/* supportsSizeChanges= */false,
|
||||
RESIZE_MODE_UNRESIZEABLE, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
assertFalse(activity.shouldCreateCompatDisplayInsets());
|
||||
assertTrue(activity.shouldCreateCompatDisplayInsets());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user