package com.google.android.play.core.integrity;

import C3.A;
import C3.C0129e;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import androidx.media3.common.C;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.tasks.TaskCompletionSource;
import com.google.android.play.core.common.PlayCoreDialogWrapperActivity;
import com.revenuecat.purchases.amazon.purchasing.ProxyAmazonBillingActivity;

/* JADX INFO: loaded from: classes3.dex */
final class as extends C3.y {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    final TaskCompletionSource f13619a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    final C0129e f13620b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private final A f13621c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private final String f13622d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private final k f13623e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    private final Activity f13624f;

    public as(Context context, k kVar, Activity activity, TaskCompletionSource taskCompletionSource, C0129e c0129e) {
        super("com.google.android.play.core.integrity.protocol.IRequestDialogCallback");
        this.f13621c = new A("RequestDialogCallbackImpl");
        this.f13622d = context.getPackageName();
        this.f13623e = kVar;
        this.f13619a = taskCompletionSource;
        this.f13624f = activity;
        this.f13620b = c0129e;
    }

    @Override // C3.z
    public final void b(Bundle bundle) {
        this.f13620b.d(this.f13619a);
        this.f13621c.b("onRequestDialog(%s)", this.f13622d);
        ApiException apiExceptionA = this.f13623e.a(bundle);
        if (apiExceptionA != null) {
            this.f13619a.trySetException(apiExceptionA);
            return;
        }
        PendingIntent pendingIntent = (PendingIntent) bundle.getParcelable("dialog.intent");
        if (pendingIntent == null) {
            A a6 = this.f13621c;
            Object[] objArr = {this.f13622d};
            a6.getClass();
            if (Log.isLoggable("PlayCore", 6)) {
                Log.e("PlayCore", A.c(a6.f702a, "onRequestDialog(%s): got null dialog intent", objArr));
            }
            this.f13619a.trySetResult(0);
            return;
        }
        Intent intent = new Intent(this.f13624f, (Class<?>) PlayCoreDialogWrapperActivity.class);
        intent.putExtra("confirmation_intent", pendingIntent);
        intent.setFlags(C.BUFFER_FLAG_LAST_SAMPLE);
        intent.putExtra(ProxyAmazonBillingActivity.EXTRAS_RESULT_RECEIVER, new ar(this, this.f13620b.a()));
        A a7 = this.f13621c;
        Object[] objArr2 = new Object[0];
        a7.getClass();
        if (Log.isLoggable("PlayCore", 3)) {
            Log.d("PlayCore", A.c(a7.f702a, "Starting dialog intent...", objArr2));
        }
        this.f13624f.startActivityForResult(intent, 0);
    }
}
