package com.android.billingclient.api; import android.app.PendingIntent; import android.content.Intent; import android.os.Bundle; import android.os.ResultReceiver; import androidx.activity.ComponentActivity; import androidx.activity.result.e; import com.google.android.apps.common.proguard.UsedByReflection; import com.google.android.gms.internal.play_billing.zzb; @UsedByReflection("PlatformActivityProxy") /* loaded from: classes.dex */ public class ProxyBillingActivityV2 extends ComponentActivity { /* renamed from: a, reason: collision with root package name */ private androidx.activity.result.c f3894a; /* renamed from: b, reason: collision with root package name */ private androidx.activity.result.c f3895b; /* renamed from: c, reason: collision with root package name */ private ResultReceiver f3896c; /* renamed from: d, reason: collision with root package name */ private ResultReceiver f3897d; final void e(androidx.activity.result.a aVar) { Intent a10 = aVar.a(); int b10 = zzb.zze(a10, "ProxyBillingActivityV2").b(); ResultReceiver resultReceiver = this.f3896c; if (resultReceiver != null) { resultReceiver.send(b10, a10 == null ? null : a10.getExtras()); } if (aVar.b() != -1 || b10 != 0) { zzb.zzk("ProxyBillingActivityV2", "Alternative billing only dialog finished with resultCode " + aVar.b() + " and billing's responseCode: " + b10); } finish(); } final void f(androidx.activity.result.a aVar) { Intent a10 = aVar.a(); int b10 = zzb.zze(a10, "ProxyBillingActivityV2").b(); ResultReceiver resultReceiver = this.f3897d; if (resultReceiver != null) { resultReceiver.send(b10, a10 == null ? null : a10.getExtras()); } if (aVar.b() != -1 || b10 != 0) { zzb.zzk("ProxyBillingActivityV2", String.format("External offer dialog finished with resultCode: %s and billing's responseCode: %s", Integer.valueOf(aVar.b()), Integer.valueOf(b10))); } finish(); } @Override // androidx.activity.ComponentActivity, androidx.core.app.j, android.app.Activity protected final void onCreate(Bundle bundle) { super.onCreate(bundle); this.f3894a = registerForActivityResult(new c.d(), new androidx.activity.result.b() { // from class: com.android.billingclient.api.d0 @Override // androidx.activity.result.b public final void a(Object obj) { ProxyBillingActivityV2.this.e((androidx.activity.result.a) obj); } }); this.f3895b = registerForActivityResult(new c.d(), new androidx.activity.result.b() { // from class: com.android.billingclient.api.e0 @Override // androidx.activity.result.b public final void a(Object obj) { ProxyBillingActivityV2.this.f((androidx.activity.result.a) obj); } }); if (bundle != null) { if (bundle.containsKey("alternative_billing_only_dialog_result_receiver")) { this.f3896c = (ResultReceiver) bundle.getParcelable("alternative_billing_only_dialog_result_receiver"); return; } else { if (bundle.containsKey("external_payment_dialog_result_receiver")) { this.f3897d = (ResultReceiver) bundle.getParcelable("external_payment_dialog_result_receiver"); return; } return; } } zzb.zzj("ProxyBillingActivityV2", "Launching Play Store billing dialog"); if (getIntent().hasExtra("ALTERNATIVE_BILLING_ONLY_DIALOG_INTENT")) { PendingIntent pendingIntent = (PendingIntent) getIntent().getParcelableExtra("ALTERNATIVE_BILLING_ONLY_DIALOG_INTENT"); this.f3896c = (ResultReceiver) getIntent().getParcelableExtra("alternative_billing_only_dialog_result_receiver"); this.f3894a.a(new e.b(pendingIntent).a()); } else if (getIntent().hasExtra("external_payment_dialog_pending_intent")) { PendingIntent pendingIntent2 = (PendingIntent) getIntent().getParcelableExtra("external_payment_dialog_pending_intent"); this.f3897d = (ResultReceiver) getIntent().getParcelableExtra("external_payment_dialog_result_receiver"); this.f3895b.a(new e.b(pendingIntent2).a()); } } @Override // androidx.activity.ComponentActivity, androidx.core.app.j, android.app.Activity protected final void onSaveInstanceState(Bundle bundle) { super.onSaveInstanceState(bundle); ResultReceiver resultReceiver = this.f3896c; if (resultReceiver != null) { bundle.putParcelable("alternative_billing_only_dialog_result_receiver", resultReceiver); } ResultReceiver resultReceiver2 = this.f3897d; if (resultReceiver2 != null) { bundle.putParcelable("external_payment_dialog_result_receiver", resultReceiver2); } } }