package com.google.android.gms.measurement.internal; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import com.google.android.gms.internal.measurement.zzdl; /* loaded from: classes.dex */ public final class zzfd extends zzf { private Handler c; private long d; private long e; private final zzy f; private final zzy g; private final zzy h; zzfd(zzbw zzbwVar) { super(zzbwVar); this.f = new zzfe(this, this.a); this.g = new zzff(this, this.a); this.h = new zzfg(this, this.a); this.d = d().b(); this.e = this.d; } private final void D() { synchronized (this) { if (this.c == null) { this.c = new zzdl(Looper.getMainLooper()); } } } /* JADX INFO: Access modifiers changed from: private */ public final void E() { f(); a(false, false); o().a(d().b()); } /* JADX INFO: Access modifiers changed from: private */ public final void b(long j) { f(); D(); e().B().a("Activity resumed, time", Long.valueOf(j)); this.d = j; this.e = this.d; if (m().q(q().C())) { a(d().a()); return; } this.f.a(); this.g.a(); if (m().o(q().C()) || m().p(q().C())) { this.h.a(); } if (l().a(d().a())) { l().r.a(true); l().t.a(0L); } if (l().r.a()) { this.f.a(Math.max(0L, l().p.a() - l().t.a())); } else { this.g.a(Math.max(0L, 3600000 - l().t.a())); } } /* JADX INFO: Access modifiers changed from: private */ public final void c(long j) { f(); D(); this.f.a(); this.g.a(); if (m().o(q().C()) || m().p(q().C())) { this.h.a(); this.h.a(l().q.a()); } e().B().a("Activity paused, time", Long.valueOf(j)); if (this.d != 0) { l().t.a(l().t.a() + (j - this.d)); } } private final void d(long j) { f(); e().B().a("Session started, time", Long.valueOf(d().b())); Long valueOf = m().o(q().C()) ? Long.valueOf(j / 1000) : null; Long l = m().p(q().C()) ? -1L : null; p().a("auto", "_sid", valueOf, j); p().a("auto", "_sno", l, j); l().r.a(false); Bundle bundle = new Bundle(); if (m().o(q().C())) { bundle.putLong("_sid", valueOf.longValue()); } p().a("auto", "_s", j, bundle); l().s.a(j); } protected final void B() { f(); d(d().a()); } final long C() { long b = d().b(); long j = b - this.e; this.e = b; return j; } final void a(long j) { f(); D(); a(j, false); } @Override // com.google.android.gms.measurement.internal.zzf protected final boolean y() { return false; } final void a(long j, boolean z) { f(); D(); this.f.a(); this.g.a(); if (m().o(q().C()) || m().p(q().C())) { this.h.a(); } if (l().a(j)) { l().r.a(true); l().t.a(0L); } if (l().r.a()) { d(j); return; } this.g.a(Math.max(0L, 3600000 - l().t.a())); if (z && m().r(q().C())) { l().s.a(j); if (m().o(q().C()) || m().p(q().C())) { this.h.a(); this.h.a(l().q.a()); } } } public final boolean a(boolean z, boolean z2) { f(); w(); long b = d().b(); l().s.a(d().a()); long j = b - this.d; if (!z && j < 1000) { e().B().a("Screen exposed for less than 1000 ms. Event not sent. time", Long.valueOf(j)); return false; } l().t.a(j); e().B().a("Recording user engagement, ms", Long.valueOf(j)); Bundle bundle = new Bundle(); bundle.putLong("_et", j); zzdy.a(s().B(), bundle, true); if (m().s(q().C())) { if (m().d(q().C(), zzai.l0)) { if (!z2) { C(); } } else if (z2) { bundle.putLong("_fr", 1L); } else { C(); } } if (!m().d(q().C(), zzai.l0) || !z2) { p().b("auto", "_e", bundle); } this.d = b; this.g.a(); this.g.a(Math.max(0L, 3600000 - l().t.a())); return true; } }