package c1; import android.os.Build; import androidx.work.d; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.util.Iterator; /* loaded from: classes.dex */ public abstract class v { static /* synthetic */ class a { /* renamed from: a, reason: collision with root package name */ static final /* synthetic */ int[] f3441a; /* renamed from: b, reason: collision with root package name */ static final /* synthetic */ int[] f3442b; /* renamed from: c, reason: collision with root package name */ static final /* synthetic */ int[] f3443c; /* renamed from: d, reason: collision with root package name */ static final /* synthetic */ int[] f3444d; static { int[] iArr = new int[androidx.work.q.values().length]; f3444d = iArr; try { iArr[androidx.work.q.RUN_AS_NON_EXPEDITED_WORK_REQUEST.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { f3444d[androidx.work.q.DROP_WORK_REQUEST.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } int[] iArr2 = new int[androidx.work.n.values().length]; f3443c = iArr2; try { iArr2[androidx.work.n.NOT_REQUIRED.ordinal()] = 1; } catch (NoSuchFieldError unused3) { } try { f3443c[androidx.work.n.CONNECTED.ordinal()] = 2; } catch (NoSuchFieldError unused4) { } try { f3443c[androidx.work.n.UNMETERED.ordinal()] = 3; } catch (NoSuchFieldError unused5) { } try { f3443c[androidx.work.n.NOT_ROAMING.ordinal()] = 4; } catch (NoSuchFieldError unused6) { } try { f3443c[androidx.work.n.METERED.ordinal()] = 5; } catch (NoSuchFieldError unused7) { } int[] iArr3 = new int[androidx.work.a.values().length]; f3442b = iArr3; try { iArr3[androidx.work.a.EXPONENTIAL.ordinal()] = 1; } catch (NoSuchFieldError unused8) { } try { f3442b[androidx.work.a.LINEAR.ordinal()] = 2; } catch (NoSuchFieldError unused9) { } int[] iArr4 = new int[androidx.work.v.values().length]; f3441a = iArr4; try { iArr4[androidx.work.v.ENQUEUED.ordinal()] = 1; } catch (NoSuchFieldError unused10) { } try { f3441a[androidx.work.v.RUNNING.ordinal()] = 2; } catch (NoSuchFieldError unused11) { } try { f3441a[androidx.work.v.SUCCEEDED.ordinal()] = 3; } catch (NoSuchFieldError unused12) { } try { f3441a[androidx.work.v.FAILED.ordinal()] = 4; } catch (NoSuchFieldError unused13) { } try { f3441a[androidx.work.v.BLOCKED.ordinal()] = 5; } catch (NoSuchFieldError unused14) { } try { f3441a[androidx.work.v.CANCELLED.ordinal()] = 6; } catch (NoSuchFieldError unused15) { } } } public static int a(androidx.work.a aVar) { int i10 = a.f3442b[aVar.ordinal()]; if (i10 == 1) { return 0; } if (i10 == 2) { return 1; } throw new IllegalArgumentException("Could not convert " + aVar + " to int"); } /* JADX WARN: Removed duplicated region for block: B:42:0x005a A[EXC_TOP_SPLITTER, SYNTHETIC] */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ public static androidx.work.d b(byte[] r6) { /* androidx.work.d r0 = new androidx.work.d r0.() if (r6 != 0) goto L8 return r0 L8: java.io.ByteArrayInputStream r1 = new java.io.ByteArrayInputStream r1.(r6) r6 = 0 java.io.ObjectInputStream r2 = new java.io.ObjectInputStream // Catch: java.lang.Throwable -> L39 java.io.IOException -> L3d r2.(r1) // Catch: java.lang.Throwable -> L39 java.io.IOException -> L3d int r6 = r2.readInt() // Catch: java.io.IOException -> L37 java.lang.Throwable -> L57 L17: if (r6 <= 0) goto L2b java.lang.String r3 = r2.readUTF() // Catch: java.io.IOException -> L37 java.lang.Throwable -> L57 android.net.Uri r3 = android.net.Uri.parse(r3) // Catch: java.io.IOException -> L37 java.lang.Throwable -> L57 boolean r4 = r2.readBoolean() // Catch: java.io.IOException -> L37 java.lang.Throwable -> L57 r0.a(r3, r4) // Catch: java.io.IOException -> L37 java.lang.Throwable -> L57 int r6 = r6 + (-1) goto L17 L2b: r2.close() // Catch: java.io.IOException -> L2f goto L33 L2f: r6 = move-exception r6.printStackTrace() L33: r1.close() // Catch: java.io.IOException -> L52 goto L56 L37: r6 = move-exception goto L41 L39: r0 = move-exception r2 = r6 r6 = r0 goto L58 L3d: r2 = move-exception r5 = r2 r2 = r6 r6 = r5 L41: r6.printStackTrace() // Catch: java.lang.Throwable -> L57 if (r2 == 0) goto L4e r2.close() // Catch: java.io.IOException -> L4a goto L4e L4a: r6 = move-exception r6.printStackTrace() L4e: r1.close() // Catch: java.io.IOException -> L52 goto L56 L52: r6 = move-exception r6.printStackTrace() L56: return r0 L57: r6 = move-exception L58: if (r2 == 0) goto L62 r2.close() // Catch: java.io.IOException -> L5e goto L62 L5e: r0 = move-exception r0.printStackTrace() L62: r1.close() // Catch: java.io.IOException -> L66 goto L6a L66: r0 = move-exception r0.printStackTrace() L6a: throw r6 */ throw new UnsupportedOperationException("Method not decompiled: c1.v.b(byte[]):androidx.work.d"); } /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:52:0x0067 -> B:18:0x006a). Please report as a decompilation issue!!! */ public static byte[] c(androidx.work.d dVar) { boolean hasNext; ObjectOutputStream objectOutputStream = null; ObjectOutputStream objectOutputStream2 = null; objectOutputStream = null; if (dVar.c() == 0) { return null; } ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try { } catch (IOException e10) { e10.printStackTrace(); objectOutputStream = objectOutputStream; } try { try { ObjectOutputStream objectOutputStream3 = new ObjectOutputStream(byteArrayOutputStream); try { objectOutputStream3.writeInt(dVar.c()); Iterator it = dVar.b().iterator(); while (true) { hasNext = it.hasNext(); if (hasNext != 0) { d.a aVar = (d.a) it.next(); objectOutputStream3.writeUTF(aVar.a().toString()); objectOutputStream3.writeBoolean(aVar.b()); } else { try { break; } catch (IOException e11) { e11.printStackTrace(); } } } objectOutputStream3.close(); byteArrayOutputStream.close(); objectOutputStream = hasNext; } catch (IOException e12) { e = e12; objectOutputStream2 = objectOutputStream3; e.printStackTrace(); if (objectOutputStream2 != null) { try { objectOutputStream2.close(); } catch (IOException e13) { e13.printStackTrace(); } } byteArrayOutputStream.close(); objectOutputStream = objectOutputStream2; return byteArrayOutputStream.toByteArray(); } catch (Throwable th) { th = th; objectOutputStream = objectOutputStream3; if (objectOutputStream != null) { try { objectOutputStream.close(); } catch (IOException e14) { e14.printStackTrace(); } } try { byteArrayOutputStream.close(); throw th; } catch (IOException e15) { e15.printStackTrace(); throw th; } } } catch (IOException e16) { e = e16; } return byteArrayOutputStream.toByteArray(); } catch (Throwable th2) { th = th2; } } public static androidx.work.a d(int i10) { if (i10 == 0) { return androidx.work.a.EXPONENTIAL; } if (i10 == 1) { return androidx.work.a.LINEAR; } throw new IllegalArgumentException("Could not convert " + i10 + " to BackoffPolicy"); } public static androidx.work.n e(int i10) { if (i10 == 0) { return androidx.work.n.NOT_REQUIRED; } if (i10 == 1) { return androidx.work.n.CONNECTED; } if (i10 == 2) { return androidx.work.n.UNMETERED; } if (i10 == 3) { return androidx.work.n.NOT_ROAMING; } if (i10 == 4) { return androidx.work.n.METERED; } if (Build.VERSION.SDK_INT >= 30 && i10 == 5) { return androidx.work.n.TEMPORARILY_UNMETERED; } throw new IllegalArgumentException("Could not convert " + i10 + " to NetworkType"); } public static androidx.work.q f(int i10) { if (i10 == 0) { return androidx.work.q.RUN_AS_NON_EXPEDITED_WORK_REQUEST; } if (i10 == 1) { return androidx.work.q.DROP_WORK_REQUEST; } throw new IllegalArgumentException("Could not convert " + i10 + " to OutOfQuotaPolicy"); } public static androidx.work.v g(int i10) { if (i10 == 0) { return androidx.work.v.ENQUEUED; } if (i10 == 1) { return androidx.work.v.RUNNING; } if (i10 == 2) { return androidx.work.v.SUCCEEDED; } if (i10 == 3) { return androidx.work.v.FAILED; } if (i10 == 4) { return androidx.work.v.BLOCKED; } if (i10 == 5) { return androidx.work.v.CANCELLED; } throw new IllegalArgumentException("Could not convert " + i10 + " to State"); } public static int h(androidx.work.n nVar) { int i10 = a.f3443c[nVar.ordinal()]; if (i10 == 1) { return 0; } if (i10 == 2) { return 1; } if (i10 == 3) { return 2; } if (i10 == 4) { return 3; } if (i10 == 5) { return 4; } if (Build.VERSION.SDK_INT >= 30 && nVar == androidx.work.n.TEMPORARILY_UNMETERED) { return 5; } throw new IllegalArgumentException("Could not convert " + nVar + " to int"); } public static int i(androidx.work.q qVar) { int i10 = a.f3444d[qVar.ordinal()]; if (i10 == 1) { return 0; } if (i10 == 2) { return 1; } throw new IllegalArgumentException("Could not convert " + qVar + " to int"); } public static int j(androidx.work.v vVar) { switch (a.f3441a[vVar.ordinal()]) { case 1: return 0; case 2: return 1; case 3: return 2; case 4: return 3; case 5: return 4; case 6: return 5; default: throw new IllegalArgumentException("Could not convert " + vVar + " to int"); } } }