package T0;

import android.content.ComponentName;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.os.IInterface;
import p2.C0944a;
import p2.C0945b;
import p2.C0946c;

/* JADX INFO: loaded from: classes.dex */
public final class e implements ServiceConnection {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f2853a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ Object f2854b;

    public /* synthetic */ e(int i, Object obj) {
        this.f2853a = i;
        this.f2854b = obj;
    }

    @Override // android.content.ServiceConnection
    public final void onServiceConnected(ComponentName componentName, IBinder iBinder) {
        d dVar;
        Object obj = this.f2854b;
        switch (this.f2853a) {
            case 0:
                int i = com.emrys.rjsniffer.rjsniffer.b.f4797c;
                if (iBinder == null) {
                    dVar = null;
                } else {
                    IInterface iInterfaceQueryLocalInterface = iBinder.queryLocalInterface("com.emrys.rjsniffer.rjsniffer.IIsolatedService");
                    if (iInterfaceQueryLocalInterface == null || !(iInterfaceQueryLocalInterface instanceof d)) {
                        c cVar = new c();
                        cVar.f2852c = iBinder;
                        dVar = cVar;
                    } else {
                        dVar = (d) iInterfaceQueryLocalInterface;
                    }
                }
                com.emrys.rjsniffer.rjsniffer.a aVar = (com.emrys.rjsniffer.rjsniffer.a) obj;
                aVar.f4795n = dVar;
                aVar.f4794m = true;
                break;
            default:
                C0946c c0946c = (C0946c) obj;
                c0946c.f9503b.a("ServiceConnectionImpl.onServiceConnected(%s)", componentName);
                c0946c.a().post(new C0944a(this, iBinder));
                break;
        }
    }

    @Override // android.content.ServiceConnection
    public final void onServiceDisconnected(ComponentName componentName) {
        switch (this.f2853a) {
            case 0:
                ((com.emrys.rjsniffer.rjsniffer.a) this.f2854b).f4794m = false;
                break;
            default:
                C0946c c0946c = (C0946c) this.f2854b;
                c0946c.f9503b.a("ServiceConnectionImpl.onServiceDisconnected(%s)", componentName);
                c0946c.a().post(new C0945b(0, this));
                break;
        }
    }
}
