package com.fyber.inneractive.sdk.util; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.os.SystemClock; import java.lang.ref.WeakReference; import java.util.concurrent.TimeUnit; /* loaded from: classes2.dex */ public final class c1 { public final TimeUnit a; public final long b; public a c; public boolean d; public b e; public long f; public static class a extends Handler { public final WeakReference a; public a(c1 c1Var) { super(Looper.getMainLooper()); this.a = new WeakReference<>(c1Var); } @Override // android.os.Handler public final void handleMessage(Message message) { super.handleMessage(message); c1 c1Var = this.a.get(); if (c1Var == null || message.what != 1932593528 || c1Var.d) { return; } long when = message.getWhen(); long uptimeMillis = (SystemClock.uptimeMillis() - when) + 50 + c1Var.f; c1Var.f = uptimeMillis; if (c1Var.e != null && uptimeMillis > c1Var.a.toMillis(c1Var.b)) { c1Var.e.a(); return; } a aVar = c1Var.c; if (aVar == null || c1Var.e == null) { return; } aVar.removeMessages(1932593528); c1Var.c.sendEmptyMessageDelayed(1932593528, 50L); } } public interface b { void a(); } public c1(TimeUnit timeUnit, long j) { this.d = false; this.f = 0L; this.b = j; this.a = timeUnit; IAlog.a("Visible time counter init - time %d", Long.valueOf(j)); } public c1(TimeUnit timeUnit, long j, long j2) { this.d = false; this.b = j; this.a = timeUnit; this.f = j2; IAlog.a("Visible time counter init - time %d", Long.valueOf(j)); } }