Merge "Force embedded activity resizable" into sc-v2-dev am: 6727ad6ced am: 45ad7f77bf

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15828038

Change-Id: Icae071f299620934b1dbb8e7f25a6795f85a12c3
This commit is contained in:
TreeHugger Robot
2021-09-17 20:54:49 +00:00
committed by Automerger Merge Worker
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);