diff options
| author | 2025-01-13 18:18:53 +0800 | |
|---|---|---|
| committer | 2025-01-13 18:27:50 +0800 | |
| commit | 193cd61855b6e00a25d3fd8edbb485b2068afad0 (patch) | |
| tree | fa9c9772fbd390be0e8a702a8f40267b328ed976 | |
| parent | e4046a28f899abfd82ef4f1a002eac28fce72f2b (diff) | |
Skip writing item during shutdown process if the user is locked.
Otherwise the persist thread would keep trying to write that item,
may causing an infinite loop until timeout.
Flag: com.android.window.flags.record_task_snapshots_before_shutdown
Bug: 389571348
Test: run forrest with multi-user environment.
Change-Id: Ifeefbba2aeff3a13790e8366c5ac34cd62b7fea5
| -rw-r--r-- | services/core/java/com/android/server/wm/SnapshotPersistQueue.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wm/SnapshotPersistQueue.java b/services/core/java/com/android/server/wm/SnapshotPersistQueue.java index a5454546341b..f30231934ca1 100644 --- a/services/core/java/com/android/server/wm/SnapshotPersistQueue.java +++ b/services/core/java/com/android/server/wm/SnapshotPersistQueue.java @@ -231,8 +231,13 @@ class SnapshotPersistQueue { if (next.isReady(mUserManagerInternal)) { isReadyToWrite = true; next.onDequeuedLocked(); - } else { + } else if (!mShutdown) { mWriteQueue.addLast(next); + } else { + // User manager is locked and device is shutting down, skip writing + // this item. + next.onDequeuedLocked(); + next = null; } } } |