package o;

import android.database.Cursor;
import androidx.work.impl.WorkDatabase_Impl;
import java.util.ArrayList;

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

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

    public static final void a(C3031ym0 c3031ym0, Gm0 gm0, C2062oc0 c2062oc0, ArrayList arrayList) {
        String str;
        int size = arrayList.size();
        int i = 0;
        while (i < size) {
            Object obj = arrayList.get(i);
            i++;
            Dm0 dm0 = (Dm0) obj;
            C2366rm0 c2366rm0O = C2887xC.o(dm0);
            String str2 = dm0.a;
            C1872mc0 c1872mc0D = c2062oc0.d(c2366rm0O);
            Integer numValueOf = c1872mc0D != null ? Integer.valueOf(c1872mc0D.c) : null;
            WorkDatabase_Impl workDatabase_Impl = (WorkDatabase_Impl) c3031ym0.m;
            C1449i30 c1449i30D = C1449i30.d(1, "SELECT name FROM workname WHERE work_spec_id=?");
            if (str2 == null) {
                c1449i30D.r(1);
            } else {
                c1449i30D.k(1, str2);
            }
            workDatabase_Impl.b();
            Cursor cursorL = workDatabase_Impl.l(c1449i30D);
            try {
                ArrayList arrayList2 = new ArrayList(cursorL.getCount());
                while (cursorL.moveToNext()) {
                    arrayList2.add(cursorL.isNull(0) ? null : cursorL.getString(0));
                }
                cursorL.close();
                c1449i30D.release();
                String strI0 = AbstractC3117zi.i0(arrayList2, ",", null, null, null, 62);
                String strI02 = AbstractC3117zi.i0(gm0.j(str2), ",", null, null, null, 62);
                StringBuilder sb = new StringBuilder("\n");
                sb.append(str2);
                sb.append("\t ");
                sb.append(dm0.c);
                sb.append("\t ");
                sb.append(numValueOf);
                sb.append("\t ");
                switch (dm0.b) {
                    case 1:
                        str = "ENQUEUED";
                        break;
                    case 2:
                        str = "RUNNING";
                        break;
                    case 3:
                        str = "SUCCEEDED";
                        break;
                    case 4:
                        str = "FAILED";
                        break;
                    case 5:
                        str = "BLOCKED";
                        break;
                    case 6:
                        str = "CANCELLED";
                        break;
                    default:
                        throw null;
                }
                sb.append(str);
                sb.append("\t ");
                sb.append(strI0);
                sb.append("\t ");
                sb.append(strI02);
                sb.append('\t');
            } catch (Throwable th) {
                cursorL.close();
                c1449i30D.release();
                throw th;
            }
        }
    }
}
