discord-jadx/app/src/main/java/c/i/a/f/e/k/e0.java

91 lines
3.6 KiB
Java

package c.i.a.f.e.k;
import android.content.Context;
import android.content.ServiceConnection;
import android.os.Handler;
import c.i.a.f.e.k.b;
import c.i.a.f.e.k.e;
import c.i.a.f.e.n.a;
import c.i.a.f.h.g.d;
import com.airbnb.lottie.parser.AnimatableValueParser;
import java.util.HashMap;
/* compiled from: com.google.android.gms:play-services-basement@@17.4.0 */
public final class e0 extends e {
/* renamed from: c reason: collision with root package name */
public final HashMap<e.a, g0> f1057c = new HashMap<>();
public final Context d;
public final Handler e;
public final a f;
public final long g;
public final long h;
public e0(Context context) {
this.d = context.getApplicationContext();
this.e = new d(context.getMainLooper(), new f0(this, null));
this.f = a.b();
this.g = 5000;
this.h = 300000;
}
@Override // c.i.a.f.e.k.e
public final boolean b(e.a aVar, ServiceConnection serviceConnection, String str) {
boolean z2;
AnimatableValueParser.z(serviceConnection, "ServiceConnection must not be null");
synchronized (this.f1057c) {
g0 g0Var = this.f1057c.get(aVar);
if (g0Var == null) {
g0Var = new g0(this, aVar);
g0Var.i.put(serviceConnection, serviceConnection);
g0Var.a(str);
this.f1057c.put(aVar, g0Var);
} else {
this.e.removeMessages(0, aVar);
if (!g0Var.i.containsKey(serviceConnection)) {
g0Var.i.put(serviceConnection, serviceConnection);
int i = g0Var.j;
if (i == 1) {
((b.i) serviceConnection).onServiceConnected(g0Var.n, g0Var.l);
} else if (i == 2) {
g0Var.a(str);
}
} else {
String valueOf = String.valueOf(aVar);
StringBuilder sb = new StringBuilder(valueOf.length() + 81);
sb.append("Trying to bind a GmsServiceConnection that was already connected before. config=");
sb.append(valueOf);
throw new IllegalStateException(sb.toString());
}
}
z2 = g0Var.k;
}
return z2;
}
@Override // c.i.a.f.e.k.e
public final void c(e.a aVar, ServiceConnection serviceConnection, String str) {
AnimatableValueParser.z(serviceConnection, "ServiceConnection must not be null");
synchronized (this.f1057c) {
g0 g0Var = this.f1057c.get(aVar);
if (g0Var == null) {
String valueOf = String.valueOf(aVar);
StringBuilder sb = new StringBuilder(valueOf.length() + 50);
sb.append("Nonexistent connection status for service config: ");
sb.append(valueOf);
throw new IllegalStateException(sb.toString());
} else if (g0Var.i.containsKey(serviceConnection)) {
g0Var.i.remove(serviceConnection);
if (g0Var.i.isEmpty()) {
this.e.sendMessageDelayed(this.e.obtainMessage(0, aVar), this.g);
}
} else {
String valueOf2 = String.valueOf(aVar);
StringBuilder sb2 = new StringBuilder(valueOf2.length() + 76);
sb2.append("Trying to unbind a GmsServiceConnection that was not bound before. config=");
sb2.append(valueOf2);
throw new IllegalStateException(sb2.toString());
}
}
}
}