package o;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import java.util.concurrent.Callable;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.Xq, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final /* synthetic */ class C0613Xq implements InterfaceC1042dr, InterfaceC0823bc0 {
    public final /* synthetic */ int l;
    public final /* synthetic */ Object m;
    public final /* synthetic */ long n;

    /* renamed from: o, reason: collision with root package name */
    public final /* synthetic */ Object f414o;
    public final /* synthetic */ Object p;

    public /* synthetic */ C0613Xq(C0598Xb c0598Xb, Iterable iterable, C2156pc c2156pc, long j) {
        this.l = 2;
        this.m = c0598Xb;
        this.p = iterable;
        this.f414o = c2156pc;
        this.n = j;
    }

    @Override // o.InterfaceC1042dr
    public ScheduledFuture a(C0247Jn c0247Jn) {
        switch (this.l) {
            case 0:
                ScheduledExecutorServiceC0947cr scheduledExecutorServiceC0947cr = (ScheduledExecutorServiceC0947cr) this.m;
                Runnable runnable = (Runnable) this.p;
                return scheduledExecutorServiceC0947cr.m.schedule(new RunnableC0756ar(scheduledExecutorServiceC0947cr, runnable, c0247Jn, 1), this.n, (TimeUnit) this.f414o);
            default:
                ScheduledExecutorServiceC0947cr scheduledExecutorServiceC0947cr2 = (ScheduledExecutorServiceC0947cr) this.m;
                Callable callable = (Callable) this.p;
                return scheduledExecutorServiceC0947cr2.m.schedule(new CallableC0852br(scheduledExecutorServiceC0947cr2, callable, c0247Jn, 0), this.n, (TimeUnit) this.f414o);
        }
    }

    @Override // o.InterfaceC0823bc0
    public Object d() {
        C0598Xb c0598Xb = (C0598Xb) this.m;
        Iterable iterable = (Iterable) this.p;
        C2156pc c2156pc = (C2156pc) this.f414o;
        L30 l30 = (L30) ((InterfaceC0463Rw) c0598Xb.c);
        l30.getClass();
        if (iterable.iterator().hasNext()) {
            String str = "UPDATE events SET num_attempts = num_attempts + 1 WHERE _id in " + L30.l(iterable);
            SQLiteDatabase sQLiteDatabaseB = l30.b();
            sQLiteDatabaseB.beginTransaction();
            try {
                sQLiteDatabaseB.compileStatement(str).execute();
                Cursor cursorRawQuery = sQLiteDatabaseB.rawQuery("SELECT COUNT(*), transport_name FROM events WHERE num_attempts >= 16 GROUP BY transport_name", null);
                while (cursorRawQuery.moveToNext()) {
                    try {
                        l30.g(cursorRawQuery.getInt(0), GM.q, cursorRawQuery.getString(1));
                    } catch (Throwable th) {
                        cursorRawQuery.close();
                        throw th;
                    }
                }
                cursorRawQuery.close();
                sQLiteDatabaseB.compileStatement("DELETE FROM events WHERE num_attempts >= 16").execute();
                sQLiteDatabaseB.setTransactionSuccessful();
            } finally {
                sQLiteDatabaseB.endTransaction();
            }
        }
        l30.d(new I30(((C2616uQ) c0598Xb.g).u() + this.n, c2156pc));
        return null;
    }

    public /* synthetic */ C0613Xq(ScheduledExecutorServiceC0947cr scheduledExecutorServiceC0947cr, Object obj, long j, TimeUnit timeUnit, int i) {
        this.l = i;
        this.m = scheduledExecutorServiceC0947cr;
        this.p = obj;
        this.n = j;
        this.f414o = timeUnit;
    }
}
