package o; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.Handler; import android.os.HandlerThread; import android.os.IBinder; import android.os.IInterface; import android.os.RemoteException; import android.util.Log; import com.google.android.gms.tasks.TaskCompletionSource; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; /* loaded from: classes.dex */ public final class iNu { private static final Map m = new HashMap(); final Context a; final yax e; final Intent g; boolean j; public IInterface k; ServiceConnection l; /* renamed from: o, reason: collision with root package name */ private final zcQ f9171o; final List d = new ArrayList(); final Set c = new HashSet(); final Object f = new Object(); final IBinder.DeathRecipient i = new IBinder.DeathRecipient(this) { // from class: o.FUE private iNu a; @Override // android.os.IBinder.DeathRecipient public final void binderDied() { iNu inu = this.a; yax yaxVar = inu.e; Object[] objArr = new Object[0]; if (Log.isLoggable("PlayCore", 4)) { yax.d(yaxVar.d, "reportBinderDeath", objArr); } if (((DTk) inu.h.get()) == null) { yax yaxVar2 = inu.e; Object[] objArr2 = {inu.b}; if (Log.isLoggable("PlayCore", 4)) { yax.d(yaxVar2.d, "%s : Binder has died.", objArr2); } for (BMB bmb : inu.d) { RemoteException remoteException = new RemoteException(String.valueOf(inu.b).concat(" : Binder has died.")); TaskCompletionSource taskCompletionSource = bmb.c; if (taskCompletionSource != null) { taskCompletionSource.trySetException(remoteException); } } inu.d.clear(); } else { yax yaxVar3 = inu.e; Object[] objArr3 = new Object[0]; if (Log.isLoggable("PlayCore", 4)) { yax.d(yaxVar3.d, "calling onBinderDied", objArr3); } } synchronized (inu.f) { inu.d(); } } { this.a = this; } }; final AtomicInteger n = new AtomicInteger(0); final String b = "AppUpdateService"; final WeakReference h = new WeakReference(null); public iNu(Context context, yax yaxVar, Intent intent, zcQ zcq) { this.a = context; this.e = yaxVar; this.g = intent; this.f9171o = zcq; } public final Handler Nn_() { Handler handler; Map map = m; synchronized (map) { if (!map.containsKey(this.b)) { HandlerThread handlerThread = new HandlerThread(this.b, 10); handlerThread.start(); map.put(this.b, new Handler(handlerThread.getLooper())); } handler = (Handler) map.get(this.b); } return handler; } /* JADX INFO: Access modifiers changed from: package-private */ public final void d() { Iterator it = this.c.iterator(); while (it.hasNext()) { ((TaskCompletionSource) it.next()).trySetException(new RemoteException(String.valueOf(this.b).concat(" : Binder has died."))); } this.c.clear(); } public final void e(TaskCompletionSource taskCompletionSource) { synchronized (this.f) { this.c.remove(taskCompletionSource); } Nn_().post(new olM(this)); } }