package com.android.billingclient.api; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Build; import android.os.Bundle; import com.google.android.gms.internal.play_billing.zzai; import com.google.android.gms.internal.play_billing.zzb; import com.google.android.gms.internal.play_billing.zzcd; import com.google.android.gms.internal.play_billing.zzga; import java.util.List; import java.util.Objects; /* loaded from: classes.dex */ final class h0 extends BroadcastReceiver { /* renamed from: a, reason: collision with root package name */ private boolean f4026a; /* renamed from: b, reason: collision with root package name */ private final boolean f4027b; /* renamed from: c, reason: collision with root package name */ final /* synthetic */ i0 f4028c; h0(i0 i0Var, boolean z10) { this.f4028c = i0Var; this.f4027b = z10; } private final void c(Bundle bundle, d dVar, int i10) { t tVar; t tVar2; if (bundle.getByteArray("FAILURE_LOGGING_PAYLOAD") == null) { tVar2 = this.f4028c.f4034c; tVar2.e(s.a(23, i10, dVar)); } else { try { tVar = this.f4028c.f4034c; tVar.e(zzga.zzA(bundle.getByteArray("FAILURE_LOGGING_PAYLOAD"), zzcd.zza())); } catch (Throwable unused) { zzb.zzk("BillingBroadcastManager", "Failed parsing Api failure."); } } } public final synchronized void a(Context context, IntentFilter intentFilter) { if (this.f4026a) { return; } if (Build.VERSION.SDK_INT >= 33) { context.registerReceiver(this, intentFilter, true != this.f4027b ? 4 : 2); } else { context.registerReceiver(this, intentFilter); } this.f4026a = true; } public final synchronized void b(Context context, IntentFilter intentFilter, String str) { if (this.f4026a) { return; } if (Build.VERSION.SDK_INT >= 33) { context.registerReceiver(this, intentFilter, "com.google.android.finsky.permission.PLAY_BILLING_LIBRARY_BROADCAST", null, true != this.f4027b ? 4 : 2); } else { context.registerReceiver(this, intentFilter, "com.google.android.finsky.permission.PLAY_BILLING_LIBRARY_BROADCAST", null); } this.f4026a = true; } @Override // android.content.BroadcastReceiver public final void onReceive(Context context, Intent intent) { n1.j jVar; t tVar; t tVar2; n1.j jVar2; n1.j jVar3; t tVar3; n1.j jVar4; n1.j jVar5; Bundle extras = intent.getExtras(); if (extras == null) { zzb.zzk("BillingBroadcastManager", "Bundle is null."); tVar3 = this.f4028c.f4034c; d dVar = u.f4083j; tVar3.e(s.a(11, 1, dVar)); i0 i0Var = this.f4028c; jVar4 = i0Var.f4033b; if (jVar4 != null) { jVar5 = i0Var.f4033b; jVar5.a(dVar, null); return; } return; } d zze = zzb.zze(intent, "BillingBroadcastManager"); String action = intent.getAction(); int i10 = true == Objects.equals(extras.getString("INTENT_SOURCE"), "LAUNCH_BILLING_FLOW") ? 2 : 1; if (action.equals("com.android.vending.billing.PURCHASES_UPDATED") || action.equals("com.android.vending.billing.LOCAL_BROADCAST_PURCHASES_UPDATED")) { List zzi = zzb.zzi(extras); if (zze.b() == 0) { tVar = this.f4028c.f4034c; tVar.c(s.c(i10)); } else { c(extras, zze, i10); } jVar = this.f4028c.f4033b; jVar.a(zze, zzi); return; } if (action.equals("com.android.vending.billing.ALTERNATIVE_BILLING")) { if (zze.b() != 0) { c(extras, zze, i10); jVar3 = this.f4028c.f4033b; jVar3.a(zze, zzai.zzk()); return; } i0 i0Var2 = this.f4028c; i0.a(i0Var2); i0.e(i0Var2); zzb.zzk("BillingBroadcastManager", "AlternativeBillingListener and UserChoiceBillingListener is null."); tVar2 = this.f4028c.f4034c; d dVar2 = u.f4083j; tVar2.e(s.a(77, i10, dVar2)); jVar2 = this.f4028c.f4033b; jVar2.a(dVar2, zzai.zzk()); } } }