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

Commit eddf5187 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Check calling thread when verifying credentials.

This operation can do quite a bit of heavy I/O lifting, so use
StrictMode to catch any callers on the main thread.

Bug: 30622925
Change-Id: I5bfcb33a0d1563d5c38e1a1a4b32e7c1bba6bee6
parent fc00de50
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ import android.os.RemoteException;
import android.os.storage.IMountService;
import android.os.storage.StorageManager;
import android.os.ServiceManager;
import android.os.StrictMode;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
@@ -1367,6 +1368,10 @@ public class LockSettingsService extends ILockSettings.Stub {
            return VerifyCredentialResponse.ERROR;
        }

        // We're potentially going to be doing a bunch of disk I/O below as part
        // of unlocking the user, so yell if calling from the main thread.
        StrictMode.noteDiskRead();

        if (storedHash.version == CredentialHash.VERSION_LEGACY) {
            byte[] hash = credentialUtil.toHash(credential, userId);
            if (Arrays.equals(hash, storedHash.hash)) {