Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c9db4e1b authored by Shawn Willden's avatar Shawn Willden
Browse files

Don't wait for init done in isFrpActive()

This wait creates a deadlock when booting a device with a
never-formatted persistent data block.  This went unnoticed
because all of the the test devices have booted before.

This CL also logs a warning when a PDB update is blocked due to
FRP.  This should facilitate debugging of FRP enforcement-related
problems.

Bug: 290312729
Test: Boot a fresh, never-used device (e.g. fresh cuttlefish)
Change-Id: If3abd1ccf1c1c6159a4b6276a89b5b88fdaade86
parent 2bcb9138
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -656,8 +656,10 @@ public class PersistentDataBlockService extends SystemService {

    @VisibleForTesting
    boolean isFrpActive() {
        waitForInitDoneSignal();
        synchronized (mLock) {
            // mFrpActive is initialized and automatic deactivation done (if possible) before the
            // service is published, so there's no chance that callers could ask for the state
            // before it has settled.
            return mFrpActive;
        }
    }
@@ -1253,6 +1255,7 @@ public class PersistentDataBlockService extends SystemService {

    private void enforceFactoryResetProtectionInactive() {
        if (mFrpEnforced && isFrpActive()) {
            Slog.w(TAG, "Attempt to update PDB was blocked because FRP is active.");
            throw new SecurityException("FRP is active");
        }
    }