what-the-bank/sources/o/wZP.java

185 lines
6.3 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.os.ParcelFileDescriptor;
import android.provider.MediaStore;
import android.text.TextUtils;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import o.InterfaceC12232euN;
import o.SCe;
/* loaded from: classes.dex */
public final class wZP<DataT> implements SCe<Uri, DataT> {
private final Context a;
private final SCe<Uri, DataT> b;
private final SCe<File, DataT> c;
private final Class<DataT> e;
@Override // o.SCe
public final /* synthetic */ boolean d(Uri uri) {
return Build.VERSION.SDK_INT >= 29 && C15604gzZ.DL_(uri);
}
@Override // o.SCe
public final /* synthetic */ SCe.IeS e(Uri uri, int i, int i2, unA una) {
Uri uri2 = uri;
return new SCe.IeS(new xBn(uri2), new LWm(this.a, this.c, this.b, uri2, i, i2, una, this.e));
}
wZP(Context context, SCe<File, DataT> sCe, SCe<Uri, DataT> sCe2, Class<DataT> cls) {
this.a = context.getApplicationContext();
this.c = sCe;
this.b = sCe2;
this.e = cls;
}
/* loaded from: classes.dex */
static final class LWm<DataT> implements InterfaceC12232euN<DataT> {
private static final String[] d = {"_data"};
private final Class<DataT> a;
private volatile InterfaceC12232euN<DataT> b;
private final Context c;
private final SCe<File, DataT> e;
private volatile boolean f;
private final unA g;
private final Uri h;
private final SCe<Uri, DataT> i;
private final int j;
private final int n;
LWm(Context context, SCe<File, DataT> sCe, SCe<Uri, DataT> sCe2, Uri uri, int i, int i2, unA una, Class<DataT> cls) {
this.c = context.getApplicationContext();
this.e = sCe;
this.i = sCe2;
this.h = uri;
this.n = i;
this.j = i2;
this.g = una;
this.a = cls;
}
@Override // o.InterfaceC12232euN
public final void e() {
InterfaceC12232euN<DataT> interfaceC12232euN = this.b;
if (interfaceC12232euN != null) {
interfaceC12232euN.e();
}
}
@Override // o.InterfaceC12232euN
public final void a() {
this.f = true;
InterfaceC12232euN<DataT> interfaceC12232euN = this.b;
if (interfaceC12232euN != null) {
interfaceC12232euN.a();
}
}
@Override // o.InterfaceC12232euN
public final pNW d() {
return pNW.LOCAL;
}
private File EA_(Uri uri) throws FileNotFoundException {
Cursor cursor = null;
try {
Cursor query = this.c.getContentResolver().query(uri, d, null, null, null);
if (query == null || !query.moveToFirst()) {
StringBuilder sb = new StringBuilder("Failed to media store entry for: ");
sb.append(uri);
throw new FileNotFoundException(sb.toString());
}
String string = query.getString(query.getColumnIndexOrThrow("_data"));
if (TextUtils.isEmpty(string)) {
StringBuilder sb2 = new StringBuilder("File path was empty in media store for: ");
sb2.append(uri);
throw new FileNotFoundException(sb2.toString());
}
File file = new File(string);
if (query != null) {
query.close();
}
return file;
} catch (Throwable th) {
if (0 != 0) {
cursor.close();
}
throw th;
}
}
@Override // o.InterfaceC12232euN
public final void c(EnumC3495ayd enumC3495ayd, InterfaceC12232euN.IeS<? super DataT> ieS) {
SCe.IeS<DataT> e;
try {
if (Environment.isExternalStorageLegacy()) {
e = this.e.e(EA_(this.h), this.n, this.j, this.g);
} else {
e = this.i.e(this.c.checkSelfPermission("android.permission.ACCESS_MEDIA_LOCATION") == 0 ? MediaStore.setRequireOriginal(this.h) : this.h, this.n, this.j, this.g);
}
InterfaceC12232euN<DataT> interfaceC12232euN = e != null ? e.d : null;
if (interfaceC12232euN == null) {
StringBuilder sb = new StringBuilder("Failed to build fetcher for: ");
sb.append(this.h);
ieS.a((Exception) new IllegalArgumentException(sb.toString()));
return;
}
this.b = interfaceC12232euN;
if (this.f) {
this.f = true;
InterfaceC12232euN<DataT> interfaceC12232euN2 = this.b;
if (interfaceC12232euN2 != null) {
interfaceC12232euN2.a();
return;
}
return;
}
interfaceC12232euN.c(enumC3495ayd, ieS);
} catch (FileNotFoundException e2) {
ieS.a((Exception) e2);
}
}
@Override // o.InterfaceC12232euN
public final Class<DataT> c() {
return this.a;
}
}
/* loaded from: classes.dex */
public static final class HBt extends Sts<InputStream> {
public HBt(Context context) {
super(context, InputStream.class);
}
}
/* loaded from: classes.dex */
public static final class IeS extends Sts<ParcelFileDescriptor> {
public IeS(Context context) {
super(context, ParcelFileDescriptor.class);
}
}
/* loaded from: classes.dex */
static abstract class Sts<DataT> implements rIx<Uri, DataT> {
private final Context c;
private final Class<DataT> d;
Sts(Context context, Class<DataT> cls) {
this.c = context;
this.d = cls;
}
@Override // o.rIx
public final SCe<Uri, DataT> c(Vzp vzp) {
return new wZP(this.c, vzp.b(File.class, this.d), vzp.b(Uri.class, this.d), this.d);
}
}
}