package androidx.work.impl;

import a6.h;
import android.content.Context;
import androidx.sqlite.db.SupportSQLiteDatabase;
import androidx.sqlite.db.SupportSQLiteOpenHelper;
import androidx.work.impl.a;
import f5.q;
import f5.r;
import h6.e;
import h6.g;
import h6.j;
import h6.m;
import h6.p;
import h6.s;
import h6.v;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import p5.f;

/* loaded from: classes.dex */
public abstract class WorkDatabase extends r {

    /* renamed from: p, reason: collision with root package name */
    private static final long f5898p = TimeUnit.DAYS.toMillis(1);

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public class a implements SupportSQLiteOpenHelper.b {

        /* renamed from: a, reason: collision with root package name */
        final /* synthetic */ Context f5899a;

        a(Context context) {
            this.f5899a = context;
        }

        @Override // androidx.sqlite.db.SupportSQLiteOpenHelper.b
        public SupportSQLiteOpenHelper create(SupportSQLiteOpenHelper.Configuration configuration) {
            SupportSQLiteOpenHelper.Configuration.a a10 = SupportSQLiteOpenHelper.Configuration.a(this.f5899a);
            a10.c(configuration.f5624b).b(configuration.f5625c).d(true);
            return new f().create(a10.a());
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public class b extends r.b {
        b() {
        }

        @Override // f5.r.b
        public void c(SupportSQLiteDatabase supportSQLiteDatabase) {
            super.c(supportSQLiteDatabase);
            supportSQLiteDatabase.beginTransaction();
            try {
                supportSQLiteDatabase.execSQL(WorkDatabase.I());
                supportSQLiteDatabase.setTransactionSuccessful();
            } finally {
                supportSQLiteDatabase.endTransaction();
            }
        }
    }

    public static WorkDatabase E(Context context, Executor executor, boolean z10) {
        r.a a10;
        if (z10) {
            a10 = q.c(context, WorkDatabase.class).c();
        } else {
            a10 = q.a(context, WorkDatabase.class, h.d());
            a10.g(new a(context));
        }
        return (WorkDatabase) a10.h(executor).a(G()).b(androidx.work.impl.a.f5909a).b(new a.h(context, 2, 3)).b(androidx.work.impl.a.f5910b).b(androidx.work.impl.a.f5911c).b(new a.h(context, 5, 6)).b(androidx.work.impl.a.f5912d).b(androidx.work.impl.a.f5913e).b(androidx.work.impl.a.f5914f).b(new a.i(context)).b(new a.h(context, 10, 11)).b(androidx.work.impl.a.f5915g).e().d();
    }

    static r.b G() {
        return new b();
    }

    static long H() {
        return System.currentTimeMillis() - f5898p;
    }

    static String I() {
        return "DELETE FROM workspec WHERE state IN (2, 3, 5) AND (period_start_time + minimum_retention_duration) < " + H() + " AND (SELECT COUNT(*)=0 FROM dependency WHERE     prerequisite_id=id AND     work_spec_id NOT IN         (SELECT id FROM workspec WHERE state IN (2, 3, 5)))";
    }

    public abstract h6.b F();

    public abstract e J();

    public abstract g K();

    public abstract j L();

    public abstract m M();

    public abstract p N();

    public abstract s O();

    public abstract v P();
}
