package androidx.credentials.provider; import android.os.Build; import android.os.Bundle; import androidx.annotation.RequiresApi; import androidx.annotation.RestrictTo; import androidx.biometric.BiometricPrompt; import androidx.credentials.provider.utils.CryptoObjectUtils; import com.mbridge.msdk.playercommon.exoplayer2.extractor.ts.PsExtractor; import java.util.Set; import kotlin.collections.SetsKt__SetsKt; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; /* loaded from: classes.dex */ public final class BiometricPromptData { private static final Set ALLOWED_AUTHENTICATOR_VALUES; public static final String BUNDLE_HINT_ALLOWED_AUTHENTICATORS = "androidx.credentials.provider.BUNDLE_HINT_ALLOWED_AUTHENTICATORS"; public static final String BUNDLE_HINT_CRYPTO_OP_ID = "androidx.credentials.provider.BUNDLE_HINT_CRYPTO_OP_ID"; public static final Companion Companion = new Companion(null); private static final String TAG = "BiometricPromptData"; private final int allowedAuthenticators; private final BiometricPrompt.CryptoObject cryptoObject; private boolean isCreatedFromBundle; /* JADX WARN: Multi-variable type inference failed */ public BiometricPromptData() { this(null, 0, 3, 0 == true ? 1 : 0); } public BiometricPromptData(BiometricPrompt.CryptoObject cryptoObject) { this(cryptoObject, 0, 2, null); } @RestrictTo({RestrictTo.Scope.LIBRARY}) public static final BiometricPromptData fromBundle(Bundle bundle) { return Companion.fromBundle(bundle); } @RestrictTo({RestrictTo.Scope.LIBRARY}) public static final Bundle toBundle(BiometricPromptData biometricPromptData) { return Companion.toBundle(biometricPromptData); } public final int getAllowedAuthenticators() { return this.allowedAuthenticators; } public final BiometricPrompt.CryptoObject getCryptoObject() { return this.cryptoObject; } public BiometricPromptData(BiometricPrompt.CryptoObject cryptoObject, int i, boolean z) { this.cryptoObject = cryptoObject; this.allowedAuthenticators = i; this.isCreatedFromBundle = z; if (!z && !ALLOWED_AUTHENTICATOR_VALUES.contains(Integer.valueOf(i))) { throw new IllegalArgumentException("The allowed authenticator must be specified according to the BiometricPrompt spec.".toString()); } if (cryptoObject != null && !Companion.isStrongAuthenticationType(Integer.valueOf(i))) { throw new IllegalArgumentException("If the cryptoObject is non-null, the allowedAuthenticator value must be Authenticators.BIOMETRIC_STRONG.".toString()); } } public /* synthetic */ BiometricPromptData(BiometricPrompt.CryptoObject cryptoObject, int i, boolean z, int i2, DefaultConstructorMarker defaultConstructorMarker) { this((i2 & 1) != 0 ? null : cryptoObject, (i2 & 2) != 0 ? 255 : i, (i2 & 4) != 0 ? false : z); } public /* synthetic */ BiometricPromptData(BiometricPrompt.CryptoObject cryptoObject, int i, int i2, DefaultConstructorMarker defaultConstructorMarker) { this((i2 & 1) != 0 ? null : cryptoObject, (i2 & 2) != 0 ? 255 : i); } public BiometricPromptData(BiometricPrompt.CryptoObject cryptoObject, int i) { this(cryptoObject, i, false); } public static final class Companion { public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } private Companion() { } @RestrictTo({RestrictTo.Scope.LIBRARY}) public final BiometricPromptData fromBundle(Bundle bundle) { Intrinsics.checkNotNullParameter(bundle, "bundle"); try { if (!bundle.containsKey(BiometricPromptData.BUNDLE_HINT_ALLOWED_AUTHENTICATORS)) { throw new IllegalArgumentException("Bundle lacks allowed authenticator key."); } if (Build.VERSION.SDK_INT >= 35) { return Api35Impl.fromBundle(bundle); } return ApiMinImpl.fromBundle(bundle); } catch (Exception e) { StringBuilder sb = new StringBuilder(); sb.append("fromSlice failed with: "); sb.append(e.getMessage()); return null; } } @RestrictTo({RestrictTo.Scope.LIBRARY}) public final Bundle toBundle(BiometricPromptData biometricPromptData) { Intrinsics.checkNotNullParameter(biometricPromptData, "biometricPromptData"); if (Build.VERSION.SDK_INT >= 35) { return Api35Impl.toBundle(biometricPromptData); } return ApiMinImpl.toBundle(biometricPromptData); } /* JADX INFO: Access modifiers changed from: private */ public final boolean isStrongAuthenticationType(Integer num) { return num != null && (num.intValue() & PsExtractor.VIDEO_STREAM_MASK) == 0; } } static { Set of; of = SetsKt__SetsKt.setOf((Object[]) new Integer[]{15, 255, 32768, 32783, 33023}); ALLOWED_AUTHENTICATOR_VALUES = of; } public static final class Builder { private Integer allowedAuthenticators; private BiometricPrompt.CryptoObject cryptoObject; public final Builder setCryptoObject(BiometricPrompt.CryptoObject cryptoObject) { this.cryptoObject = cryptoObject; return this; } public final Builder setAllowedAuthenticators(int i) { this.allowedAuthenticators = Integer.valueOf(i); return this; } public final BiometricPromptData build() { Integer num = this.allowedAuthenticators; return new BiometricPromptData(this.cryptoObject, num != null ? num.intValue() : 255); } } public static final class ApiMinImpl { public static final ApiMinImpl INSTANCE = new ApiMinImpl(); private ApiMinImpl() { } @RestrictTo({RestrictTo.Scope.LIBRARY}) public static final Bundle toBundle(BiometricPromptData biometricPromptData) { Intrinsics.checkNotNullParameter(biometricPromptData, "biometricPromptData"); Bundle bundle = new Bundle(); bundle.putInt(BiometricPromptData.BUNDLE_HINT_ALLOWED_AUTHENTICATORS, biometricPromptData.getAllowedAuthenticators()); return bundle; } @RestrictTo({RestrictTo.Scope.LIBRARY}) public static final BiometricPromptData fromBundle(Bundle bundle) { Intrinsics.checkNotNullParameter(bundle, "bundle"); return new BiometricPromptData(null, bundle.getInt(BiometricPromptData.BUNDLE_HINT_ALLOWED_AUTHENTICATORS), true, 1, null); } } @RequiresApi(35) public static final class Api35Impl { public static final Api35Impl INSTANCE = new Api35Impl(); private Api35Impl() { } @RestrictTo({RestrictTo.Scope.LIBRARY}) public static final Bundle toBundle(BiometricPromptData biometricPromptData) { Intrinsics.checkNotNullParameter(biometricPromptData, "biometricPromptData"); Bundle bundle = new Bundle(); bundle.putInt(BiometricPromptData.BUNDLE_HINT_ALLOWED_AUTHENTICATORS, biometricPromptData.getAllowedAuthenticators()); if (biometricPromptData.getCryptoObject() != null) { bundle.putLong(BiometricPromptData.BUNDLE_HINT_CRYPTO_OP_ID, CryptoObjectUtils.INSTANCE.getOperationHandle(biometricPromptData.getCryptoObject())); } return bundle; } @RestrictTo({RestrictTo.Scope.LIBRARY}) public static final BiometricPromptData fromBundle(Bundle bundle) { Intrinsics.checkNotNullParameter(bundle, "bundle"); return new BiometricPromptData(null, bundle.getInt(BiometricPromptData.BUNDLE_HINT_ALLOWED_AUTHENTICATORS), true); } } }