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

Commit 04496eec authored by Diya Bera's avatar Diya Bera
Browse files

Require permission for hidden APIs in BiometricPrompt

Test: N/A
Bug: 288874281
Change-Id: I470831d4846b5e150dafeda3a882cf9396035fb1
parent 804840c5
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -144,6 +144,7 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan
        private Context mContext;
        private IAuthService mService;

        // LINT.IfChange
        /**
         * Creates a builder for a {@link BiometricPrompt} dialog.
         * @param context The {@link Context} that will be used to build the prompt.
@@ -417,6 +418,7 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan
         * @hide
         */
        @NonNull
        @RequiresPermission(anyOf = {USE_BIOMETRIC_INTERNAL})
        public Builder setDisallowBiometricsIfPolicyExists(boolean checkDevicePolicyManager) {
            mPromptInfo.setDisallowBiometricsIfPolicyExists(checkDevicePolicyManager);
            return this;
@@ -429,6 +431,7 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan
         * @hide
         */
        @NonNull
        @RequiresPermission(anyOf = {USE_BIOMETRIC_INTERNAL})
        public Builder setReceiveSystemEvents(boolean set) {
            mPromptInfo.setReceiveSystemEvents(set);
            return this;
@@ -442,6 +445,7 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan
         * @hide
         */
        @NonNull
        @RequiresPermission(anyOf = {TEST_BIOMETRIC, USE_BIOMETRIC_INTERNAL})
        public Builder setIgnoreEnrollmentState(boolean ignoreEnrollmentState) {
            mPromptInfo.setIgnoreEnrollmentState(ignoreEnrollmentState);
            return this;
@@ -454,10 +458,12 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan
         * @hide
         */
        @NonNull
        @RequiresPermission(anyOf = {TEST_BIOMETRIC, USE_BIOMETRIC_INTERNAL})
        public Builder setIsForLegacyFingerprintManager(int sensorId) {
            mPromptInfo.setIsForLegacyFingerprintManager(sensorId);
            return this;
        }
        // LINT.ThenChange(frameworks/base/core/java/android/hardware/biometrics/PromptInfo.java)

        /**
         * Creates a {@link BiometricPrompt}.
+6 −0
Original line number Diff line number Diff line
@@ -113,6 +113,7 @@ public class PromptInfo implements Parcelable {
        dest.writeBoolean(mIsForLegacyFingerprintManager);
    }

    // LINT.IfChange
    public boolean containsTestConfigurations() {
        if (mIsForLegacyFingerprintManager
                && mAllowedSensorIds.size() == 1
@@ -122,6 +123,10 @@ public class PromptInfo implements Parcelable {
            return true;
        } else if (mAllowBackgroundAuthentication) {
            return true;
        } else if (mIsForLegacyFingerprintManager) {
            return true;
        } else if (mIgnoreEnrollmentState) {
            return true;
        }
        return false;
    }
@@ -144,6 +149,7 @@ public class PromptInfo implements Parcelable {
        }
        return false;
    }
    // LINT.ThenChange(frameworks/base/core/java/android/hardware/biometrics/BiometricPrompt.java)

    // Setters