package defpackage;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Build;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.StrictMode;
import com.google.android.gms.common.internal.zzaf;
import java.util.HashMap;
import java.util.Iterator;
import java.util.concurrent.Executor;

/* renamed from: ˉːᵹ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class ServiceConnectionC1180 implements ServiceConnection {

    /* renamed from: ˀᵗᵝᵭ, reason: contains not printable characters */
    public final /* synthetic */ C2782 f5011;

    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    public ComponentName f5012;

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public final C2224 f5014;

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public IBinder f5016;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public boolean f5017;

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public final HashMap f5015 = new HashMap();

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public int f5013 = 2;

    public ServiceConnectionC1180(C2782 c2782, C2224 c2224) {
        this.f5011 = c2782;
        this.f5014 = c2224;
    }

    @Override // android.content.ServiceConnection
    public final void onBindingDied(ComponentName componentName) {
        onServiceDisconnected(componentName);
    }

    @Override // android.content.ServiceConnection
    public final void onServiceConnected(ComponentName componentName, IBinder iBinder) {
        C2782 c2782 = this.f5011;
        synchronized (c2782.f10723) {
            try {
                c2782.f10722.removeMessages(1, this.f5014);
                this.f5016 = iBinder;
                this.f5012 = componentName;
                Iterator it = this.f5015.values().iterator();
                while (it.hasNext()) {
                    ((ServiceConnection) it.next()).onServiceConnected(componentName, iBinder);
                }
                this.f5013 = 1;
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    @Override // android.content.ServiceConnection
    public final void onServiceDisconnected(ComponentName componentName) {
        C2782 c2782 = this.f5011;
        synchronized (c2782.f10723) {
            try {
                c2782.f10722.removeMessages(1, this.f5014);
                this.f5016 = null;
                this.f5012 = componentName;
                Iterator it = this.f5015.values().iterator();
                while (it.hasNext()) {
                    ((ServiceConnection) it.next()).onServiceDisconnected(componentName);
                }
                this.f5013 = 2;
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final C0548 m3687(String str, Executor executor) throws RemoteException {
        try {
            Intent intentM3040 = AbstractC0906.m3040(this.f5011.f10724, this.f5014);
            this.f5013 = 3;
            StrictMode.VmPolicy vmPolicy = StrictMode.getVmPolicy();
            if (Build.VERSION.SDK_INT >= 31) {
                StrictMode.setVmPolicy(AbstractC2012.m5543(new StrictMode.VmPolicy.Builder(vmPolicy)).build());
            }
            try {
                C2782 c2782 = this.f5011;
                C3580 c3580 = c2782.f10725;
                Context context = c2782.f10724;
                C2224 c2224 = this.f5014;
                boolean zM8187 = c3580.m8187(context, str, intentM3040, this, 4225, executor);
                this.f5017 = zM8187;
                if (zM8187) {
                    c2782.f10722.sendMessageDelayed(c2782.f10722.obtainMessage(1, c2224), c2782.f10721);
                    C0548 c0548 = C0548.f2845;
                    StrictMode.setVmPolicy(vmPolicy);
                    return c0548;
                }
                this.f5013 = 2;
                try {
                    c2782.f10725.m8188(c2782.f10724, this);
                } catch (IllegalArgumentException unused) {
                }
                C0548 c05482 = new C0548(16, null, null);
                StrictMode.setVmPolicy(vmPolicy);
                return c05482;
            } catch (Throwable th) {
                StrictMode.setVmPolicy(vmPolicy);
                throw th;
            }
        } catch (zzaf e) {
            return e.f1024;
        }
    }
}
