summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Wei Sheng Shih <wilsonshih@google.com> 2023-09-14 11:48:33 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-09-14 11:48:33 +0000
commit2dec1eb5a2da8b8d4ab5344d4fa6eca042a1d993 (patch)
tree710198a177357a1436cf4d53793d9a13507c406e
parent9eaf0194109017fec0a89fca07b5ed6e80ace3e7 (diff)
parent370032336e9ed31cdfdd365099f3c8c276394860 (diff)
Merge "Clean up StartingWindowRecord from record manager once it is removed." into udc-qpr-dev am: 1c821c1101 am: 370032336e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24735510 Change-Id: I4e6073aab10f4edb3c0540c24f2a8130835a2e4b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SnapshotWindowCreator.java12
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenWindowCreator.java2
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java20
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/WindowlessSnapshotWindowCreator.java8
4 files changed, 28 insertions, 14 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SnapshotWindowCreator.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SnapshotWindowCreator.java
index 20c4d5ae5f58..e7e1e0a98550 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SnapshotWindowCreator.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SnapshotWindowCreator.java
@@ -35,13 +35,14 @@ class SnapshotWindowCreator {
void makeTaskSnapshotWindow(StartingWindowInfo startingWindowInfo, TaskSnapshot snapshot) {
final int taskId = startingWindowInfo.taskInfo.taskId;
// Remove any existing starting window for this task before adding.
- mStartingWindowRecordManager.removeWindow(taskId, true);
+ mStartingWindowRecordManager.removeWindow(taskId);
final TaskSnapshotWindow surface = TaskSnapshotWindow.create(startingWindowInfo,
startingWindowInfo.appToken, snapshot, mMainExecutor,
- () -> mStartingWindowRecordManager.removeWindow(taskId, true));
+ () -> mStartingWindowRecordManager.removeWindow(taskId));
if (surface != null) {
final SnapshotWindowRecord tView = new SnapshotWindowRecord(surface,
- startingWindowInfo.taskInfo.topActivityType, mMainExecutor);
+ startingWindowInfo.taskInfo.topActivityType, mMainExecutor,
+ taskId, mStartingWindowRecordManager);
mStartingWindowRecordManager.addRecord(taskId, tView);
}
}
@@ -50,8 +51,9 @@ class SnapshotWindowCreator {
private final TaskSnapshotWindow mTaskSnapshotWindow;
SnapshotWindowRecord(TaskSnapshotWindow taskSnapshotWindow,
- int activityType, ShellExecutor removeExecutor) {
- super(activityType, removeExecutor);
+ int activityType, ShellExecutor removeExecutor, int id,
+ StartingSurfaceDrawer.StartingWindowRecordManager recordManager) {
+ super(activityType, removeExecutor, id, recordManager);
mTaskSnapshotWindow = taskSnapshotWindow;
mBGColor = mTaskSnapshotWindow.getBackgroundColor();
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenWindowCreator.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenWindowCreator.java
index 4cfbbd971fe3..31fc98b713ab 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenWindowCreator.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenWindowCreator.java
@@ -358,7 +358,7 @@ class SplashscreenWindowCreator extends AbsSplashWindowCreator {
}
}
if (shouldSaveView) {
- mStartingWindowRecordManager.removeWindow(taskId, true);
+ mStartingWindowRecordManager.removeWindow(taskId);
saveSplashScreenRecord(appToken, taskId, view, suggestType);
}
return shouldSaveView;
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java
index 7cbf263f7cb1..e2be1533118a 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java
@@ -188,7 +188,7 @@ public class StartingSurfaceDrawer {
final SnapshotRecord record = sRecord instanceof SnapshotRecord
? (SnapshotRecord) sRecord : null;
if (record != null && record.hasImeSurface()) {
- records.removeWindow(taskId, true);
+ records.removeWindow(taskId);
}
}
@@ -256,10 +256,15 @@ public class StartingSurfaceDrawer {
@WindowConfiguration.ActivityType protected final int mActivityType;
protected final ShellExecutor mRemoveExecutor;
+ private final int mTaskId;
+ private final StartingWindowRecordManager mRecordManager;
- SnapshotRecord(int activityType, ShellExecutor removeExecutor) {
+ SnapshotRecord(int activityType, ShellExecutor removeExecutor, int taskId,
+ StartingWindowRecordManager recordManager) {
mActivityType = activityType;
mRemoveExecutor = removeExecutor;
+ mTaskId = taskId;
+ mRecordManager = recordManager;
}
@Override
@@ -301,6 +306,7 @@ public class StartingSurfaceDrawer {
@CallSuper
protected void removeImmediately() {
mRemoveExecutor.removeCallbacks(mScheduledRunnable);
+ mRecordManager.onRecordRemoved(mTaskId);
}
}
@@ -316,7 +322,7 @@ public class StartingSurfaceDrawer {
taskIds[i] = mStartingWindowRecords.keyAt(i);
}
for (int i = taskSize - 1; i >= 0; --i) {
- removeWindow(taskIds[i], true);
+ removeWindow(taskIds[i]);
}
}
@@ -335,9 +341,13 @@ public class StartingSurfaceDrawer {
}
}
- void removeWindow(int taskId, boolean immediately) {
+ void removeWindow(int taskId) {
mTmpRemovalInfo.taskId = taskId;
- removeWindow(mTmpRemovalInfo, immediately);
+ removeWindow(mTmpRemovalInfo, true/* immediately */);
+ }
+
+ void onRecordRemoved(int taskId) {
+ mStartingWindowRecords.remove(taskId);
}
StartingWindowRecord getRecord(int taskId) {
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/WindowlessSnapshotWindowCreator.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/WindowlessSnapshotWindowCreator.java
index 144547885501..fed2f34b5e0c 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/WindowlessSnapshotWindowCreator.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/WindowlessSnapshotWindowCreator.java
@@ -92,7 +92,8 @@ class WindowlessSnapshotWindowCreator {
final SnapshotWindowRecord record = new SnapshotWindowRecord(mViewHost, wlw.mChildSurface,
taskDescription.getBackgroundColor(), snapshot.hasImeSurface(),
- runningTaskInfo.topActivityType, removeExecutor);
+ runningTaskInfo.topActivityType, removeExecutor,
+ taskId, mStartingWindowRecordManager);
mStartingWindowRecordManager.addRecord(taskId, record);
info.notifyAddComplete(wlw.mChildSurface);
}
@@ -104,8 +105,9 @@ class WindowlessSnapshotWindowCreator {
SnapshotWindowRecord(SurfaceControlViewHost viewHost, SurfaceControl childSurface,
int bgColor, boolean hasImeSurface, int activityType,
- ShellExecutor removeExecutor) {
- super(activityType, removeExecutor);
+ ShellExecutor removeExecutor, int id,
+ StartingSurfaceDrawer.StartingWindowRecordManager recordManager) {
+ super(activityType, removeExecutor, id, recordManager);
mViewHost = viewHost;
mChildSurface = childSurface;
mBGColor = bgColor;