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

Commit e8b1a898 authored by Eric Biggers's avatar Eric Biggers
Browse files

Avoid the suppression of an errorprone warning

Lock mService.mSpManager in initializeStorageWithCredential() so that
GuardedBy warnings don't have to be suppressed in that method anymore.

Test: m FrameworksServicesTests RUN_ERROR_PRONE=true
Test: atest LockSettingsServiceTests
Change-Id: I7451a7d32c3feb6c1ac40371cdb6f24f7b1fdd6d
parent 8568657f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -234,7 +234,8 @@ public class LockSettingsService extends ILockSettings.Stub {
    protected final UserManager mUserManager;
    private final IStorageManager mStorageManager;
    private final IActivityManager mActivityManager;
    private final SyntheticPasswordManager mSpManager;
    @VisibleForTesting
    protected final SyntheticPasswordManager mSpManager;

    private final KeyStore mKeyStore;
    private final java.security.KeyStore mJavaKeyStore;
+3 −2
Original line number Diff line number Diff line
@@ -504,11 +504,12 @@ public class LockSettingsServiceTests extends BaseLockSettingsServiceTests {
                badCredential, userId, 0 /* flags */).getResponseCode());
    }

    @SuppressWarnings("GuardedBy") // for initializeSyntheticPasswordLocked
    private void initializeStorageWithCredential(int userId, LockscreenCredential credential)
            throws RemoteException {
        assertEquals(0, mGateKeeperService.getSecureUserId(userId));
        synchronized (mService.mSpManager) {
            mService.initializeSyntheticPasswordLocked(credential, userId);
        }
        assertNotEquals(0, mGateKeeperService.getSecureUserId(userId));
    }
}