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

Commit 6e4fea57 authored by Eric Biggers's avatar Eric Biggers
Browse files

Ensure the getCredentialType cache gets enabled

Invalidate the getCredentialType cache at boot time.  This works around
an issue in PropertyInvalidatedCache where caches don't work until they
are invalidated for the first time.  This workaround can be removed if
the underlying issue in PropertyInvalidatedCache is fixed, but that will
require a bit more discussion and will be riskier than this workaround.

This fixes a performance regression introduced by ag/19284361 ("Simplify
invalidation of lockscreen credential type cache").  That CL eliminated
unnecessary cache invalidations, which should have improved performance.
Unfortunately, due to the unexpected PropertyInvalidatedCache behavior,
it actually made the cache stop working entirely in the common case
where no user's lockscreen credential has changed since boot.

Bug: 268192609
Test: Set DEBUG=true in PropertyInvalidatedCache.java.  Build and flash.
      Run 'adb logcat | grep getCredentialType', and turn screen off and
      on.  Verified that "cache hit" messages are logged, whereas before
      this CL "cache getCredentialType unset" messages were logged.
Change-Id: Ie826bdb163288e5741a33e26209d3175de426bd1
(cherry picked from commit d91457a1)
Merged-In: Ie826bdb163288e5741a33e26209d3175de426bd1
parent 2689c4ec
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1035,7 +1035,7 @@ public class LockPatternUtils {
                    CREDENTIAL_TYPE_API, CREDENTIAL_TYPE_API, mCredentialTypeQuery);

    /**
     * Invalidate the credential cache
     * Invalidate the credential type cache
     * @hide
     */
    public final static void invalidateCredentialTypeCache() {
+4 −0
Original line number Diff line number Diff line
@@ -844,6 +844,10 @@ public class LockSettingsService extends ILockSettings.Stub {
        getAuthSecretHal();
        mDeviceProvisionedObserver.onSystemReady();

        // Work around an issue in PropertyInvalidatedCache where the cache doesn't work until the
        // first invalidation.  This can be removed if PropertyInvalidatedCache is fixed.
        LockPatternUtils.invalidateCredentialTypeCache();

        // TODO: maybe skip this for split system user mode.
        mStorage.prefetchUser(UserHandle.USER_SYSTEM);
        mBiometricDeferredQueue.systemReady(mInjector.getFingerprintManager(),