package androidx.credentials.provider;

import android.os.Build;
import android.os.Bundle;
import androidx.biometric.r;
import androidx.credentials.provider.utils.CryptoObjectUtils;
import androidx.media3.container.NalUnitUtil;
import androidx.media3.extractor.ts.PsExtractor;
import defpackage.cr4;
import defpackage.kp6;
import defpackage.l18;
import defpackage.m38;
import defpackage.pq6;
import defpackage.s15;
import defpackage.st;
import defpackage.uz1;
import defpackage.x15;
import java.util.Set;
import kotlin.Metadata;

/* JADX INFO: loaded from: classes.dex */
@Metadata(d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0010\u0018\u0000 \u00122\u00020\u0001:\u0004\u0013\u0014\u0015\u0012B)\b\u0000\u0012\n\b\u0002\u0010\u0003\u001a\u0004\u0018\u00010\u0002\u0012\b\b\u0002\u0010\u0005\u001a\u00020\u0004\u0012\b\b\u0002\u0010\u0007\u001a\u00020\u0006¢\u0006\u0004\b\b\u0010\tB\u001f\b\u0017\u0012\n\b\u0002\u0010\u0003\u001a\u0004\u0018\u00010\u0002\u0012\b\b\u0002\u0010\u0005\u001a\u00020\u0004¢\u0006\u0004\b\b\u0010\nR\u0019\u0010\u0003\u001a\u0004\u0018\u00010\u00028\u0006¢\u0006\f\n\u0004\b\u0003\u0010\u000b\u001a\u0004\b\f\u0010\rR\u0017\u0010\u0005\u001a\u00020\u00048\u0006¢\u0006\f\n\u0004\b\u0005\u0010\u000e\u001a\u0004\b\u000f\u0010\u0010R\u0016\u0010\u0007\u001a\u00020\u00068\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u0007\u0010\u0011¨\u0006\u0016"}, d2 = {"Landroidx/credentials/provider/BiometricPromptData;", "", "Landroidx/biometric/r$c;", "cryptoObject", "", "allowedAuthenticators", "", "isCreatedFromBundle", "<init>", "(Landroidx/biometric/r$c;IZ)V", "(Landroidx/biometric/r$c;I)V", "Landroidx/biometric/r$c;", "getCryptoObject", "()Landroidx/biometric/r$c;", "I", "getAllowedAuthenticators", "()I", "Z", "Companion", "Api35Impl", "ApiMinImpl", "Builder", "credentials_release"}, k = 1, mv = {1, 8, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
public final class BiometricPromptData {

    @kp6
    public static final String BUNDLE_HINT_ALLOWED_AUTHENTICATORS = "androidx.credentials.provider.BUNDLE_HINT_ALLOWED_AUTHENTICATORS";

    @kp6
    public static final String BUNDLE_HINT_CRYPTO_OP_ID = "androidx.credentials.provider.BUNDLE_HINT_CRYPTO_OP_ID";

    @kp6
    private static final String TAG = "BiometricPromptData";
    private final int allowedAuthenticators;

    @pq6
    private final r.c cryptoObject;
    private boolean isCreatedFromBundle;

    /* JADX INFO: renamed from: Companion, reason: from kotlin metadata */
    @kp6
    public static final Companion INSTANCE = new Companion(null);

    @kp6
    private static final Set<Integer> ALLOWED_AUTHENTICATOR_VALUES = st.ao(new Integer[]{15, 255, 32768, 32783, 33023});

