Merge "Reparent child surface layers when TDA migrate to new surface control" into sc-dev

This commit is contained in:
Chris Li
2021-03-17 20:36:44 +00:00
committed by Android (Google) Code Review
5 changed files with 22 additions and 7 deletions

View File

@@ -451,7 +451,7 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> {
void sendDisplayAreaVanished(IDisplayAreaOrganizer organizer) {
if (organizer == null) return;
migrateToNewSurfaceControl();
migrateToNewSurfaceControl(getSyncTransaction());
mOrganizerController.onDisplayAreaVanished(organizer, this);
}

View File

@@ -2382,11 +2382,11 @@ class Task extends WindowContainer<WindowContainer> {
}
@Override
void migrateToNewSurfaceControl() {
super.migrateToNewSurfaceControl();
void migrateToNewSurfaceControl(SurfaceControl.Transaction t) {
super.migrateToNewSurfaceControl(t);
mLastSurfaceSize.x = 0;
mLastSurfaceSize.y = 0;
updateSurfaceSize(getPendingTransaction());
updateSurfaceSize(t);
}
void updateSurfaceSize(SurfaceControl.Transaction transaction) {

View File

@@ -963,6 +963,22 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
}
}
@Override
void migrateToNewSurfaceControl(SurfaceControl.Transaction t) {
super.migrateToNewSurfaceControl(t);
if (mAppAnimationLayer == null) {
return;
}
// As TaskDisplayArea is getting a new surface, reparent and reorder the child surfaces.
t.reparent(mAppAnimationLayer, mSurfaceControl);
t.reparent(mBoostedAppAnimationLayer, mSurfaceControl);
t.reparent(mHomeAppAnimationLayer, mSurfaceControl);
t.reparent(mSplitScreenDividerAnchor, mSurfaceControl);
reassignLayer(t);
scheduleAnimation();
}
void onRootTaskRemoved(Task rootTask) {
if (ActivityTaskManagerDebugConfig.DEBUG_ROOT_TASK) {
Slog.v(TAG_ROOT_TASK, "onRootTaskRemoved: detaching " + rootTask + " from displayId="

View File

@@ -310,7 +310,7 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
boolean taskAppearedSent = t.mTaskAppearedSent;
if (taskAppearedSent) {
if (t.getSurfaceControl() != null) {
t.migrateToNewSurfaceControl();
t.migrateToNewSurfaceControl(t.getSyncTransaction());
}
t.mTaskAppearedSent = false;
}

View File

@@ -460,8 +460,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
* This is used to revoke control of the SurfaceControl from a client process that was
* previously organizing this WindowContainer.
*/
void migrateToNewSurfaceControl() {
SurfaceControl.Transaction t = getPendingTransaction();
void migrateToNewSurfaceControl(SurfaceControl.Transaction t) {
t.remove(mSurfaceControl);
// Clear the last position so the new SurfaceControl will get correct position
mLastSurfacePosition.set(0, 0);