diff options
| author | 2024-12-17 02:01:11 +0000 | |
|---|---|---|
| committer | 2024-12-17 03:03:09 +0000 | |
| commit | 04f3cc7f778832171e8c8d12d4564b3a45132d4f (patch) | |
| tree | b9b35cdc597342789d621d8b00ad3d927b392811 | |
| parent | b225077fbb5bd70ad4baa0ba99b039989393c075 (diff) | |
Handle PHASE_BOOT_COMPLETED asynchronously in LockSettingsService
SystemService#onBootPhase(PHASE_BOOT_COMPLETED) can be called on
system_server's main thread after it has enabled StrictMode. Therefore
I/O should not be performed. Do the relevant work on the service thread
instead. There is no strict timing required for the work that is being
done, so this should be fine.
Bug: 333057214
Flag: EXEMPT bugfix
Test: atest FrameworksServicesTests:com.android.server.locksettings
Change-Id: If96637fb83054b77857387415e1e6cee1c2ba7f6
| -rw-r--r-- | services/core/java/com/android/server/locksettings/LockSettingsService.java | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsService.java b/services/core/java/com/android/server/locksettings/LockSettingsService.java index c314ab06fbad..3f915757f137 100644 --- a/services/core/java/com/android/server/locksettings/LockSettingsService.java +++ b/services/core/java/com/android/server/locksettings/LockSettingsService.java @@ -369,16 +369,7 @@ public class LockSettingsService extends ILockSettings.Stub { @Override public void onBootPhase(int phase) { super.onBootPhase(phase); - if (phase == PHASE_ACTIVITY_MANAGER_READY) { - mLockSettingsService.migrateOldDataAfterSystemReady(); - mLockSettingsService.deleteRepairModePersistentDataIfNeeded(); - } else if (phase == PHASE_BOOT_COMPLETED) { - // In the case of an upgrade, PHASE_BOOT_COMPLETED means that a rollback to the old - // build can no longer occur. This is the time to destroy any migrated protectors. - mLockSettingsService.destroyMigratedProtectors(); - - mLockSettingsService.loadEscrowData(); - } + mLockSettingsService.onBootPhase(phase); } @Override @@ -397,6 +388,21 @@ public class LockSettingsService extends ILockSettings.Stub { } } + private void onBootPhase(int phase) { + if (phase == SystemService.PHASE_ACTIVITY_MANAGER_READY) { + migrateOldDataAfterSystemReady(); + deleteRepairModePersistentDataIfNeeded(); + } else if (phase == SystemService.PHASE_BOOT_COMPLETED) { + mHandler.post(() -> { + // In the case of an upgrade, PHASE_BOOT_COMPLETED means that a rollback to the old + // build can no longer occur. This is the time to destroy any migrated protectors. + destroyMigratedProtectors(); + + loadEscrowData(); + }); + } + } + @VisibleForTesting protected static class SynchronizedStrongAuthTracker extends LockPatternUtils.StrongAuthTracker { |