package a4; import android.os.Handler; import android.os.HandlerThread; import com.google.android.gms.common.internal.Preconditions; import com.google.android.gms.common.logging.Logger; import com.google.android.gms.common.util.DefaultClock; import com.google.android.gms.internal.p002firebaseauthapi.zzc; /* loaded from: classes2.dex */ public final class l { /* renamed from: h, reason: collision with root package name */ private static final Logger f97h = new Logger("TokenRefresher", "FirebaseAuth:"); /* renamed from: a, reason: collision with root package name */ private final w3.f f98a; /* renamed from: b, reason: collision with root package name */ volatile long f99b; /* renamed from: c, reason: collision with root package name */ volatile long f100c; /* renamed from: d, reason: collision with root package name */ final long f101d; /* renamed from: e, reason: collision with root package name */ final HandlerThread f102e; /* renamed from: f, reason: collision with root package name */ final Handler f103f; /* renamed from: g, reason: collision with root package name */ final Runnable f104g; public l(w3.f fVar) { f97h.v("Initializing TokenRefresher", new Object[0]); w3.f fVar2 = (w3.f) Preconditions.checkNotNull(fVar); this.f98a = fVar2; HandlerThread handlerThread = new HandlerThread("TokenRefresher", 10); this.f102e = handlerThread; handlerThread.start(); this.f103f = new zzc(handlerThread.getLooper()); this.f104g = new k(this, fVar2.n()); this.f101d = 300000L; } public final void b() { this.f103f.removeCallbacks(this.f104g); } public final void c() { f97h.v("Scheduling refresh for " + (this.f99b - this.f101d), new Object[0]); b(); this.f100c = Math.max((this.f99b - DefaultClock.getInstance().currentTimeMillis()) - this.f101d, 0L) / 1000; this.f103f.postDelayed(this.f104g, this.f100c * 1000); } final void d() { long j10; int i10 = (int) this.f100c; if (i10 == 30 || i10 == 60 || i10 == 120 || i10 == 240 || i10 == 480) { long j11 = this.f100c; j10 = j11 + j11; } else { j10 = i10 != 960 ? 30L : 960L; } this.f100c = j10; this.f99b = DefaultClock.getInstance().currentTimeMillis() + (this.f100c * 1000); f97h.v("Scheduling refresh for " + this.f99b, new Object[0]); this.f103f.postDelayed(this.f104g, this.f100c * 1000); } }