    @l18
    @Metadata(d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\bÃ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0007J\u0010\u0010\u0007\u001a\u00020\u00062\u0006\u0010\b\u001a\u00020\u0004H\u0007¨\u0006\t"}, d2 = {"Landroidx/credentials/provider/BiometricPromptData$Api35Impl;", "", "()V", "fromBundle", "Landroidx/credentials/provider/BiometricPromptData;", "bundle", "Landroid/os/Bundle;", "toBundle", "biometricPromptData", "credentials_release"}, k = 1, mv = {1, 8, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class Api35Impl {

        @kp6
        public static final Api35Impl INSTANCE = new Api35Impl();

        private Api35Impl() {
        }

        @m38
        @x15
        @kp6
        public static final BiometricPromptData fromBundle(@kp6 Bundle bundle) {
            cr4.g(bundle, "bundle");
            return new BiometricPromptData(null, bundle.getInt(BiometricPromptData.BUNDLE_HINT_ALLOWED_AUTHENTICATORS), true);
        }

        @m38
        @x15
        @kp6
        public static final Bundle toBundle(@kp6 BiometricPromptData biometricPromptData) {
            cr4.g(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;
        }
    }

    @Metadata(d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\bÂ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0007J\u0010\u0010\u0007\u001a\u00020\u00062\u0006\u0010\b\u001a\u00020\u0004H\u0007¨\u0006\t"}, d2 = {"Landroidx/credentials/provider/BiometricPromptData$ApiMinImpl;", "", "()V", "fromBundle", "Landroidx/credentials/provider/BiometricPromptData;", "bundle", "Landroid/os/Bundle;", "toBundle", "biometricPromptData", "credentials_release"}, k = 1, mv = {1, 8, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class ApiMinImpl {

        @kp6
        public static final ApiMinImpl INSTANCE = new ApiMinImpl();

        private ApiMinImpl() {
        }

        @m38
        @x15
        @kp6
        public static final BiometricPromptData fromBundle(@kp6 Bundle bundle) {
            cr4.g(bundle, "bundle");
            return new BiometricPromptData(null, bundle.getInt(BiometricPromptData.BUNDLE_HINT_ALLOWED_AUTHENTICATORS), true, 1, null);
        }

        @m38
        @x15
        @kp6
        public static final Bundle toBundle(@kp6 BiometricPromptData biometricPromptData) {
            cr4.g(biometricPromptData, "biometricPromptData");
            Bundle bundle = new Bundle();
            bundle.putInt(BiometricPromptData.BUNDLE_HINT_ALLOWED_AUTHENTICATORS, biometricPromptData.getAllowedAuthenticators());
            return bundle;
        }
    }

    @Metadata(d1 = {"\u0000$\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\u0002\u0010\u0003J\u0017\u0010\u0006\u001a\u00020\u00002\b\u0010\u0005\u001a\u0004\u0018\u00010\u0004¢\u0006\u0004\b\u0006\u0010\u0007J\u0015\u0010\n\u001a\u00020\u00002\u0006\u0010\t\u001a\u00020\b¢\u0006\u0004\b\n\u0010\u000bJ\r\u0010\r\u001a\u00020\f¢\u0006\u0004\b\r\u0010\u000eR\u0018\u0010\u0005\u001a\u0004\u0018\u00010\u00048\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u0005\u0010\u000fR\u0018\u0010\t\u001a\u0004\u0018\u00010\b8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\t\u0010\u0010¨\u0006\u0011"}, d2 = {"Landroidx/credentials/provider/BiometricPromptData$Builder;", "", "<init>", "()V", "Landroidx/biometric/r$c;", "cryptoObject", "setCryptoObject", "(Landroidx/biometric/r$c;)Landroidx/credentials/provider/BiometricPromptData$Builder;", "", "allowedAuthenticators", "setAllowedAuthenticators", "(I)Landroidx/credentials/provider/BiometricPromptData$Builder;", "Landroidx/credentials/provider/BiometricPromptData;", "build", "()Landroidx/credentials/provider/BiometricPromptData;", "Landroidx/biometric/r$c;", "Ljava/lang/Integer;", "credentials_release"}, k = 1, mv = {1, 8, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class Builder {

        @pq6
        private Integer allowedAuthenticators;

        @pq6
        private r.c cryptoObject;

        @kp6
        public final BiometricPromptData build() {
            Integer num = this.allowedAuthenticators;
            return new BiometricPromptData(this.cryptoObject, num != null ? num.intValue() : 255);
        }

        @kp6
        public final Builder setAllowedAuthenticators(int allowedAuthenticators) {
            this.allowedAuthenticators = Integer.valueOf(allowedAuthenticators);
            return this;
        }

        @kp6
        public final Builder setCryptoObject(@pq6 r.c cryptoObject) {
            this.cryptoObject = cryptoObject;
            return this;
        }
    }

    @Metadata(d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\"\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0005\b\u0080\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0012\u0010\n\u001a\u0004\u0018\u00010\u000b2\u0006\u0010\f\u001a\u00020\rH\u0007J\u0017\u0010\u000e\u001a\u00020\u000f2\b\u0010\u0010\u001a\u0004\u0018\u00010\u0005H\u0002¢\u0006\u0002\u0010\u0011J\u0010\u0010\u0012\u001a\u00020\r2\u0006\u0010\u0013\u001a\u00020\u000bH\u0007R\u0014\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\u0007X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\u0007X\u0082T¢\u0006\u0002\n\u0000¨\u0006\u0014"}, d2 = {"Landroidx/credentials/provider/BiometricPromptData$Companion;", "", "()V", "ALLOWED_AUTHENTICATOR_VALUES", "", "", "BUNDLE_HINT_ALLOWED_AUTHENTICATORS", "", "BUNDLE_HINT_CRYPTO_OP_ID", "TAG", "fromBundle", "Landroidx/credentials/provider/BiometricPromptData;", "bundle", "Landroid/os/Bundle;", "isStrongAuthenticationType", "", "authenticationTypes", "(Ljava/lang/Integer;)Z", "toBundle", "biometricPromptData", "credentials_release"}, k = 1, mv = {1, 8, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class Companion {
        public /* synthetic */ Companion(uz1 uz1Var) {
            this();
        }

        /* JADX INFO: Access modifiers changed from: private */
        public final boolean isStrongAuthenticationType(Integer authenticationTypes) {
            return authenticationTypes != null && (authenticationTypes.intValue() & PsExtractor.VIDEO_STREAM_MASK) == 0;
        }

        @m38
        @pq6
        @x15
        public final BiometricPromptData fromBundle(@kp6 Bundle bundle) {
            cr4.g(bundle, "bundle");
            try {
                if (bundle.containsKey(BiometricPromptData.BUNDLE_HINT_ALLOWED_AUTHENTICATORS)) {
                    return Build.VERSION.SDK_INT >= 35 ? Api35Impl.fromBundle(bundle) : ApiMinImpl.fromBundle(bundle);
                }
                throw new IllegalArgumentException("Bundle lacks allowed authenticator key.");
            } catch (Exception e) {
                e.getMessage();
                return null;
            }
        }

        @m38
        @x15
        @kp6
        public final Bundle toBundle(@kp6 BiometricPromptData biometricPromptData) {
            cr4.g(biometricPromptData, "biometricPromptData");
            return Build.VERSION.SDK_INT >= 35 ? Api35Impl.toBundle(biometricPromptData) : ApiMinImpl.toBundle(biometricPromptData);
        }

        private Companion() {
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    @s15
    public BiometricPromptData() {
        this(null, 0, 3, 0 == true ? 1 : 0);
    }

    @m38
    @pq6
    @x15
    public static final BiometricPromptData fromBundle(@kp6 Bundle bundle) {
        return INSTANCE.fromBundle(bundle);
    }

    @m38
    @x15
    @kp6
    public static final Bundle toBundle(@kp6 BiometricPromptData biometricPromptData) {
        return INSTANCE.toBundle(biometricPromptData);
    }

    public final int getAllowedAuthenticators() {
        return this.allowedAuthenticators;
    }

    @pq6
    public final r.c getCryptoObject() {
        return this.cryptoObject;
    }

    @s15
    public BiometricPromptData(@pq6 r.c cVar) {
        this(cVar, 0, 2, null);
    }

    public BiometricPromptData(@pq6 r.c cVar, int i, boolean z) {
        this.cryptoObject = cVar;
        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.");
        }
        if (cVar != null && !INSTANCE.isStrongAuthenticationType(Integer.valueOf(i))) {
            throw new IllegalArgumentException("If the cryptoObject is non-null, the allowedAuthenticator value must be Authenticators.BIOMETRIC_STRONG.");
        }
    }

    public /* synthetic */ BiometricPromptData(r.c cVar, int i, boolean z, int i2, uz1 uz1Var) {
        this((i2 & 1) != 0 ? null : cVar, (i2 & 2) != 0 ? 255 : i, (i2 & 4) != 0 ? false : z);
    }

    public /* synthetic */ BiometricPromptData(r.c cVar, int i, int i2, uz1 uz1Var) {
        this((i2 & 1) != 0 ? null : cVar, (i2 & 2) != 0 ? 255 : i);
    }

    @s15
    public BiometricPromptData(@pq6 r.c cVar, int i) {
        this(cVar, i, false);
    }
}
