package androidx.credentials.playservices;

import K1.b;
import K1.d;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.ResultReceiver;
import android.util.Log;
import androidx.credentials.playservices.HiddenActivity;
import com.google.android.gms.auth.api.identity.BeginSignInRequest;
import com.google.android.gms.auth.api.identity.BeginSignInResult;
import com.google.android.gms.auth.api.identity.GetSignInIntentRequest;
import com.google.android.gms.auth.api.identity.Identity;
import com.google.android.gms.auth.api.identity.SavePasswordRequest;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.fido.Fido;
import com.google.android.gms.fido.fido2.api.common.PublicKeyCredentialCreationOptions;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.Task;
import kotlin.jvm.internal.o;

/* JADX INFO: loaded from: classes.dex */
public class HiddenActivity extends Activity {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final /* synthetic */ int f11302c = 0;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public ResultReceiver f11303a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public boolean f11304b;

    public final void a(ResultReceiver resultReceiver, String str, String str2) {
        Bundle bundle = new Bundle();
        bundle.putBoolean("FAILURE_RESPONSE", true);
        bundle.putString("EXCEPTION_TYPE", str);
        bundle.putString("EXCEPTION_MESSAGE", str2);
        resultReceiver.send(Integer.MAX_VALUE, bundle);
        finish();
    }

    @Override // android.app.Activity
    public final void onActivityResult(int i6, int i7, Intent intent) {
        super.onActivityResult(i6, i7, intent);
        Bundle bundle = new Bundle();
        bundle.putBoolean("FAILURE_RESPONSE", false);
        bundle.putInt("ACTIVITY_REQUEST_CODE", i6);
        bundle.putParcelable("RESULT_DATA", intent);
        ResultReceiver resultReceiver = this.f11303a;
        if (resultReceiver != null) {
            resultReceiver.send(i7, bundle);
        }
        this.f11304b = false;
        finish();
    }

    /* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
    @Override // android.app.Activity
    public final void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        overridePendingTransition(0, 0);
        String stringExtra = getIntent().getStringExtra("TYPE");
        ResultReceiver resultReceiver = (ResultReceiver) getIntent().getParcelableExtra("RESULT_RECEIVER");
        this.f11303a = resultReceiver;
        if (resultReceiver == null) {
            finish();
        }
        if (bundle != null) {
            this.f11304b = bundle.getBoolean("androidx.credentials.playservices.AWAITING_RESULT", false);
        }
        if (this.f11304b) {
            return;
        }
        if (stringExtra != null) {
            Task<BeginSignInResult> taskAddOnFailureListener = null;
            switch (stringExtra.hashCode()) {
                case -441061071:
                    if (stringExtra.equals("BEGIN_SIGN_IN")) {
                        BeginSignInRequest beginSignInRequest = (BeginSignInRequest) getIntent().getParcelableExtra("REQUEST_TYPE");
                        int intExtra = getIntent().getIntExtra("ACTIVITY_REQUEST_CODE", 1);
                        if (beginSignInRequest != null) {
                            final int i6 = 3;
                            taskAddOnFailureListener = Identity.getSignInClient((Activity) this).beginSignIn(beginSignInRequest).addOnSuccessListener(new b(new d(intExtra, 0, this), 3)).addOnFailureListener(new OnFailureListener(this) { // from class: K1.c

                                /* JADX INFO: renamed from: b, reason: collision with root package name */
                                public final /* synthetic */ HiddenActivity f4043b;

                                {
                                    this.f4043b = this;
                                }

