package o; import android.os.Handler; import android.os.Looper; import android.os.Message; import com.google.android.gms.common.ConnectionResult; import java.lang.ref.WeakReference; /* loaded from: classes.dex */ public final class LWK { public static LWK c; public IeS b; public IeS e; public final Object a = new Object(); public final Handler d = new Handler(Looper.getMainLooper(), new Handler.Callback(this) { // from class: o.LWK.3 private LWK e; { this.e = this; } @Override // android.os.Handler.Callback public final boolean handleMessage(Message message) { HBt hBt; if (message.what != 0) { return false; } LWK lwk = this.e; IeS ieS = (IeS) message.obj; synchronized (lwk.a) { if ((lwk.b == ieS || lwk.e == ieS) && (hBt = ieS.e.get()) != null) { hBt.b(2); } } return true; } }); /* loaded from: classes.dex */ public interface HBt { void b(); void b(int i); } public final void c(HBt hBt) { synchronized (this.a) { if (d(hBt)) { this.b = null; if (this.e != null) { a(); } } } } public final void a(HBt hBt) { synchronized (this.a) { if (d(hBt)) { this.d.removeCallbacksAndMessages(this.b); } } } public final void j(HBt hBt) { synchronized (this.a) { if (d(hBt)) { e(this.b); } } } public final boolean e(HBt hBt) { boolean z; synchronized (this.a) { if (!d(hBt)) { z = b(hBt); } } return z; } /* loaded from: classes.dex */ public static class IeS { public int b; public final WeakReference e; public IeS(int i, HBt hBt) { this.e = new WeakReference<>(hBt); this.b = i; } } public final boolean d(HBt hBt) { IeS ieS = this.b; return (ieS == null || hBt == null || ieS.e.get() != hBt) ? false : true; } public final boolean b(HBt hBt) { IeS ieS = this.e; return (ieS == null || hBt == null || ieS.e.get() != hBt) ? false : true; } public final void e(IeS ieS) { int i; if (ieS.b == -2) { return; } if (ieS.b > 0) { i = ieS.b; } else { i = ieS.b == -1 ? ConnectionResult.DRIVE_EXTERNAL_STORAGE_REQUIRED : 2750; } this.d.removeCallbacksAndMessages(ieS); Handler handler = this.d; handler.sendMessageDelayed(Message.obtain(handler, 0, ieS), i); } public final void a() { IeS ieS = this.e; if (ieS != null) { this.b = ieS; this.e = null; HBt hBt = ieS.e.get(); if (hBt != null) { hBt.b(); } else { this.b = null; } } } }