package g1;

import a1.C0222i;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import i1.InterfaceC0622b;

/* JADX INFO: loaded from: classes.dex */
public final /* synthetic */ class i implements InterfaceC0622b, h1.f {

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final /* synthetic */ long f6442k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public final /* synthetic */ Object f6443l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public final /* synthetic */ Object f6444m;

    public /* synthetic */ i(long j5, Object obj, Object obj2) {
        this.f6443l = obj;
        this.f6444m = obj2;
        this.f6442k = j5;
    }

    @Override // i1.InterfaceC0622b
    public Object a() {
        j jVar = (j) this.f6443l;
        long jB = jVar.f6451g.b() + this.f6442k;
        h1.h hVar = (h1.h) jVar.f6447c;
        C0222i c0222i = (C0222i) this.f6444m;
        hVar.getClass();
        hVar.f(new h1.e(jB, c0222i));
        return null;
    }

    @Override // h1.f
    public Object apply(Object obj) {
        SQLiteDatabase sQLiteDatabase = (SQLiteDatabase) obj;
        int i = ((d1.c) this.f6444m).f6043k;
        String string = Integer.toString(i);
        String str = (String) this.f6443l;
        Cursor cursorRawQuery = sQLiteDatabase.rawQuery("SELECT 1 FROM log_event_dropped WHERE log_source = ? AND reason = ?", new String[]{str, string});
        try {
            boolean z5 = cursorRawQuery.getCount() > 0;
            cursorRawQuery.close();
            long j5 = this.f6442k;
            if (z5) {
                sQLiteDatabase.execSQL("UPDATE log_event_dropped SET events_dropped_count = events_dropped_count + " + j5 + " 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(j5));
            sQLiteDatabase.insert("log_event_dropped", null, contentValues);
            return null;
        } catch (Throwable th) {
            cursorRawQuery.close();
            throw th;
        }
    }
}
