package defpackage;

import android.os.Build;
import androidx.work.impl.WorkDatabase;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/* renamed from: ᵦᵳᵖˊ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public abstract class AbstractC3607 {

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public static final /* synthetic */ int f13452 = 0;

    static {
        ᵼᵫᵧˀ.ˁˑᵰ("Schedulers");
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public static void m8221(C2650 c2650, ᵬˆˀᵣ r3, List list) {
        if (list.size() > 0) {
            r3.getClass();
            long jCurrentTimeMillis = System.currentTimeMillis();
            Iterator it = list.iterator();
            while (it.hasNext()) {
                c2650.m6640(jCurrentTimeMillis, ((C3887) it.next()).f14482);
            }
        }
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public static void m8222(C3019 c3019, WorkDatabase workDatabase, List list) {
        List list2;
        if (list == null || list.size() == 0) {
            return;
        }
        C2650 c2650Mo678 = workDatabase.mo678();
        workDatabase.m683();
        try {
            if (Build.VERSION.SDK_INT >= 24) {
                list2 = (List) ˊˉʤﹳ.ˌᵪ(c2650Mo678.f10260, true, false, new ᵭʽᵦ(14));
                m8221(c2650Mo678, c3019.f11642, list2);
            } else {
                list2 = null;
            }
            final int i = c3019.f11639;
            List list3 = (List) ˊˉʤﹳ.ˌᵪ(c2650Mo678.f10260, true, false, new InterfaceC0362() { // from class: ˇᵴᵪ
                @Override // defpackage.InterfaceC0362
                /* renamed from: ᵴᵳ */
                public final Object mo1588(Object obj) throws Exception {
                    int i2;
                    Integer numValueOf;
                    int i3 = i;
                    InterfaceC1171 interfaceC1171Mo1850 = ((InterfaceC3042) obj).mo1850("SELECT * FROM workspec WHERE state=0 AND schedule_requested_at=-1 ORDER BY last_enqueue_time LIMIT (SELECT MAX(?-COUNT(*), 0) FROM workspec WHERE schedule_requested_at<>-1 AND LENGTH(content_uri_triggers)=0 AND state NOT IN (2, 3, 5))");
                    try {
                        interfaceC1171Mo1850.mo3680(i3, 1);
                        int i4 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "id");
                        int i5 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "state");
                        int i6 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "worker_class_name");
                        int i7 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "input_merger_class_name");
                        int i8 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "input");
                        int i9 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "output");
                        int i10 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "initial_delay");
                        int i11 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "interval_duration");
                        int i12 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "flex_duration");
                        int i13 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "run_attempt_count");
                        int i14 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "backoff_policy");
                        int i15 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "backoff_delay_duration");
                        int i16 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "last_enqueue_time");
                        int i17 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "minimum_retention_duration");
                        int i18 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "schedule_requested_at");
                        int i19 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "run_in_foreground");
                        int i20 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "out_of_quota_policy");
                        int i21 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "period_count");
                        int i22 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "generation");
                        int i23 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "next_schedule_time_override");
                        int i24 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "next_schedule_time_override_generation");
                        int i25 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "stop_reason");
                        int i26 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "trace_tag");
                        int i27 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "backoff_on_system_interruptions");
                        int i28 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "required_network_type");
                        int i29 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "required_network_request");
                        int i30 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "requires_charging");
                        int i31 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "requires_device_idle");
                        int i32 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "requires_battery_not_low");
                        int i33 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "requires_storage_not_low");
                        int i34 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "trigger_content_update_delay");
                        int i35 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "trigger_max_content_delay");
                        int i36 = ˉˇʨ.ᵳٴᵶ(interfaceC1171Mo1850, "content_uri_triggers");
                        ArrayList arrayList = new ArrayList();
                        while (interfaceC1171Mo1850.mo3681()) {
                            String strMo3674 = interfaceC1171Mo1850.mo3674(i4);
                            int i37 = i16;
                            int i38 = i17;
                            EnumC4022 enumC4022 = ᵯᵽᵦ.ᵡˎ((int) interfaceC1171Mo1850.getLong(i5));
                            String strMo36742 = interfaceC1171Mo1850.mo3674(i6);
                            String strMo36743 = interfaceC1171Mo1850.mo3674(i7);
                            byte[] blob = interfaceC1171Mo1850.getBlob(i8);
                            C2969 c2969 = C2969.f11488;
                            C2969 c29692 = ˉᵜˆ.ᵸˑ(blob);
                            C2969 c29693 = ˉᵜˆ.ᵸˑ(interfaceC1171Mo1850.getBlob(i9));
                            long j = interfaceC1171Mo1850.getLong(i10);
                            long j2 = interfaceC1171Mo1850.getLong(i11);
                            long j3 = interfaceC1171Mo1850.getLong(i12);
                            int i39 = (int) interfaceC1171Mo1850.getLong(i13);
                            int i40 = i4;
                            int i41 = i5;
                            int i42 = ᵯᵽᵦ.ᵤᵙᵷ((int) interfaceC1171Mo1850.getLong(i14));
                            long j4 = interfaceC1171Mo1850.getLong(i15);
                            long j5 = interfaceC1171Mo1850.getLong(i37);
                            long j6 = interfaceC1171Mo1850.getLong(i38);
                            int i43 = i18;
                            long j7 = interfaceC1171Mo1850.getLong(i43);
                            i18 = i43;
                            int i44 = i19;
                            int i45 = i6;
                            boolean z = ((int) interfaceC1171Mo1850.getLong(i44)) != 0;
                            int i46 = i20;
                            int i47 = i7;
                            int i48 = ᵯᵽᵦ.ˀᵗᵝᵭ((int) interfaceC1171Mo1850.getLong(i46));
                            int i49 = i21;
                            int i50 = (int) interfaceC1171Mo1850.getLong(i49);
                            int i51 = i22;
                            int i52 = (int) interfaceC1171Mo1850.getLong(i51);
                            int i53 = i23;
                            long j8 = interfaceC1171Mo1850.getLong(i53);
                            int i54 = i24;
                            int i55 = (int) interfaceC1171Mo1850.getLong(i54);
                            i24 = i54;
                            int i56 = i25;
                            int i57 = (int) interfaceC1171Mo1850.getLong(i56);
                            int i58 = i26;
                            Boolean boolValueOf = null;
                            String strMo36744 = interfaceC1171Mo1850.isNull(i58) ? null : interfaceC1171Mo1850.mo3674(i58);
                            int i59 = i27;
                            if (interfaceC1171Mo1850.isNull(i59)) {
                                i2 = i58;
                                i25 = i56;
                                numValueOf = null;
                            } else {
                                i2 = i58;
                                i25 = i56;
                                numValueOf = Integer.valueOf((int) interfaceC1171Mo1850.getLong(i59));
                            }
                            if (numValueOf != null) {
                                boolValueOf = Boolean.valueOf(numValueOf.intValue() != 0);
                            }
                            Boolean bool = boolValueOf;
                            int i60 = i28;
                            int i61 = ᵯᵽᵦ.ᵡⁱᵥ((int) interfaceC1171Mo1850.getLong(i60));
                            int i62 = i29;
                            C1456 c1456 = ᵯᵽᵦ.ᵛˈᵤ(interfaceC1171Mo1850.getBlob(i62));
                            int i63 = i30;
                            boolean z2 = ((int) interfaceC1171Mo1850.getLong(i63)) != 0;
                            int i64 = i31;
                            boolean z3 = ((int) interfaceC1171Mo1850.getLong(i64)) != 0;
                            int i65 = i32;
                            boolean z4 = ((int) interfaceC1171Mo1850.getLong(i65)) != 0;
                            i32 = i65;
                            int i66 = i33;
                            int i67 = i34;
                            int i68 = i35;
                            i34 = i67;
                            int i69 = i36;
                            arrayList.add(new C3887(strMo3674, enumC4022, strMo36742, strMo36743, c29692, c29693, j, j2, j3, new C2088(c1456, i61, z2, z3, z4, ((int) interfaceC1171Mo1850.getLong(i66)) != 0, interfaceC1171Mo1850.getLong(i67), interfaceC1171Mo1850.getLong(i68), ᵯᵽᵦ.ᵥᵯˎ(interfaceC1171Mo1850.getBlob(i69))), i39, i42, j4, j5, j6, j7, z, i48, i50, i52, j8, i55, i57, strMo36744, bool));
                            i31 = i64;
                            i7 = i47;
                            i20 = i46;
                            i21 = i49;
                            i22 = i51;
                            i23 = i53;
                            i26 = i2;
                            i27 = i59;
                            i28 = i60;
                            i29 = i62;
                            i30 = i63;
                            i36 = i69;
                            i35 = i68;
                            i33 = i66;
                            i4 = i40;
                            i6 = i45;
                            i16 = i37;
                            i17 = i38;
                            i5 = i41;
                            i19 = i44;
                        }
                        interfaceC1171Mo1850.close();
                        return arrayList;
                    } catch (Throwable th) {
                        interfaceC1171Mo1850.close();
                        throw th;
                    }
                }
            });
            m8221(c2650Mo678, c3019.f11642, list3);
            if (list2 != null) {
                list3.addAll(list2);
            }
            List list4 = (List) ˊˉʤﹳ.ˌᵪ(c2650Mo678.f10260, true, false, new ᵭʽᵦ(17));
            workDatabase.m675();
            workDatabase.m668();
            if (list3.size() > 0) {
                C3887[] c3887Arr = (C3887[]) list3.toArray(new C3887[list3.size()]);
                Iterator it = list.iterator();
                while (it.hasNext()) {
                    InterfaceC3764 interfaceC3764 = (InterfaceC3764) it.next();
                    if (interfaceC3764.mo4859()) {
                        interfaceC3764.mo4856(c3887Arr);
                    }
                }
            }
            if (list4.size() > 0) {
                C3887[] c3887Arr2 = (C3887[]) list4.toArray(new C3887[list4.size()]);
                Iterator it2 = list.iterator();
                while (it2.hasNext()) {
                    InterfaceC3764 interfaceC37642 = (InterfaceC3764) it2.next();
                    if (!interfaceC37642.mo4859()) {
                        interfaceC37642.mo4856(c3887Arr2);
                    }
                }
            }
        } catch (Throwable th) {
            workDatabase.m668();
            throw th;
        }
    }
}
