package c.f.m; import android.content.Context; import c.f.m.m; import com.airbnb.lottie.parser.AnimatableValueParser; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.LinkedHashSet; /* compiled from: ExoSoSource */ public final class e extends m { /* compiled from: ExoSoSource */ public final class b extends m.f { public final c[] i; /* compiled from: ExoSoSource */ public final class a extends m.e { public int i; public a(a aVar) { } @Override // c.f.m.m.e public boolean a() { return this.i < b.this.i.length; } @Override // c.f.m.m.e public m.d b() throws IOException { c[] cVarArr = b.this.i; int i = this.i; this.i = i + 1; c cVar = cVarArr[i]; FileInputStream fileInputStream = new FileInputStream(cVar.k); try { return new m.d(cVar, fileInputStream); } catch (Throwable th) { fileInputStream.close(); throw th; } } } /* JADX WARNING: Code restructure failed: missing block: B:35:0x00e6, code lost: r0 = move-exception; */ /* JADX WARNING: Code restructure failed: missing block: B:38:?, code lost: r7.close(); */ /* JADX WARNING: Code restructure failed: missing block: B:39:0x00ec, code lost: r0 = move-exception; */ /* JADX WARNING: Code restructure failed: missing block: B:40:0x00ed, code lost: r0.addSuppressed(r0); */ /* JADX WARNING: Code restructure failed: missing block: B:41:0x00f1, code lost: throw r0; */ /* JADX WARNING: Code restructure failed: missing block: B:46:0x00f5, code lost: r0 = move-exception; */ /* JADX WARNING: Code restructure failed: missing block: B:49:?, code lost: r9.close(); */ /* JADX WARNING: Code restructure failed: missing block: B:50:0x00fb, code lost: r0 = move-exception; */ /* JADX WARNING: Code restructure failed: missing block: B:51:0x00fc, code lost: r0.addSuppressed(r0); */ /* JADX WARNING: Code restructure failed: missing block: B:52:0x0100, code lost: throw r0; */ public b(e eVar, m mVar) throws IOException { boolean z2; Context context = eVar.f508c; StringBuilder L = c.d.b.a.a.L("/data/local/tmp/exopackage/"); L.append(context.getPackageName()); L.append("/native-libs/"); File file = new File(L.toString()); ArrayList arrayList = new ArrayList(); LinkedHashSet linkedHashSet = new LinkedHashSet(); String[] M0 = AnimatableValueParser.M0(); for (String str : M0) { File file2 = new File(file, str); if (file2.isDirectory()) { linkedHashSet.add(str); File file3 = new File(file2, "metadata.txt"); if (file3.isFile()) { FileReader fileReader = new FileReader(file3); BufferedReader bufferedReader = new BufferedReader(fileReader); while (true) { String readLine = bufferedReader.readLine(); if (readLine == null) { bufferedReader.close(); fileReader.close(); break; } else if (readLine.length() != 0) { int indexOf = readLine.indexOf(32); if (indexOf != -1) { String str2 = readLine.substring(0, indexOf) + ".so"; int size = arrayList.size(); int i = 0; while (true) { if (i >= size) { z2 = false; break; } else if (((c) arrayList.get(i)).i.equals(str2)) { z2 = true; break; } else { i++; } } if (!z2) { String substring = readLine.substring(indexOf + 1); arrayList.add(new c(str2, substring, new File(file2, substring))); } } else { throw new RuntimeException("illegal line in exopackage metadata: [" + readLine + "]"); } } } } else { continue; } } } String[] strArr = (String[]) linkedHashSet.toArray(new String[linkedHashSet.size()]); this.i = (c[]) arrayList.toArray(new c[arrayList.size()]); } @Override // c.f.m.m.f public m.c a() throws IOException { return new m.c(this.i); } @Override // c.f.m.m.f public m.e b() throws IOException { return new a(null); } } /* compiled from: ExoSoSource */ public static final class c extends m.b { public final File k; public c(String str, String str2, File file) { super(str, str2); this.k = file; } } public e(Context context, String str) { super(context, str); } @Override // c.f.m.m public m.f h() throws IOException { return new b(this, this); } }