package defpackage;

import android.os.BadParcelableException;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
import j$.util.Objects;
import java.util.Arrays;

/* JADX INFO: renamed from: ᵙ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class BinderC2615 extends AbstractBinderC0880 {

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public final Boolean f10131;

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public final /* synthetic */ C2780 f10132;

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public final ServiceConnectionC4611 f10133;

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public final int f10134;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public BinderC2615(C2780 c2780, ServiceConnectionC4611 serviceConnectionC4611, Boolean bool, int i) {
        super(1, "com.android.vending.billing.IInAppBillingInitializeCallback");
        Objects.requireNonNull(c2780);
        this.f10132 = c2780;
        this.f10133 = serviceConnectionC4611;
        this.f10131 = bool;
        this.f10134 = i;
    }

    @Override // defpackage.AbstractBinderC0880
    /* JADX INFO: renamed from: ˁˌᵩ */
    public final boolean mo3079(Parcel parcel, int i) {
        AbstractC5437 c4795;
        if (i != 1) {
            return false;
        }
        Parcelable.Creator creator = Bundle.CREATOR;
        Bundle bundle = (Bundle) AbstractC2284.m5896(parcel);
        int iDataAvail = parcel.dataAvail();
        if (iDataAvail > 0) {
            throw new BadParcelableException(AbstractC2704.m6517(iDataAvail, "Parcel data not fully consumed, unread size: "));
        }
        if (bundle == null) {
            int i2 = AbstractC2252.f8911;
            Log.isLoggable("BillingClient", 5);
            m6339(this.f10133, AbstractC4228.f16117, 122, this.f10131.booleanValue(), null, this.f10134);
            return true;
        }
        if (!bundle.containsKey("RESPONSE_CODE")) {
            int i3 = AbstractC2252.f8911;
            Log.isLoggable("BillingClient", 5);
            m6339(this.f10133, AbstractC4228.f16117, 129, this.f10131.booleanValue(), null, this.f10134);
            return true;
        }
        if (bundle.getInt("RESPONSE_CODE") != 0) {
            m6339(this.f10133, AbstractC4228.m9200(bundle.getInt("RESPONSE_CODE"), bundle.getString("DEBUG_MESSAGE", "")), 130, this.f10131.booleanValue(), AbstractC2704.m6517(bundle.getInt("RESPONSE_CODE"), "Response code from Phonesky: "), this.f10134);
            return true;
        }
        if (!bundle.containsKey("BILLING_API_VERSION_KEY")) {
            int i4 = AbstractC2252.f8911;
            Log.isLoggable("BillingClient", 5);
            m6339(this.f10133, AbstractC4228.f16117, 128, this.f10131.booleanValue(), null, this.f10134);
            return true;
        }
        int i5 = bundle.getInt("BILLING_API_VERSION_KEY");
        C2780 c2780 = this.f10132;
        C2780.m6708(c2780, i5);
        c2780.f10687 = i5 >= 3;
        Bundle bundle2 = bundle.getBundle("EXPERIMENT_VALUES_KEY");
        if (bundle2 != null) {
            try {
                bundle2.getBoolean("DELEGATION_API_ENABLED_KEY");
            } catch (Throwable unused) {
                "Error reading EnableDelegationApi experiment flag: ".concat(bundle2.toString());
                AbstractC2252.m5866("BillingClient");
            }
            try {
                ᵸᵺᵜ.ᵮᵣᵗˈ = bundle2.getLong("AUTO_SERVICE_RECONNECTION_SYNCHRONOUS_TIMEOUT_MS_KEY");
            } catch (Throwable unused2) {
                "Error reading AutoServiceReconnectionSynchronousTimeoutMs experiment flag: ".concat(bundle2.toString());
                AbstractC2252.m5866("BillingClient");
            }
            try {
                ᵸᵺᵜ.ᵝᵶ = bundle2.getLong("AUTO_SERVICE_RECONNECTION_ASYNCHRONOUS_TIMEOUT_MS_KEY");
            } catch (Throwable unused3) {
                "Error reading AutoServiceReconnectionAsynchronousTimeoutMs experiment flag: ".concat(bundle2.toString());
                AbstractC2252.m5866("BillingClient");
            }
            try {
                ᵸᵺᵜ.ˋˈ = bundle2.getInt("AUTO_SERVICE_RECONNECTION_MAX_NUM_RETRIES_KEY");
            } catch (Throwable unused4) {
                "Error reading AutoServiceReconnectionMaxNumRetries experiment flag: ".concat(bundle2.toString());
                AbstractC2252.m5866("BillingClient");
            }
            try {
                ᵸᵺᵜ.ᵪᵹᵥᵻ = bundle2.getBoolean("ENABLE_DEDUPLICATE_SERVICE_DISCONNECTED_CALLBACK");
            } catch (Throwable unused5) {
                "Error reading EnableDeduplicateServiceDisconnectedCallback experiment flag: ".concat(bundle2.toString());
                AbstractC2252.m5866("BillingClient");
            }
        }
        Bundle bundle3 = bundle.getBundle("ENABLED_SUBSCRIPTION_CLIENT_ACTIONS_KEY");
        if (bundle3 != null) {
            Object[] objArrCopyOf = new Object[4];
            int i6 = 0;
            for (EnumC3831 enumC3831 : EnumC3831.values()) {
                if (bundle3.getBoolean(enumC3831.name(), false)) {
                    int length = objArrCopyOf.length;
                    int i7 = i6 + 1;
                    int i8 = ᵸˊʾᵜ.ˊᵡᵗʨ(length, i7);
                    if (i8 > length) {
                        objArrCopyOf = Arrays.copyOf(objArrCopyOf, i8);
                    }
                    objArrCopyOf[i6] = enumC3831;
                    i6 = i7;
                }
            }
            C2780 c27802 = this.f10132;
            if (i6 == 0) {
                c4795 = C0100.f1357;
            } else if (i6 != 1) {
                c4795 = AbstractC5437.m11069(i6, objArrCopyOf);
                c4795.size();
            } else {
                Object obj = objArrCopyOf[0];
                Objects.requireNonNull(obj);
                c4795 = new C4795(obj);
            }
            c27802.f10695 = c4795;
            if (c27802.f10692 != null) {
                c27802.f10692.ᵵᵽ = c27802.f10695;
            }
        }
        C2780 c27803 = this.f10132;
        if (c27803.f10702 < 3) {
            int i9 = AbstractC2252.f8911;
            Log.isLoggable("BillingClient", 5);
            m6339(this.f10133, AbstractC4228.f16114, 36, this.f10131.booleanValue(), null, this.f10134);
        } else {
            ServiceConnectionC4611 serviceConnectionC4611 = this.f10133;
            Boolean bool = this.f10131;
            int i10 = this.f10134;
            boolean zBooleanValue = bool.booleanValue();
            C2780.m6710(c27803, 0);
            synchronized (c27803.f10680) {
                try {
                    if (c27803.f10688 != 3) {
                        serviceConnectionC4611.m9726(i10, zBooleanValue);
                        serviceConnectionC4611.m9723(AbstractC4228.f16131);
                    }
                } finally {
                }
            }
        }
        return true;
    }

    /* JADX INFO: renamed from: ˊᵾʽʼ, reason: contains not printable characters */
    public final void m6339(ServiceConnectionC4611 serviceConnectionC4611, C1591 c1591, int i, boolean z, String str, int i2) {
        this.f10132.m6736(0);
        serviceConnectionC4611.m9722(c1591, i, str, z, i2);
        serviceConnectionC4611.m9723(c1591);
    }
}
