package o;

import android.content.Context;
import android.content.SharedPreferences;
import android.database.SQLException;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.p20, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C2111p20 extends CP {
    public final /* synthetic */ int c = 1;
    public final Context d;

    public C2111p20(Context context, int i, int i2) {
        super(i, i2);
        this.d = context;
    }

    @Override // o.CP
    public final void a(FC fc) throws SQLException {
        switch (this.c) {
            case 0:
                if (this.b >= 10) {
                    fc.j(new Object[]{"reschedule_needed", 1});
                    return;
                } else {
                    this.d.getSharedPreferences("androidx.work.util.preferences", 0).edit().putBoolean("reschedule_needed", true).apply();
                    return;
                }
            default:
                fc.g("CREATE TABLE IF NOT EXISTS `Preference` (`key` TEXT NOT NULL, `long_value` INTEGER, PRIMARY KEY(`key`))");
                Context context = this.d;
                SharedPreferences sharedPreferences = context.getSharedPreferences("androidx.work.util.preferences", 0);
                if (sharedPreferences.contains("reschedule_needed") || sharedPreferences.contains("last_cancel_all_time_ms")) {
                    long j = sharedPreferences.getLong("last_cancel_all_time_ms", 0L);
                    long j2 = sharedPreferences.getBoolean("reschedule_needed", false) ? 1L : 0L;
                    fc.b();
                    try {
                        fc.j(new Object[]{"last_cancel_all_time_ms", Long.valueOf(j)});
                        fc.j(new Object[]{"reschedule_needed", Long.valueOf(j2)});
                        sharedPreferences.edit().clear().apply();
                        fc.w();
                    } finally {
                    }
                }
                SharedPreferences sharedPreferences2 = context.getSharedPreferences("androidx.work.util.id", 0);
                if (sharedPreferences2.contains("next_job_scheduler_id") || sharedPreferences2.contains("next_job_scheduler_id")) {
                    int i = sharedPreferences2.getInt("next_job_scheduler_id", 0);
                    int i2 = sharedPreferences2.getInt("next_alarm_manager_id", 0);
                    fc.b();
                    try {
                        fc.j(new Object[]{"next_job_scheduler_id", Integer.valueOf(i)});
                        fc.j(new Object[]{"next_alarm_manager_id", Integer.valueOf(i2)});
                        sharedPreferences2.edit().clear().apply();
                        fc.w();
                        return;
                    } finally {
                    }
                }
                return;
        }
    }

    public C2111p20(Context context) {
        super(9, 10);
        this.d = context;
    }
}
