Merge "Force embedded activity resizable" into sc-v2-dev

This commit is contained in:
TreeHugger Robot
2021-09-16 01:47:19 +00:00
committed by Android (Google) Code Review
2 changed files with 11 additions and 2 deletions

View File

@@ -2607,6 +2607,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
return parent != null ? parent.getOrganizedTaskFragment() : null;
}
boolean isEmbedded() {
final TaskFragment parent = getTaskFragment();
return parent != null && parent.isEmbedded();
}
@Override
@Nullable
TaskDisplayArea getDisplayArea() {
@@ -2698,7 +2703,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
boolean isResizeable() {
return mAtmService.mForceResizableActivities
|| ActivityInfo.isResizeableMode(info.resizeMode)
|| info.supportsPictureInPicture();
|| info.supportsPictureInPicture()
// If the activity can be embedded, it should inherit the bounds of task fragment.
|| isEmbedded();
}
/** @return whether this activity is non-resizeable but is forced to be resizable. */

View File

@@ -2724,9 +2724,11 @@ public class ActivityRecordTests extends WindowTestsBase {
mAtm, null /* fragmentToken */, false /* createdByOrganizer */);
fragmentSetup.accept(taskFragment2, new Rect(width / 2, 0, width, height));
task.addChild(taskFragment2, POSITION_TOP);
final ActivityRecord activity2 = new ActivityBuilder(mAtm).build();
final ActivityRecord activity2 = new ActivityBuilder(mAtm)
.setResizeMode(ActivityInfo.RESIZE_MODE_UNRESIZEABLE).build();
activity2.mVisibleRequested = true;
taskFragment2.addChild(activity2);
assertTrue(activity2.isResizeable());
activity1.reparent(taskFragment1, POSITION_TOP);
assertEquals(task, activity1.mStartingData.mAssociatedTask);