Merge "Associate starting window with task once a TF is added" into tm-qpr-dev am: e99311a44a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19733103 Change-Id: I7abca4c31661b9f489d8b21a1caa326d24d08905 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1582,13 +1582,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
|||||||
|
|
||||||
if (newParent != null && isState(RESUMED)) {
|
if (newParent != null && isState(RESUMED)) {
|
||||||
newParent.setResumedActivity(this, "onParentChanged");
|
newParent.setResumedActivity(this, "onParentChanged");
|
||||||
if (mStartingWindow != null && mStartingData != null
|
|
||||||
&& mStartingData.mAssociatedTask == null && newParent.isEmbedded()) {
|
|
||||||
// The starting window should keep covering its task when the activity is
|
|
||||||
// reparented to a task fragment that may not fill the task bounds.
|
|
||||||
associateStartingDataWithTask();
|
|
||||||
attachStartingSurfaceToAssociatedTask();
|
|
||||||
}
|
|
||||||
mImeInsetsFrozenUntilStartInput = false;
|
mImeInsetsFrozenUntilStartInput = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2679,14 +2672,17 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Called when the starting window is added to this activity. */
|
||||||
void attachStartingWindow(@NonNull WindowState startingWindow) {
|
void attachStartingWindow(@NonNull WindowState startingWindow) {
|
||||||
startingWindow.mStartingData = mStartingData;
|
startingWindow.mStartingData = mStartingData;
|
||||||
mStartingWindow = startingWindow;
|
mStartingWindow = startingWindow;
|
||||||
|
// The snapshot type may have called associateStartingDataWithTask().
|
||||||
if (mStartingData != null && mStartingData.mAssociatedTask != null) {
|
if (mStartingData != null && mStartingData.mAssociatedTask != null) {
|
||||||
attachStartingSurfaceToAssociatedTask();
|
attachStartingSurfaceToAssociatedTask();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Makes starting window always fill the associated task. */
|
||||||
private void attachStartingSurfaceToAssociatedTask() {
|
private void attachStartingSurfaceToAssociatedTask() {
|
||||||
// Associate the configuration of starting window with the task.
|
// Associate the configuration of starting window with the task.
|
||||||
overrideConfigurationPropagation(mStartingWindow, mStartingData.mAssociatedTask);
|
overrideConfigurationPropagation(mStartingWindow, mStartingData.mAssociatedTask);
|
||||||
@@ -2694,6 +2690,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
|||||||
mStartingData.mAssociatedTask.mSurfaceControl);
|
mStartingData.mAssociatedTask.mSurfaceControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Called when the starting window is not added yet but its data is known to fill the task. */
|
||||||
private void associateStartingDataWithTask() {
|
private void associateStartingDataWithTask() {
|
||||||
mStartingData.mAssociatedTask = task;
|
mStartingData.mAssociatedTask = task;
|
||||||
task.forAllActivities(r -> {
|
task.forAllActivities(r -> {
|
||||||
@@ -2703,6 +2700,16 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Associates and attaches an added starting window to the current task. */
|
||||||
|
void associateStartingWindowWithTaskIfNeeded() {
|
||||||
|
if (mStartingWindow == null || mStartingData == null
|
||||||
|
|| mStartingData.mAssociatedTask != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
associateStartingDataWithTask();
|
||||||
|
attachStartingSurfaceToAssociatedTask();
|
||||||
|
}
|
||||||
|
|
||||||
void removeStartingWindow() {
|
void removeStartingWindow() {
|
||||||
boolean prevEligibleForLetterboxEducation = isEligibleForLetterboxEducation();
|
boolean prevEligibleForLetterboxEducation = isEligibleForLetterboxEducation();
|
||||||
|
|
||||||
|
|||||||
@@ -1433,6 +1433,13 @@ class Task extends TaskFragment {
|
|||||||
final TaskFragment childTaskFrag = child.asTaskFragment();
|
final TaskFragment childTaskFrag = child.asTaskFragment();
|
||||||
if (childTaskFrag != null && childTaskFrag.asTask() == null) {
|
if (childTaskFrag != null && childTaskFrag.asTask() == null) {
|
||||||
childTaskFrag.setMinDimensions(mMinWidth, mMinHeight);
|
childTaskFrag.setMinDimensions(mMinWidth, mMinHeight);
|
||||||
|
|
||||||
|
// The starting window should keep covering its task when a pure TaskFragment is added
|
||||||
|
// because its bounds may not fill the task.
|
||||||
|
final ActivityRecord top = getTopMostActivity();
|
||||||
|
if (top != null) {
|
||||||
|
top.associateStartingWindowWithTaskIfNeeded();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2871,6 +2871,7 @@ public class ActivityRecordTests extends WindowTestsBase {
|
|||||||
mAtm, null /* fragmentToken */, false /* createdByOrganizer */);
|
mAtm, null /* fragmentToken */, false /* createdByOrganizer */);
|
||||||
fragmentSetup.accept(taskFragment1, new Rect(0, 0, width / 2, height));
|
fragmentSetup.accept(taskFragment1, new Rect(0, 0, width / 2, height));
|
||||||
task.addChild(taskFragment1, POSITION_TOP);
|
task.addChild(taskFragment1, POSITION_TOP);
|
||||||
|
assertEquals(task, activity1.mStartingData.mAssociatedTask);
|
||||||
|
|
||||||
final TaskFragment taskFragment2 = new TaskFragment(
|
final TaskFragment taskFragment2 = new TaskFragment(
|
||||||
mAtm, null /* fragmentToken */, false /* createdByOrganizer */);
|
mAtm, null /* fragmentToken */, false /* createdByOrganizer */);
|
||||||
@@ -2892,7 +2893,6 @@ public class ActivityRecordTests extends WindowTestsBase {
|
|||||||
eq(task.mSurfaceControl));
|
eq(task.mSurfaceControl));
|
||||||
assertEquals(activity1.mStartingData, startingWindow.mStartingData);
|
assertEquals(activity1.mStartingData, startingWindow.mStartingData);
|
||||||
assertEquals(task.mSurfaceControl, startingWindow.getAnimationLeashParent());
|
assertEquals(task.mSurfaceControl, startingWindow.getAnimationLeashParent());
|
||||||
assertEquals(task, activity1.mStartingData.mAssociatedTask);
|
|
||||||
assertEquals(taskFragment1.getBounds(), activity1.getBounds());
|
assertEquals(taskFragment1.getBounds(), activity1.getBounds());
|
||||||
// The activity was resized by task fragment, but starting window must still cover the task.
|
// The activity was resized by task fragment, but starting window must still cover the task.
|
||||||
assertEquals(taskBounds, activity1.mStartingWindow.getBounds());
|
assertEquals(taskBounds, activity1.mStartingWindow.getBounds());
|
||||||
@@ -2900,7 +2900,6 @@ public class ActivityRecordTests extends WindowTestsBase {
|
|||||||
// The starting window is only removed when all embedded activities are drawn.
|
// The starting window is only removed when all embedded activities are drawn.
|
||||||
final WindowState activityWindow = mock(WindowState.class);
|
final WindowState activityWindow = mock(WindowState.class);
|
||||||
activity1.onFirstWindowDrawn(activityWindow);
|
activity1.onFirstWindowDrawn(activityWindow);
|
||||||
assertNotNull(activity1.mStartingWindow);
|
|
||||||
activity2.onFirstWindowDrawn(activityWindow);
|
activity2.onFirstWindowDrawn(activityWindow);
|
||||||
assertNull(activity1.mStartingWindow);
|
assertNull(activity1.mStartingWindow);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user