From bcf29f093ea30de396bfadb2fb9d10dd173ecb62 Mon Sep 17 00:00:00 2001 From: Adam Bookatz Date: Wed, 1 Feb 2023 20:45:13 -0800 Subject: [PATCH] PersistentDataBlockService waits for MainUser Currently, the PersistentDataBlockService fetches the mAllowedUid too early for Headless System User Devices (HSUM) to work. On HSUM, the FRP user (i.e. the MainUser) is created later, so PDBS must wait for then before trying to find that user's allowed package. Bug: 262438904 Test: manual: add account+PIN; factory reset into HSUM; SUW demands credentials post reboot Test: atest FrameworksServicesTests:SyntheticPasswordTests FrameworksServicesTests:WeaverBasedSyntheticPasswordTests Test: atest CtsPackageInstallTestCases:android.packageinstaller.install.cts Change-Id: I4b31ba013fcfa36200402e5f57460aecb8325243 --- .../java/com/android/server/PersistentDataBlockService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/PersistentDataBlockService.java b/services/core/java/com/android/server/PersistentDataBlockService.java index 5eb0db1f3454c..6fd6afed49b90 100644 --- a/services/core/java/com/android/server/PersistentDataBlockService.java +++ b/services/core/java/com/android/server/PersistentDataBlockService.java @@ -182,7 +182,6 @@ public class PersistentDataBlockService extends SystemService { public void onStart() { // Do init on a separate thread, will join in PHASE_ACTIVITY_MANAGER_READY SystemServerInitThreadPool.submit(() -> { - mAllowedUid = getAllowedUid(); enforceChecksumValidity(); formatIfOemUnlockEnabled(); publishBinderService(Context.PERSISTENT_DATA_BLOCK_SERVICE, mService); @@ -202,6 +201,8 @@ public class PersistentDataBlockService extends SystemService { Thread.currentThread().interrupt(); throw new IllegalStateException("Service " + TAG + " init interrupted", e); } + // The user responsible for FRP should exist by now. + mAllowedUid = getAllowedUid(); LocalServices.addService(PersistentDataBlockManagerInternal.class, mInternalService); } super.onBootPhase(phase);