package o;

import android.content.SharedPreferences;
import android.os.Handler;
import com.google.android.gms.common.internal.Preconditions;
import java.util.LinkedHashMap;
import java.util.concurrent.TimeUnit;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.xf0, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C2922xf0 {
    public long a;
    public Object b;
    public Object c;
    public Object d;
    public final Object e;

    public /* synthetic */ C2922xf0(C1617jr0 c1617jr0, long j) {
        this.e = c1617jr0;
        Preconditions.checkNotEmpty("health_monitor");
        Preconditions.checkArgument(j > 0);
        this.b = "health_monitor:start";
        this.c = "health_monitor:count";
        this.d = "health_monitor:value";
        this.a = j;
    }

    public void a(C2627ua0 c2627ua0) {
        Runnable runnable;
        synchronized (this.d) {
            runnable = (Runnable) ((LinkedHashMap) this.e).remove(c2627ua0);
        }
        if (runnable != null) {
            ((Handler) ((C0247Jn) this.b).m).removeCallbacks(runnable);
        }
    }

    public void b(C2627ua0 c2627ua0) {
        O3 o3 = new O3(20, this, c2627ua0);
        synchronized (this.d) {
        }
        C0247Jn c0247Jn = (C0247Jn) this.b;
        ((Handler) c0247Jn.m).postDelayed(o3, this.a);
    }

    /* JADX WARN: Removed duplicated region for block: B:22:0x009d  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public boolean c(long r11, o.C2756vr0 r13) {
        /*
            r10 = this;
            com.google.android.gms.common.internal.Preconditions.checkNotNull(r13)
            java.lang.Object r0 = r10.d
            java.util.ArrayList r0 = (java.util.ArrayList) r0
            if (r0 != 0) goto L10
            java.util.ArrayList r0 = new java.util.ArrayList
            r0.<init>()
            r10.d = r0
        L10:
            java.lang.Object r0 = r10.c
            java.util.ArrayList r0 = (java.util.ArrayList) r0
            if (r0 != 0) goto L1d
            java.util.ArrayList r0 = new java.util.ArrayList
            r0.<init>()
            r10.c = r0
        L1d:
            java.lang.Object r0 = r10.d
            java.util.ArrayList r0 = (java.util.ArrayList) r0
            boolean r0 = r0.isEmpty()
            r1 = 0
            if (r0 != 0) goto L48
            java.lang.Object r0 = r10.d
            java.util.ArrayList r0 = (java.util.ArrayList) r0
            java.lang.Object r0 = r0.get(r1)
            o.vr0 r0 = (o.C2756vr0) r0
            long r2 = r0.u()
            r4 = 1000(0x3e8, double:4.94E-321)
            long r2 = r2 / r4
            r6 = 60
            long r2 = r2 / r6
            long r2 = r2 / r6
            long r8 = r13.u()
            long r8 = r8 / r4
            long r8 = r8 / r6
            long r8 = r8 / r6
            int r0 = (r2 > r8 ? 1 : (r2 == r8 ? 0 : -1))
            if (r0 != 0) goto Lcf
        L48:
            long r2 = r10.a
            int r0 = r13.k()
            long r4 = (long) r0
            long r2 = r2 + r4
            java.lang.Object r0 = r10.e
            o.dv0 r0 = (o.C1051dv0) r0
            o.ho0 r4 = r0.d0()
            o.lq0 r5 = o.AbstractC1900mq0.d1
            r6 = 0
            boolean r4 = r4.C(r6, r5)
            if (r4 == 0) goto L84
            java.lang.Object r4 = r10.d
            java.util.ArrayList r4 = (java.util.ArrayList) r4
            boolean r4 = r4.isEmpty()
            if (r4 != 0) goto L9d
            r0.d0()
            o.lq0 r4 = o.AbstractC1900mq0.j
            java.lang.Object r4 = r4.a(r6)
            java.lang.Integer r4 = (java.lang.Integer) r4
            int r4 = r4.intValue()
            int r4 = java.lang.Math.max(r1, r4)
            long r4 = (long) r4
            int r4 = (r2 > r4 ? 1 : (r2 == r4 ? 0 : -1))
            if (r4 >= 0) goto Lcf
            goto L9d
        L84:
            r0.d0()
            o.lq0 r4 = o.AbstractC1900mq0.j
            java.lang.Object r4 = r4.a(r6)
            java.lang.Integer r4 = (java.lang.Integer) r4
            int r4 = r4.intValue()
            int r4 = java.lang.Math.max(r1, r4)
            long r4 = (long) r4
            int r4 = (r2 > r4 ? 1 : (r2 == r4 ? 0 : -1))
            if (r4 < 0) goto L9d
            goto Lcf
        L9d:
            r10.a = r2
            java.lang.Object r2 = r10.d
            java.util.ArrayList r2 = (java.util.ArrayList) r2
            r2.add(r13)
            java.lang.Object r13 = r10.c
            java.util.ArrayList r13 = (java.util.ArrayList) r13
            java.lang.Long r11 = java.lang.Long.valueOf(r11)
            r13.add(r11)
            java.lang.Object r11 = r10.d
            java.util.ArrayList r11 = (java.util.ArrayList) r11
            int r11 = r11.size()
            r0.d0()
            o.lq0 r12 = o.AbstractC1900mq0.k
            java.lang.Object r12 = r12.a(r6)
            java.lang.Integer r12 = (java.lang.Integer) r12
            int r12 = r12.intValue()
            r13 = 1
            int r12 = java.lang.Math.max(r13, r12)
            if (r11 < r12) goto Ld0
        Lcf:
            return r1
        Ld0:
            return r13
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C2922xf0.c(long, o.vr0):boolean");
    }

    public void d() {
        C1617jr0 c1617jr0 = (C1617jr0) this.e;
        c1617jr0.r();
        long jCurrentTimeMillis = ((Kr0) c1617jr0.a).k.currentTimeMillis();
        SharedPreferences.Editor editorEdit = c1617jr0.w().edit();
        editorEdit.remove((String) this.c);
        editorEdit.remove((String) this.d);
        editorEdit.putLong((String) this.b, jCurrentTimeMillis);
        editorEdit.apply();
    }

    public C2922xf0(C0247Jn c0247Jn, C1390hY c1390hY) {
        long millis = TimeUnit.MINUTES.toMillis(90L);
        this.b = c0247Jn;
        this.c = c1390hY;
        this.a = millis;
        this.d = new Object();
        this.e = new LinkedHashMap();
    }
}
