package o;

import androidx.work.impl.WorkDatabase;
import androidx.work.impl.WorkDatabase_Impl;
import java.util.Iterator;
import java.util.LinkedList;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.og, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public abstract class AbstractRunnableC2069og implements Runnable {
    public final C3031ym0 l = new C3031ym0(1);

    public static void a(C2651um0 c2651um0, String str) {
        Lm0 lm0B;
        WorkDatabase workDatabase = c2651um0.m;
        Em0 em0S = workDatabase.s();
        C3040yr c3040yrF = workDatabase.f();
        LinkedList linkedList = new LinkedList();
        linkedList.add(str);
        while (!linkedList.isEmpty()) {
            String str2 = (String) linkedList.remove();
            int iF = em0S.f(str2);
            if (iF != 3 && iF != 4) {
                WorkDatabase_Impl workDatabase_Impl = em0S.a;
                workDatabase_Impl.b();
                C1967nc0 c1967nc0 = em0S.e;
                LC lcA = c1967nc0.a();
                if (str2 == null) {
                    lcA.r(1);
                } else {
                    lcA.k(1, str2);
                }
                workDatabase_Impl.c();
                try {
                    lcA.b();
                    workDatabase_Impl.n();
                } finally {
                    workDatabase_Impl.j();
                    c1967nc0.c(lcA);
                }
            }
            linkedList.addAll(c3040yrF.c(str2));
        }
        XY xy = c2651um0.p;
        synchronized (xy.k) {
            C0669Zu.e().getClass();
            xy.i.add(str);
            lm0B = xy.b(str);
        }
        XY.d(lm0B, 1);
        Iterator it = c2651um0.f748o.iterator();
        while (it.hasNext()) {
            ((D40) it.next()).a(str);
        }
    }

    public abstract void b();

    @Override // java.lang.Runnable
    public final void run() {
        C3031ym0 c3031ym0 = this.l;
        try {
            b();
            c3031ym0.a(C3031ym0.f811o);
        } catch (Throwable th) {
            c3031ym0.a(new C3095zU(th));
        }
    }
}
