package defpackage;

import android.accounts.Account;
import android.content.Context;
import android.os.Bundle;
import android.os.DeadObjectException;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Looper;
import android.os.RemoteException;
import com.google.android.gms.common.api.Scope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;

/* JADX INFO: renamed from: ʿᵩᵬ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public abstract class AbstractC0459 {

    /* JADX INFO: renamed from: ᵞᵛᵘ, reason: contains not printable characters */
    public static final C4625[] f2516 = new C4625[0];

    /* JADX INFO: renamed from: ʿٴˇ, reason: contains not printable characters */
    public IInterface f2518;

    /* JADX INFO: renamed from: ˀᵭ, reason: contains not printable characters */
    public final InterfaceC2356 f2519;

    /* JADX INFO: renamed from: ˉᵵᵜ, reason: contains not printable characters */
    public ServiceConnectionC2237 f2523;

    /* JADX INFO: renamed from: ˊᵡᵗʨ, reason: contains not printable characters */
    public final int f2524;

    /* JADX INFO: renamed from: ˊᵾʽʼ, reason: contains not printable characters */
    public final InterfaceC3738 f2525;

    /* JADX INFO: renamed from: ˑˊᵲ, reason: contains not printable characters */
    public InterfaceC2624 f2529;

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public final Context f2530;

    /* JADX INFO: renamed from: ᵛˑﹳ, reason: contains not printable characters */
    public final String f2531;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public C3789 f2532;

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public final C4569 f2535;

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public final C5073 f2536;

    /* JADX INFO: renamed from: ᵵᵬᵽ, reason: contains not printable characters */
    public volatile String f2537;

    /* JADX INFO: renamed from: ᵶˇᵱ, reason: contains not printable characters */
    public final HandlerC3109 f2538;

    /* JADX INFO: renamed from: ᵸˆˁ, reason: contains not printable characters */
    public C3959 f2539;

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public volatile String f2526 = null;

    /* JADX INFO: renamed from: ˈᵲᵢ, reason: contains not printable characters */
    public final Object f2521 = new Object();

    /* JADX INFO: renamed from: ˌᵨʠᵫ, reason: contains not printable characters */
    public final Object f2527 = new Object();

    /* JADX INFO: renamed from: ᵠˏˏ, reason: contains not printable characters */
    public final ArrayList f2533 = new ArrayList();

    /* JADX INFO: renamed from: ˁˌᵩ, reason: contains not printable characters */
    public int f2520 = 1;

    /* JADX INFO: renamed from: ˑʢ, reason: contains not printable characters */
    public C2646 f2528 = null;

    /* JADX INFO: renamed from: ʽᵡᵢᵾ, reason: contains not printable characters */
    public boolean f2517 = false;

    /* JADX INFO: renamed from: ˈⁱᵡ, reason: contains not printable characters */
    public volatile C0318 f2522 = null;

    /* JADX INFO: renamed from: ᵨˈʼﹶ, reason: contains not printable characters */
    public final AtomicInteger f2534 = new AtomicInteger(0);

    public AbstractC0459(Context context, Looper looper, C4569 c4569, C5073 c5073, int i, InterfaceC2356 interfaceC2356, InterfaceC3738 interfaceC3738, String str) {
        ᵘᵞʿⁱ.ᵮᵣᵗˈ(context, "Context must not be null");
        this.f2530 = context;
        ᵘᵞʿⁱ.ᵮᵣᵗˈ(looper, "Looper must not be null");
        ᵘᵞʿⁱ.ᵮᵣᵗˈ(c4569, "Supervisor must not be null");
        this.f2535 = c4569;
        ᵘᵞʿⁱ.ᵮᵣᵗˈ(c5073, "API availability must not be null");
        this.f2536 = c5073;
        this.f2538 = new HandlerC3109(this, looper);
        this.f2524 = i;
        this.f2519 = interfaceC2356;
        this.f2525 = interfaceC3738;
        this.f2531 = str;
    }

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final void m1897(String str) {
        this.f2526 = str;
        m1912();
    }

    /* JADX INFO: renamed from: ˉᵲ, reason: contains not printable characters */
    public Set mo1898() {
        return Collections.EMPTY_SET;
    }

    /* JADX INFO: renamed from: ˊᵙᵾᵲ, reason: contains not printable characters */
    public Bundle mo1899() {
        return new Bundle();
    }

    /* JADX INFO: renamed from: ˊᵨᵧ, reason: contains not printable characters */
    public abstract String mo1900();

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public abstract int mo1901();

    /* JADX INFO: renamed from: ˋˈ, reason: contains not printable characters */
    public abstract IInterface mo1902(IBinder iBinder);

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public abstract String mo1903();

    /* JADX INFO: renamed from: ˏːˆ, reason: contains not printable characters */
    public final IInterface m1904() {
        IInterface iInterface;
        synchronized (this.f2521) {
            try {
                if (this.f2520 == 5) {
                    throw new DeadObjectException();
                }
                if (!m1917()) {
                    throw new IllegalStateException("Not connected. Call connect() and wait for onConnected() to be called.");
                }
                iInterface = this.f2518;
                ᵘᵞʿⁱ.ᵮᵣᵗˈ(iInterface, "Client is connected but service is null");
            } catch (Throwable th) {
                throw th;
            }
        }
        return iInterface;
    }

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final void m1905(C2198 c2198) {
        ((C1394) c2198.f8735).f5763.f12588.post(new RunnableC1500(28, c2198));
    }

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public final /* synthetic */ boolean m1906(int i, int i2, IInterface iInterface) {
        synchronized (this.f2521) {
            try {
                if (this.f2520 != i) {
                    return false;
                }
                m1914(i2, iInterface);
                return true;
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public boolean mo1907() {
        return mo1901() >= 211700000;
    }

    /* JADX INFO: renamed from: ᵝᵶ, reason: contains not printable characters */
    public final void m1908() {
        int iM10399 = this.f2536.m10399(this.f2530, mo1901());
        if (iM10399 == 0) {
            m1921(new ᵧᵙᵤ(this));
            return;
        }
        m1914(1, null);
        this.f2529 = new ᵧᵙᵤ(this);
        int i = this.f2534.get();
        HandlerC3109 handlerC3109 = this.f2538;
        handlerC3109.sendMessage(handlerC3109.obtainMessage(3, i, iM10399, null));
    }

    /* JADX INFO: renamed from: ᵟᵹᵙ, reason: contains not printable characters */
    public Account mo1909() {
        return null;
    }

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public final void m1910() {
        if (!m1917() || this.f2532 == null) {
            C4935.m10237("Failed to connect when checking package");
        }
    }

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public final /* synthetic */ void m1911() {
        int i;
        int i2;
        synchronized (this.f2521) {
            i = this.f2520;
        }
        if (i == 3) {
            this.f2517 = true;
            i2 = 5;
        } else {
            i2 = 4;
        }
        HandlerC3109 handlerC3109 = this.f2538;
        handlerC3109.sendMessage(handlerC3109.obtainMessage(i2, this.f2534.get(), 16));
    }

    /* JADX INFO: renamed from: ᵪᵹᵥᵻ, reason: contains not printable characters */
    public final void m1912() {
        this.f2534.incrementAndGet();
        ArrayList arrayList = this.f2533;
        synchronized (arrayList) {
            try {
                int size = arrayList.size();
                for (int i = 0; i < size; i++) {
                    ((AbstractC2673) arrayList.get(i)).m6478();
                }
                arrayList.clear();
            } catch (Throwable th) {
                throw th;
            }
        }
        synchronized (this.f2527) {
            this.f2539 = null;
        }
        m1914(1, null);
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX INFO: renamed from: ᵮᵣᵗˈ, reason: contains not printable characters */
    public final void m1913(InterfaceC5177 interfaceC5177, Set set) {
        Bundle bundleMo1899 = mo1899();
        String str = this.f2537;
        int i = this.f2524;
        int i2 = C5073.f19130;
        Scope[] scopeArr = C2115.f8411;
        Bundle bundle = new Bundle();
        C4625[] c4625Arr = C2115.f8412;
        C2115 c2115 = new C2115(6, i, i2, null, null, scopeArr, bundle, null, c4625Arr, c4625Arr, true, 0, false, str);
        c2115.f8423 = this.f2530.getPackageName();
        c2115.f8415 = bundleMo1899;
        if (set != null) {
            c2115.f8425 = (Scope[]) set.toArray(new Scope[0]);
        }
        if (mo1918()) {
            Account accountMo1909 = mo1909();
            if (accountMo1909 == null) {
                accountMo1909 = new Account("<<default account>>", "com.google");
            }
            c2115.f8418 = accountMo1909;
            if (interfaceC5177 != 0) {
                c2115.f8424 = ((AbstractC5171) interfaceC5177).f19470;
            }
        }
        c2115.f8426 = f2516;
        c2115.f8419 = mo1915();
        try {
            try {
                synchronized (this.f2527) {
                    try {
                        C3959 c3959 = this.f2539;
                        if (c3959 != null) {
                            c3959.m8701(new BinderC4684(this, this.f2534.get()), c2115);
                        }
                    } finally {
                    }
                }
            } catch (RemoteException | RuntimeException unused) {
                int i3 = this.f2534.get();
                C0123 c0123 = new C0123(this, 8, null, null);
                HandlerC3109 handlerC3109 = this.f2538;
                handlerC3109.sendMessage(handlerC3109.obtainMessage(1, i3, -1, c0123));
            }
        } catch (DeadObjectException unused2) {
            int i4 = this.f2534.get();
            HandlerC3109 handlerC31092 = this.f2538;
            handlerC31092.sendMessage(handlerC31092.obtainMessage(6, i4, 3));
        } catch (SecurityException e) {
            throw e;
        }
    }

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public final void m1914(int i, IInterface iInterface) {
        C3789 c3789;
        ᵘᵞʿⁱ.ᵻˈᵦʼ((i == 4) == (iInterface != null));
        synchronized (this.f2521) {
            try {
                this.f2520 = i;
                this.f2518 = iInterface;
                Bundle bundle = null;
                if (i == 1) {
                    ServiceConnectionC2237 serviceConnectionC2237 = this.f2523;
                    if (serviceConnectionC2237 != null) {
                        C4569 c4569 = this.f2535;
                        String str = this.f2532.f14392;
                        ᵘᵞʿⁱ.ᵶᵥᵝ(str);
                        this.f2532.getClass();
                        if (this.f2531 == null) {
                            this.f2530.getClass();
                        }
                        c4569.m9656(str, serviceConnectionC2237, this.f2532.f14391);
                        this.f2523 = null;
                    }
                } else if (i == 2 || i == 3) {
                    ServiceConnectionC2237 serviceConnectionC22372 = this.f2523;
                    if (serviceConnectionC22372 != null && (c3789 = this.f2532) != null) {
                        new StringBuilder(String.valueOf(c3789.f14392).length() + 70 + "com.google.android.gms".length());
                        C4569 c45692 = this.f2535;
                        String str2 = this.f2532.f14392;
                        ᵘᵞʿⁱ.ᵶᵥᵝ(str2);
                        this.f2532.getClass();
                        if (this.f2531 == null) {
                            this.f2530.getClass();
                        }
                        c45692.m9656(str2, serviceConnectionC22372, this.f2532.f14391);
                        this.f2534.incrementAndGet();
                    }
                    ServiceConnectionC2237 serviceConnectionC22373 = new ServiceConnectionC2237(this, this.f2534.get());
                    this.f2523 = serviceConnectionC22373;
                    String strMo1903 = mo1903();
                    boolean zMo1907 = mo1907();
                    this.f2532 = new C3789(2, strMo1903, zMo1907);
                    if (zMo1907 && mo1901() < 17895000) {
                        throw new IllegalStateException("Internal Error, the minimum apk version of this BaseGmsClient is too low to support dynamic lookup. Start service action: ".concat(String.valueOf(this.f2532.f14392)));
                    }
                    C4569 c45693 = this.f2535;
                    String str3 = this.f2532.f14392;
                    ᵘᵞʿⁱ.ᵶᵥᵝ(str3);
                    this.f2532.getClass();
                    String name = this.f2531;
                    if (name == null) {
                        name = this.f2530.getClass().getName();
                    }
                    C2646 c2646M9655 = c45693.m9655(new C0478(str3, this.f2532.f14391), serviceConnectionC22373, name, null);
                    if (!(c2646M9655.f10259 == 0)) {
                        new StringBuilder(String.valueOf(this.f2532.f14392).length() + 34 + "com.google.android.gms".length());
                        int i2 = c2646M9655.f10259;
                        if (i2 == -1) {
                            i2 = 16;
                        }
                        if (c2646M9655.f10258 != null) {
                            bundle = new Bundle();
                            bundle.putParcelable("pendingIntent", c2646M9655.f10258);
                        }
                        int i3 = this.f2534.get();
                        C4304 c4304 = new C4304(this, i2, bundle);
                        HandlerC3109 handlerC3109 = this.f2538;
                        handlerC3109.sendMessage(handlerC3109.obtainMessage(7, i3, -1, c4304));
                    }
                } else if (i == 4) {
                    ᵘᵞʿⁱ.ᵶᵥᵝ(iInterface);
                    System.currentTimeMillis();
                }
            } finally {
            }
        }
    }

    /* JADX INFO: renamed from: ᵱʡˏ, reason: contains not printable characters */
    public C4625[] mo1915() {
        return f2516;
    }

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public final String m1916() {
        return this.f2526;
    }

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public final boolean m1917() {
        boolean z;
        synchronized (this.f2521) {
            z = this.f2520 == 4;
        }
        return z;
    }

    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public boolean mo1918() {
        return false;
    }

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final boolean m1919() {
        boolean z;
        synchronized (this.f2521) {
            int i = this.f2520;
            z = true;
            if (i != 2 && i != 3) {
                z = false;
            }
        }
        return z;
    }

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public final C4625[] m1920() {
        C0318 c0318 = this.f2522;
        if (c0318 == null) {
            return null;
        }
        return c0318.f2027;
    }

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public final void m1921(InterfaceC2624 interfaceC2624) {
        this.f2529 = interfaceC2624;
        m1914(2, null);
    }
}