                                @Override // com.google.android.gms.tasks.OnFailureListener
                                public final void onFailure(Exception e6) {
                                    String str = "CREATE_UNKNOWN";
                                    String str2 = "GET_NO_CREDENTIALS";
                                    HiddenActivity this$0 = this.f4043b;
                                    switch (i6) {
                                        case 0:
                                            int i7 = HiddenActivity.f11302c;
                                            o.h(this$0, "this$0");
                                            o.h(e6, "e");
                                            if ((e6 instanceof ApiException) && L1.a.f4158a.contains(Integer.valueOf(((ApiException) e6).getStatusCode()))) {
                                                str = "CREATE_INTERRUPTED";
                                            }
                                            ResultReceiver resultReceiver2 = this$0.f11303a;
                                            o.e(resultReceiver2);
                                            this$0.a(resultReceiver2, str, "During create public key credential, fido registration failure: " + e6.getMessage());
                                            break;
                                        case 1:
                                            int i8 = HiddenActivity.f11302c;
                                            o.h(this$0, "this$0");
                                            o.h(e6, "e");
                                            if ((e6 instanceof ApiException) && L1.a.f4158a.contains(Integer.valueOf(((ApiException) e6).getStatusCode()))) {
                                                str = "CREATE_INTERRUPTED";
                                            }
                                            ResultReceiver resultReceiver3 = this$0.f11303a;
                                            o.e(resultReceiver3);
                                            this$0.a(resultReceiver3, str, "During save password, found password failure response from one tap " + e6.getMessage());
                                            break;
                                        case 2:
                                            int i9 = HiddenActivity.f11302c;
                                            o.h(this$0, "this$0");
                                            o.h(e6, "e");
                                            if ((e6 instanceof ApiException) && L1.a.f4158a.contains(Integer.valueOf(((ApiException) e6).getStatusCode()))) {
                                                str2 = "GET_INTERRUPTED";
                                            }
                                            ResultReceiver resultReceiver4 = this$0.f11303a;
                                            o.e(resultReceiver4);
                                            this$0.a(resultReceiver4, str2, "During get sign-in intent, failure response from one tap: " + e6.getMessage());
                                            break;
                                        default:
                                            int i10 = HiddenActivity.f11302c;
                                            o.h(this$0, "this$0");
                                            o.h(e6, "e");
                                            if ((e6 instanceof ApiException) && L1.a.f4158a.contains(Integer.valueOf(((ApiException) e6).getStatusCode()))) {
                                                str2 = "GET_INTERRUPTED";
                                            }
                                            ResultReceiver resultReceiver5 = this$0.f11303a;
                                            o.e(resultReceiver5);
                                            this$0.a(resultReceiver5, str2, "During begin sign in, failure response from one tap: " + e6.getMessage());
                                            break;
                                    }
                                }
                            });
                        }
                        if (taskAddOnFailureListener == null) {
                            Log.i("HiddenActivity", "During begin sign in, params is null, nothing to launch for begin sign in");
                            finish();
                            return;
                        }
                        return;
                    }
                    break;
                case 15545322:
                    if (stringExtra.equals("CREATE_PUBLIC_KEY_CREDENTIAL")) {
                        PublicKeyCredentialCreationOptions publicKeyCredentialCreationOptions = (PublicKeyCredentialCreationOptions) getIntent().getParcelableExtra("REQUEST_TYPE");
                        int intExtra2 = getIntent().getIntExtra("ACTIVITY_REQUEST_CODE", 1);
                        if (publicKeyCredentialCreationOptions != null) {
                            final int i7 = 0;
                            taskAddOnFailureListener = Fido.getFido2ApiClient((Activity) this).getRegisterPendingIntent(publicKeyCredentialCreationOptions).addOnSuccessListener(new b(new d(intExtra2, 2, this), 0)).addOnFailureListener(new OnFailureListener(this) { // from class: K1.c

                                /* JADX INFO: renamed from: b, reason: collision with root package name */
                                public final /* synthetic */ HiddenActivity f4043b;

                                {
                                    this.f4043b = this;
                                }

                                @Override // com.google.android.gms.tasks.OnFailureListener
                                public final void onFailure(Exception e6) {
                                    String str = "CREATE_UNKNOWN";
                                    String str2 = "GET_NO_CREDENTIALS";
                                    HiddenActivity this$0 = this.f4043b;
                                    switch (i7) {
                                        case 0:
                                            int i72 = HiddenActivity.f11302c;
                                            o.h(this$0, "this$0");
                                            o.h(e6, "e");
                                            if ((e6 instanceof ApiException) && L1.a.f4158a.contains(Integer.valueOf(((ApiException) e6).getStatusCode()))) {
                                                str = "CREATE_INTERRUPTED";
                                            }
                                            ResultReceiver resultReceiver2 = this$0.f11303a;
                                            o.e(resultReceiver2);
                                            this$0.a(resultReceiver2, str, "During create public key credential, fido registration failure: " + e6.getMessage());
                                            break;
                                        case 1:
                                            int i8 = HiddenActivity.f11302c;
                                            o.h(this$0, "this$0");
                                            o.h(e6, "e");
                                            if ((e6 instanceof ApiException) && L1.a.f4158a.contains(Integer.valueOf(((ApiException) e6).getStatusCode()))) {
                                                str = "CREATE_INTERRUPTED";
                                            }
                                            ResultReceiver resultReceiver3 = this$0.f11303a;
                                            o.e(resultReceiver3);
                                            this$0.a(resultReceiver3, str, "During save password, found password failure response from one tap " + e6.getMessage());
                                            break;
                                        case 2:
                                            int i9 = HiddenActivity.f11302c;
                                            o.h(this$0, "this$0");
                                            o.h(e6, "e");
                                            if ((e6 instanceof ApiException) && L1.a.f4158a.contains(Integer.valueOf(((ApiException) e6).getStatusCode()))) {
                                                str2 = "GET_INTERRUPTED";
                                            }
                                            ResultReceiver resultReceiver4 = this$0.f11303a;
                                            o.e(resultReceiver4);
                                            this$0.a(resultReceiver4, str2, "During get sign-in intent, failure response from one tap: " + e6.getMessage());
                                            break;
                                        default:
                                            int i10 = HiddenActivity.f11302c;
                                            o.h(this$0, "this$0");
                                            o.h(e6, "e");
                                            if ((e6 instanceof ApiException) && L1.a.f4158a.contains(Integer.valueOf(((ApiException) e6).getStatusCode()))) {
                                                str2 = "GET_INTERRUPTED";
                                            }
                                            ResultReceiver resultReceiver5 = this$0.f11303a;
                                            o.e(resultReceiver5);
                                            this$0.a(resultReceiver5, str2, "During begin sign in, failure response from one tap: " + e6.getMessage());
                                            break;
                                    }
                                }
                            });
                        }
                        if (taskAddOnFailureListener == null) {
                            Log.w("HiddenActivity", "During create public key credential, request is null, so nothing to launch for public key credentials");
                            finish();
                            return;
                        }
                        return;
                    }
                    break;
                case 1246634622:
                    if (stringExtra.equals("CREATE_PASSWORD")) {
                        SavePasswordRequest savePasswordRequest = (SavePasswordRequest) getIntent().getParcelableExtra("REQUEST_TYPE");
                        int intExtra3 = getIntent().getIntExtra("ACTIVITY_REQUEST_CODE", 1);
                        if (savePasswordRequest != null) {
                            final int i8 = 1;
                            taskAddOnFailureListener = Identity.getCredentialSavingClient((Activity) this).savePassword(savePasswordRequest).addOnSuccessListener(new b(new d(intExtra3, 1, this), 1)).addOnFailureListener(new OnFailureListener(this) { // from class: K1.c

                                /* JADX INFO: renamed from: b, reason: collision with root package name */
                                public final /* synthetic */ HiddenActivity f4043b;

                                {
                                    this.f4043b = this;
                                }

                                @Override // com.google.android.gms.tasks.OnFailureListener
                                public final void onFailure(Exception e6) {
                                    String str = "CREATE_UNKNOWN";
                                    String str2 = "GET_NO_CREDENTIALS";
                                    HiddenActivity this$0 = this.f4043b;
                                    switch (i8) {
                                        case 0:
                                            int i72 = HiddenActivity.f11302c;
                                            o.h(this$0, "this$0");
                                            o.h(e6, "e");
                                            if ((e6 instanceof ApiException) && L1.a.f4158a.contains(Integer.valueOf(((ApiException) e6).getStatusCode()))) {
                                                str = "CREATE_INTERRUPTED";
                                            }
                                            ResultReceiver resultReceiver2 = this$0.f11303a;
                                            o.e(resultReceiver2);
                                            this$0.a(resultReceiver2, str, "During create public key credential, fido registration failure: " + e6.getMessage());
                                            break;
                                        case 1:
                                            int i82 = HiddenActivity.f11302c;
                                            o.h(this$0, "this$0");
                                            o.h(e6, "e");
                                            if ((e6 instanceof ApiException) && L1.a.f4158a.contains(Integer.valueOf(((ApiException) e6).getStatusCode()))) {
                                                str = "CREATE_INTERRUPTED";
                                            }
                                            ResultReceiver resultReceiver3 = this$0.f11303a;
                                            o.e(resultReceiver3);
                                            this$0.a(resultReceiver3, str, "During save password, found password failure response from one tap " + e6.getMessage());
                                            break;
                                        case 2:
                                            int i9 = HiddenActivity.f11302c;
                                            o.h(this$0, "this$0");
                                            o.h(e6, "e");
                                            if ((e6 instanceof ApiException) && L1.a.f4158a.contains(Integer.valueOf(((ApiException) e6).getStatusCode()))) {
                                                str2 = "GET_INTERRUPTED";
                                            }
                                            ResultReceiver resultReceiver4 = this$0.f11303a;
                                            o.e(resultReceiver4);
                                            this$0.a(resultReceiver4, str2, "During get sign-in intent, failure response from one tap: " + e6.getMessage());
                                            break;
                                        default:
                                            int i10 = HiddenActivity.f11302c;
                                            o.h(this$0, "this$0");
                                            o.h(e6, "e");
                                            if ((e6 instanceof ApiException) && L1.a.f4158a.contains(Integer.valueOf(((ApiException) e6).getStatusCode()))) {
                                                str2 = "GET_INTERRUPTED";
                                            }
                                            ResultReceiver resultReceiver5 = this$0.f11303a;
                                            o.e(resultReceiver5);
                                            this$0.a(resultReceiver5, str2, "During begin sign in, failure response from one tap: " + e6.getMessage());
                                            break;
                                    }
                                }
                            });
                        }
                        if (taskAddOnFailureListener == null) {
                            Log.i("HiddenActivity", "During save password, params is null, nothing to launch for create password");
                            finish();
                            return;
                        }
                        return;
                    }
                    break;
                case 1980564212:
                    if (stringExtra.equals("SIGN_IN_INTENT")) {
                        GetSignInIntentRequest getSignInIntentRequest = (GetSignInIntentRequest) getIntent().getParcelableExtra("REQUEST_TYPE");
                        int intExtra4 = getIntent().getIntExtra("ACTIVITY_REQUEST_CODE", 1);
                        if (getSignInIntentRequest != null) {
                            final int i9 = 2;
                            taskAddOnFailureListener = Identity.getSignInClient((Activity) this).getSignInIntent(getSignInIntentRequest).addOnSuccessListener(new b(new d(intExtra4, 3, this), 2)).addOnFailureListener(new OnFailureListener(this) { // from class: K1.c

                                /* JADX INFO: renamed from: b, reason: collision with root package name */
                                public final /* synthetic */ HiddenActivity f4043b;

                                {
                                    this.f4043b = this;
                                }

                                @Override // com.google.android.gms.tasks.OnFailureListener
                                public final void onFailure(Exception e6) {
                                    String str = "CREATE_UNKNOWN";
                                    String str2 = "GET_NO_CREDENTIALS";
                                    HiddenActivity this$0 = this.f4043b;
                                    switch (i9) {
                                        case 0:
                                            int i72 = HiddenActivity.f11302c;
                                            o.h(this$0, "this$0");
                                            o.h(e6, "e");
                                            if ((e6 instanceof ApiException) && L1.a.f4158a.contains(Integer.valueOf(((ApiException) e6).getStatusCode()))) {
                                                str = "CREATE_INTERRUPTED";
                                            }
                                            ResultReceiver resultReceiver2 = this$0.f11303a;
                                            o.e(resultReceiver2);
                                            this$0.a(resultReceiver2, str, "During create public key credential, fido registration failure: " + e6.getMessage());
                                            break;
                                        case 1:
                                            int i82 = HiddenActivity.f11302c;
                                            o.h(this$0, "this$0");
                                            o.h(e6, "e");
                                            if ((e6 instanceof ApiException) && L1.a.f4158a.contains(Integer.valueOf(((ApiException) e6).getStatusCode()))) {
                                                str = "CREATE_INTERRUPTED";
                                            }
                                            ResultReceiver resultReceiver3 = this$0.f11303a;
                                            o.e(resultReceiver3);
                                            this$0.a(resultReceiver3, str, "During save password, found password failure response from one tap " + e6.getMessage());
                                            break;
                                        case 2:
                                            int i92 = HiddenActivity.f11302c;
                                            o.h(this$0, "this$0");
                                            o.h(e6, "e");
                                            if ((e6 instanceof ApiException) && L1.a.f4158a.contains(Integer.valueOf(((ApiException) e6).getStatusCode()))) {
                                                str2 = "GET_INTERRUPTED";
                                            }
                                            ResultReceiver resultReceiver4 = this$0.f11303a;
                                            o.e(resultReceiver4);
                                            this$0.a(resultReceiver4, str2, "During get sign-in intent, failure response from one tap: " + e6.getMessage());
                                            break;
                                        default:
                                            int i10 = HiddenActivity.f11302c;
                                            o.h(this$0, "this$0");
                                            o.h(e6, "e");
                                            if ((e6 instanceof ApiException) && L1.a.f4158a.contains(Integer.valueOf(((ApiException) e6).getStatusCode()))) {
                                                str2 = "GET_INTERRUPTED";
                                            }
                                            ResultReceiver resultReceiver5 = this$0.f11303a;
                                            o.e(resultReceiver5);
                                            this$0.a(resultReceiver5, str2, "During begin sign in, failure response from one tap: " + e6.getMessage());
                                            break;
                                    }
                                }
                            });
                        }
                        if (taskAddOnFailureListener == null) {
                            Log.i("HiddenActivity", "During get sign-in intent, params is null, nothing to launch for get sign-in intent");
                            finish();
                            return;
                        }
                        return;
                    }
                    break;
            }
        }
        Log.w("HiddenActivity", "Activity handed an unsupported type");
        finish();
    }

    @Override // android.app.Activity
    public final void onSaveInstanceState(Bundle outState) {
        o.h(outState, "outState");
        outState.putBoolean("androidx.credentials.playservices.AWAITING_RESULT", this.f11304b);
        super.onSaveInstanceState(outState);
    }
}
