package c.d.a.a; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Bundle; import c.i.a.f.h.n.a; import com.android.billingclient.api.BillingResult; import com.android.billingclient.api.Purchase; import java.util.ArrayList; /* compiled from: com.android.billingclient:billing@@4.0.0 */ public final class r extends BroadcastReceiver { public final g a; public boolean b; /* renamed from: c reason: collision with root package name */ public final /* synthetic */ s f352c; public /* synthetic */ r(s sVar, g gVar) { this.f352c = sVar; this.a = gVar; } @Override // android.content.BroadcastReceiver public final void onReceive(Context context, Intent intent) { BillingResult c2 = a.c(intent, "BillingBroadcastManager"); Bundle extras = intent.getExtras(); ArrayList arrayList = null; if (extras != null) { ArrayList stringArrayList = extras.getStringArrayList("INAPP_PURCHASE_DATA_LIST"); ArrayList stringArrayList2 = extras.getStringArrayList("INAPP_DATA_SIGNATURE_LIST"); ArrayList arrayList2 = new ArrayList(); if (stringArrayList == null || stringArrayList2 == null) { a.f("BillingHelper", "Couldn't find purchase lists, trying to find single data."); Purchase g = a.g(extras.getString("INAPP_PURCHASE_DATA"), extras.getString("INAPP_DATA_SIGNATURE")); if (g == null) { a.f("BillingHelper", "Couldn't find single purchase data as well."); } else { arrayList2.add(g); } } else { int i = 0; while (i < stringArrayList.size() && i < stringArrayList2.size()) { Purchase g2 = a.g(stringArrayList.get(i), stringArrayList2.get(i)); if (g2 != null) { arrayList2.add(g2); } i++; } } arrayList = arrayList2; } this.a.onPurchasesUpdated(c2, arrayList); } }