package o;

import android.content.ContentValues;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

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

    public /* synthetic */ C0480Sn(long j, Object obj, Object obj2) {
        this.l = obj;
        this.n = obj2;
        this.m = j;
    }

    @Override // o.InterfaceC0250Jq
    public void a(DZ dz) {
        String str = (String) this.l;
        C1681kc c1681kc = (C1681kc) this.n;
        C0506Tn c0506Tn = (C0506Tn) dz.get();
        c0506Tn.getClass();
        Log.isLoggable("FirebaseCrashlytics", 2);
        c0506Tn.a.a(new C0480Sn(str, this.m, c1681kc));
    }

    @Override // o.J30
    public Object apply(Object obj) throws SQLException {
        String str = (String) this.l;
        SQLiteDatabase sQLiteDatabase = (SQLiteDatabase) obj;
        int i = ((GM) this.n).l;
        Cursor cursorRawQuery = sQLiteDatabase.rawQuery("SELECT 1 FROM log_event_dropped WHERE log_source = ? AND reason = ?", new String[]{str, Integer.toString(i)});
        try {
            boolean z = cursorRawQuery.getCount() > 0;
            cursorRawQuery.close();
            long j = this.m;
            if (z) {
                sQLiteDatabase.execSQL("UPDATE log_event_dropped SET events_dropped_count = events_dropped_count + " + j + " WHERE log_source = ? AND reason = ?", new String[]{str, Integer.toString(i)});
                return null;
            }
            ContentValues contentValues = new ContentValues();
            contentValues.put("log_source", str);
            contentValues.put("reason", Integer.valueOf(i));
            contentValues.put("events_dropped_count", Long.valueOf(j));
            sQLiteDatabase.insert("log_event_dropped", null, contentValues);
            return null;
        } catch (Throwable th) {
            cursorRawQuery.close();
            throw th;
        }
    }

    @Override // o.InterfaceC0823bc0
    public Object d() {
        C0598Xb c0598Xb = (C0598Xb) this.l;
        C2156pc c2156pc = (C2156pc) this.n;
        InterfaceC0463Rw interfaceC0463Rw = (InterfaceC0463Rw) c0598Xb.c;
        long jU = ((C2616uQ) c0598Xb.g).u() + this.m;
        L30 l30 = (L30) interfaceC0463Rw;
        l30.getClass();
        l30.d(new I30(jU, c2156pc));
        return null;
    }

    public /* synthetic */ C0480Sn(String str, long j, C1681kc c1681kc) {
        this.l = str;
        this.m = j;
        this.n = c1681kc;
    }
}
