package androidx.work.impl;

import android.content.Context;
import androidx.sqlite.db.SupportSQLiteDatabase;

/* loaded from: classes.dex */
public abstract class a {

    /* renamed from: a, reason: collision with root package name */
    public static g5.a f5909a = new C0149a(1, 2);

    /* renamed from: b, reason: collision with root package name */
    public static g5.a f5910b = new b(3, 4);

    /* renamed from: c, reason: collision with root package name */
    public static g5.a f5911c = new c(4, 5);

    /* renamed from: d, reason: collision with root package name */
    public static g5.a f5912d = new d(6, 7);

    /* renamed from: e, reason: collision with root package name */
    public static g5.a f5913e = new e(7, 8);

    /* renamed from: f, reason: collision with root package name */
    public static g5.a f5914f = new f(8, 9);

    /* renamed from: g, reason: collision with root package name */
    public static g5.a f5915g = new g(11, 12);

    /* renamed from: androidx.work.impl.a$a, reason: collision with other inner class name */
    /* loaded from: classes.dex */
    class C0149a extends g5.a {
        C0149a(int i10, int i11) {
            super(i10, i11);
        }

        @Override // g5.a
        public void a(SupportSQLiteDatabase supportSQLiteDatabase) {
            supportSQLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS `SystemIdInfo` (`work_spec_id` TEXT NOT NULL, `system_id` INTEGER NOT NULL, PRIMARY KEY(`work_spec_id`), FOREIGN KEY(`work_spec_id`) REFERENCES `WorkSpec`(`id`) ON UPDATE CASCADE ON DELETE CASCADE )");
            supportSQLiteDatabase.execSQL("INSERT INTO SystemIdInfo(work_spec_id, system_id) SELECT work_spec_id, alarm_id AS system_id FROM alarmInfo");
            supportSQLiteDatabase.execSQL("DROP TABLE IF EXISTS alarmInfo");
            supportSQLiteDatabase.execSQL("INSERT OR IGNORE INTO worktag(tag, work_spec_id) SELECT worker_class_name AS tag, id AS work_spec_id FROM workspec");
        }
    }

    /* loaded from: classes.dex */
    class b extends g5.a {
        b(int i10, int i11) {
            super(i10, i11);
        }

        @Override // g5.a
        public void a(SupportSQLiteDatabase supportSQLiteDatabase) {
            supportSQLiteDatabase.execSQL("UPDATE workspec SET schedule_requested_at=0 WHERE state NOT IN (2, 3, 5) AND schedule_requested_at=-1 AND interval_duration<>0");
        }
    }

    /* loaded from: classes.dex */
    class c extends g5.a {
        c(int i10, int i11) {
            super(i10, i11);
        }

        @Override // g5.a
        public void a(SupportSQLiteDatabase supportSQLiteDatabase) {
            supportSQLiteDatabase.execSQL("ALTER TABLE workspec ADD COLUMN `trigger_content_update_delay` INTEGER NOT NULL DEFAULT -1");
            supportSQLiteDatabase.execSQL("ALTER TABLE workspec ADD COLUMN `trigger_max_content_delay` INTEGER NOT NULL DEFAULT -1");
        }
    }

    /* loaded from: classes.dex */
    class d extends g5.a {
        d(int i10, int i11) {
            super(i10, i11);
        }

        @Override // g5.a
        public void a(SupportSQLiteDatabase supportSQLiteDatabase) {
            supportSQLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS `WorkProgress` (`work_spec_id` TEXT NOT NULL, `progress` BLOB NOT NULL, PRIMARY KEY(`work_spec_id`), FOREIGN KEY(`work_spec_id`) REFERENCES `WorkSpec`(`id`) ON UPDATE CASCADE ON DELETE CASCADE )");
        }
    }

    /* loaded from: classes.dex */
    class e extends g5.a {
        e(int i10, int i11) {
            super(i10, i11);
        }

        @Override // g5.a
        public void a(SupportSQLiteDatabase supportSQLiteDatabase) {
            supportSQLiteDatabase.execSQL("CREATE INDEX IF NOT EXISTS `index_WorkSpec_period_start_time` ON `workspec` (`period_start_time`)");
        }
    }

    /* loaded from: classes.dex */
    class f extends g5.a {
        f(int i10, int i11) {
            super(i10, i11);
        }

        @Override // g5.a
        public void a(SupportSQLiteDatabase supportSQLiteDatabase) {
            supportSQLiteDatabase.execSQL("ALTER TABLE workspec ADD COLUMN `run_in_foreground` INTEGER NOT NULL DEFAULT 0");
        }
    }

    /* loaded from: classes.dex */
    class g extends g5.a {
        g(int i10, int i11) {
            super(i10, i11);
        }

        @Override // g5.a
        public void a(SupportSQLiteDatabase supportSQLiteDatabase) {
            supportSQLiteDatabase.execSQL("ALTER TABLE workspec ADD COLUMN `out_of_quota_policy` INTEGER NOT NULL DEFAULT 0");
        }
    }

    /* loaded from: classes.dex */
    public static class h extends g5.a {

        /* renamed from: c, reason: collision with root package name */
        final Context f5916c;

        public h(Context context, int i10, int i11) {
            super(i10, i11);
            this.f5916c = context;
        }

        @Override // g5.a
        public void a(SupportSQLiteDatabase supportSQLiteDatabase) {
            if (this.f19036b >= 10) {
                supportSQLiteDatabase.execSQL("INSERT OR REPLACE INTO `Preference` (`key`, `long_value`) VALUES (@key, @long_value)", new Object[]{"reschedule_needed", 1});
            } else {
                this.f5916c.getSharedPreferences("androidx.work.util.preferences", 0).edit().putBoolean("reschedule_needed", true).apply();
            }
        }
    }

    /* loaded from: classes.dex */
    public static class i extends g5.a {

        /* renamed from: c, reason: collision with root package name */
        final Context f5917c;

        public i(Context context) {
            super(9, 10);
            this.f5917c = context;
        }

        @Override // g5.a
        public void a(SupportSQLiteDatabase supportSQLiteDatabase) {
            supportSQLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS `Preference` (`key` TEXT NOT NULL, `long_value` INTEGER, PRIMARY KEY(`key`))");
            i6.e.b(this.f5917c, supportSQLiteDatabase);
            i6.c.a(this.f5917c, supportSQLiteDatabase);
        }
    }
}
