package o;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import androidx.work.impl.WorkDatabase;
import androidx.work.impl.background.systemalarm.SystemAlarmService;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.a2, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public abstract class AbstractC0680a2 {
    public static final /* synthetic */ int a = 0;

    static {
        C0669Zu.l("Alarms");
    }

    public static void a(Context context, C2366rm0 c2366rm0, int i) {
        AlarmManager alarmManager = (AlarmManager) context.getSystemService("alarm");
        int i2 = C1218fj.q;
        Intent intent = new Intent(context, (Class<?>) SystemAlarmService.class);
        intent.setAction("ACTION_DELAY_MET");
        C1218fj.d(intent, c2366rm0);
        PendingIntent service = PendingIntent.getService(context, i, intent, 603979776);
        if (service == null || alarmManager == null) {
            return;
        }
        C0669Zu c0669ZuE = C0669Zu.e();
        c2366rm0.toString();
        c0669ZuE.getClass();
        alarmManager.cancel(service);
    }

    public static void b(Context context, WorkDatabase workDatabase, C2366rm0 c2366rm0, long j) {
        C2062oc0 c2062oc0O = workDatabase.o();
        C1872mc0 c1872mc0D = c2062oc0O.d(c2366rm0);
        if (c1872mc0D != null) {
            int i = c1872mc0D.c;
            a(context, c2366rm0, i);
            AlarmManager alarmManager = (AlarmManager) context.getSystemService("alarm");
            int i2 = C1218fj.q;
            Intent intent = new Intent(context, (Class<?>) SystemAlarmService.class);
            intent.setAction("ACTION_DELAY_MET");
            C1218fj.d(intent, c2366rm0);
            PendingIntent service = PendingIntent.getService(context, i, intent, 201326592);
            if (alarmManager != null) {
                Z1.a(alarmManager, 0, j, service);
                return;
            }
            return;
        }
        int iIntValue = ((Number) workDatabase.m(new CallableC0376On(1, new C2132pG(workDatabase)))).intValue();
        c2062oc0O.f(new C1872mc0(c2366rm0.b, c2366rm0.a, iIntValue));
        AlarmManager alarmManager2 = (AlarmManager) context.getSystemService("alarm");
        int i3 = C1218fj.q;
        Intent intent2 = new Intent(context, (Class<?>) SystemAlarmService.class);
        intent2.setAction("ACTION_DELAY_MET");
        C1218fj.d(intent2, c2366rm0);
        PendingIntent service2 = PendingIntent.getService(context, iIntValue, intent2, 201326592);
        if (alarmManager2 != null) {
            Z1.a(alarmManager2, 0, j, service2);
        }
    }
}
