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

Commit d717808b authored by Kevin Chyn's avatar Kevin Chyn
Browse files

Fix AuthenticationCallback leak in FingerprintManager

Fixes: 32295793

Test: 1) modify/build/run apk attached in BR
2) run garbage collection after FingerprintActivity is done
3) use HPROF, FingerprintActivity should have "0 total count"
4) do this test for auth success, auth fail, auth cancel

Change-Id: I5fe7937a26d4673226b87c9c95a136dd9510e21f
parent 5a421ad0
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -42,8 +42,8 @@ import javax.crypto.Cipher;
import javax.crypto.Mac;

import static android.Manifest.permission.INTERACT_ACROSS_USERS;
import static android.Manifest.permission.USE_FINGERPRINT;
import static android.Manifest.permission.MANAGE_FINGERPRINT;
import static android.Manifest.permission.USE_FINGERPRINT;

/**
 * A class that coordinates access to the fingerprint hardware.
@@ -910,6 +910,7 @@ public class FingerprintManager {
            } else if (mAuthenticationCallback != null) {
                mAuthenticationCallback.onAuthenticationError(clientErrMsgId,
                        getErrorString(errMsgId, vendorCode));
                mAuthenticationCallback = null;
            } else if (mRemovalCallback != null) {
                mRemovalCallback.onRemovalError(mRemovalFingerprint, clientErrMsgId,
                        getErrorString(errMsgId, vendorCode));
@@ -930,12 +931,14 @@ public class FingerprintManager {
                final AuthenticationResult result =
                        new AuthenticationResult(mCryptoObject, fp, userId);
                mAuthenticationCallback.onAuthenticationSucceeded(result);
                mAuthenticationCallback = null;
            }
        }

        private void sendAuthenticatedFailed() {
            if (mAuthenticationCallback != null) {
                mAuthenticationCallback.onAuthenticationFailed();
                mAuthenticationCallback = null;
            }
        }