package g6; import android.content.ContentResolver; import android.net.Uri; import android.text.TextUtils; import android.util.Log; import e6.g; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.List; /* loaded from: classes2.dex */ class e { /* renamed from: f, reason: collision with root package name */ private static final c f9728f = new c(); /* renamed from: a, reason: collision with root package name */ private final c f9729a; /* renamed from: b, reason: collision with root package name */ private final d f9730b; /* renamed from: c, reason: collision with root package name */ private final i6.a f9731c; /* renamed from: d, reason: collision with root package name */ private final ContentResolver f9732d; /* renamed from: e, reason: collision with root package name */ private final List f9733e; e(List list, c cVar, d dVar, i6.a aVar, ContentResolver contentResolver) { this.f9729a = cVar; this.f9730b = dVar; this.f9731c = aVar; this.f9732d = contentResolver; this.f9733e = list; } private boolean b(File file) { return this.f9729a.b(file) && 0 < this.f9729a.c(file); } /* JADX WARN: Not initialized variable reg: 2, insn: 0x001b: MOVE (r1 I:??[OBJECT, ARRAY]) = (r2 I:??[OBJECT, ARRAY]), block:B:26:0x001b */ /* JADX WARN: Removed duplicated region for block: B:28:0x004c */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ private java.lang.String c(android.net.Uri r7) { /* r6 = this; java.lang.String r0 = "ThumbStreamOpener" r1 = 0 g6.d r2 = r6.f9730b // Catch: java.lang.Throwable -> L25 java.lang.SecurityException -> L27 android.database.Cursor r2 = r2.a(r7) // Catch: java.lang.Throwable -> L25 java.lang.SecurityException -> L27 if (r2 == 0) goto L1f boolean r3 = r2.moveToFirst() // Catch: java.lang.Throwable -> L1a java.lang.SecurityException -> L1d if (r3 == 0) goto L1f r3 = 0 java.lang.String r7 = r2.getString(r3) // Catch: java.lang.Throwable -> L1a java.lang.SecurityException -> L1d r2.close() return r7 L1a: r7 = move-exception r1 = r2 goto L4a L1d: r3 = move-exception goto L29 L1f: if (r2 == 0) goto L24 r2.close() L24: return r1 L25: r7 = move-exception goto L4a L27: r3 = move-exception r2 = r1 L29: r4 = 3 boolean r4 = android.util.Log.isLoggable(r0, r4) // Catch: java.lang.Throwable -> L1a if (r4 == 0) goto L44 java.lang.StringBuilder r4 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L1a r4.() // Catch: java.lang.Throwable -> L1a java.lang.String r5 = "Failed to query for thumbnail for Uri: " r4.append(r5) // Catch: java.lang.Throwable -> L1a r4.append(r7) // Catch: java.lang.Throwable -> L1a java.lang.String r7 = r4.toString() // Catch: java.lang.Throwable -> L1a android.util.Log.d(r0, r7, r3) // Catch: java.lang.Throwable -> L1a L44: if (r2 == 0) goto L49 r2.close() L49: return r1 L4a: if (r1 == 0) goto L4f r1.close() L4f: throw r7 */ throw new UnsupportedOperationException("Method not decompiled: g6.e.c(android.net.Uri):java.lang.String"); } int a(Uri uri) { InputStream inputStream = null; try { try { inputStream = this.f9732d.openInputStream(uri); int d10 = g.d(this.f9733e, inputStream, this.f9731c); if (inputStream != null) { try { inputStream.close(); } catch (IOException unused) { } } return d10; } catch (IOException | NullPointerException e10) { if (Log.isLoggable("ThumbStreamOpener", 3)) { Log.d("ThumbStreamOpener", "Failed to open uri: " + uri, e10); } if (inputStream == null) { return -1; } try { inputStream.close(); return -1; } catch (IOException unused2) { return -1; } } } catch (Throwable th) { if (0 != 0) { try { inputStream.close(); } catch (IOException unused3) { } } throw th; } } public InputStream d(Uri uri) { String c10 = c(uri); if (TextUtils.isEmpty(c10)) { return null; } File a10 = this.f9729a.a(c10); if (!b(a10)) { return null; } Uri fromFile = Uri.fromFile(a10); try { return this.f9732d.openInputStream(fromFile); } catch (NullPointerException e10) { throw ((FileNotFoundException) new FileNotFoundException("NPE opening uri: " + uri + " -> " + fromFile).initCause(e10)); } } e(List list, d dVar, i6.a aVar, ContentResolver contentResolver) { this(list, f9728f, dVar, aVar, contentResolver); } }