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: classes2.dex */ public final class ULx { public static ULx d; public RVV a; public final Object b = new Object(); public final Handler c = new Handler(Looper.getMainLooper(), new Handler.Callback(this) { // from class: o.ULx.5 private ULx d; { this.d = this; } @Override // android.os.Handler.Callback public final boolean handleMessage(Message message) { if (message.what != 0) { return false; } ULx uLx = this.d; RVV rvv = (RVV) message.obj; synchronized (uLx.b) { if (uLx.a == rvv || uLx.e == rvv) { uLx.e(rvv, 2); } } return true; } }); public RVV e; /* loaded from: classes2.dex */ public interface HBt { void a(int i); void b(); } public final void b(HBt hBt, int i) { synchronized (this.b) { if (f(hBt)) { e(this.a, i); } else if (j(hBt)) { e(this.e, i); } } } public final void a(HBt hBt) { synchronized (this.b) { if (f(hBt)) { this.a = null; if (this.e != null) { c(); } } } } public final void b(HBt hBt) { synchronized (this.b) { if (f(hBt)) { e(this.a); } } } public final void d(HBt hBt) { synchronized (this.b) { if (f(hBt) && !this.a.c) { this.a.c = true; this.c.removeCallbacksAndMessages(this.a); } } } public final void e(HBt hBt) { synchronized (this.b) { if (f(hBt) && this.a.c) { this.a.c = false; e(this.a); } } } public final boolean c(HBt hBt) { boolean z; synchronized (this.b) { if (!f(hBt)) { z = j(hBt); } } return z; } /* loaded from: classes2.dex */ public static class RVV { public int b; boolean c; public final WeakReference d; public RVV(int i, HBt hBt) { this.d = new WeakReference<>(hBt); this.b = i; } } public final void c() { RVV rvv = this.e; if (rvv != null) { this.a = rvv; this.e = null; HBt hBt = rvv.d.get(); if (hBt != null) { hBt.b(); } else { this.a = null; } } } public final boolean e(RVV rvv, int i) { HBt hBt = rvv.d.get(); if (hBt == null) { return false; } this.c.removeCallbacksAndMessages(rvv); hBt.a(i); return true; } private boolean f(HBt hBt) { RVV rvv = this.a; return (rvv == null || hBt == null || rvv.d.get() != hBt) ? false : true; } private boolean j(HBt hBt) { RVV rvv = this.e; return (rvv == null || hBt == null || rvv.d.get() != hBt) ? false : true; } public final void e(RVV rvv) { int i; if (rvv.b == -2) { return; } if (rvv.b > 0) { i = rvv.b; } else { i = rvv.b == -1 ? ConnectionResult.DRIVE_EXTERNAL_STORAGE_REQUIRED : 2750; } this.c.removeCallbacksAndMessages(rvv); Handler handler = this.c; handler.sendMessageDelayed(Message.obtain(handler, 0, rvv), i); } }