diff options
| author | 2021-03-11 23:56:24 -0800 | |
|---|---|---|
| committer | 2021-03-15 17:33:49 -0700 | |
| commit | 26dc113e372230e6fd52d477de5e68d322b3202f (patch) | |
| tree | fb0afbcd7af461d9117ebf1e5f2a16286c480722 | |
| parent | cace0ba98d5ab5228c87ae71966f20322cfb5411 (diff) | |
Reparent child surface layers when TDA migrate to new surface control
When the DA is vanished, it will be migrated to a new surface control,
however, before this change, TDA is not reparenting it child surface
layers.
Fix: 182349684
Test: adb shell am crash com.android.systemui
Change-Id: I32d8a0d784dc5af36c956b312d68efb33775950e
5 files changed, 22 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/wm/DisplayArea.java b/services/core/java/com/android/server/wm/DisplayArea.java index 5ccf576e1099..9855ea50c83d 100644 --- a/services/core/java/com/android/server/wm/DisplayArea.java +++ b/services/core/java/com/android/server/wm/DisplayArea.java @@ -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); } diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index a4b4726fe070..6cdd872b25d4 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -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) { diff --git a/services/core/java/com/android/server/wm/TaskDisplayArea.java b/services/core/java/com/android/server/wm/TaskDisplayArea.java index 498fc5c81a4c..88e9ae9179c9 100644 --- a/services/core/java/com/android/server/wm/TaskDisplayArea.java +++ b/services/core/java/com/android/server/wm/TaskDisplayArea.java @@ -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=" diff --git a/services/core/java/com/android/server/wm/TaskOrganizerController.java b/services/core/java/com/android/server/wm/TaskOrganizerController.java index 5d22f8fde057..375b3f49be13 100644 --- a/services/core/java/com/android/server/wm/TaskOrganizerController.java +++ b/services/core/java/com/android/server/wm/TaskOrganizerController.java @@ -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; } diff --git a/services/core/java/com/android/server/wm/WindowContainer.java b/services/core/java/com/android/server/wm/WindowContainer.java index 8d859584d5f5..41164324fb9e 100644 --- a/services/core/java/com/android/server/wm/WindowContainer.java +++ b/services/core/java/com/android/server/wm/WindowContainer.java @@ -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); |