正在查看: BAM Crawford v6.14.1 应用的 l.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: BAM Crawford v6.14.1 应用的 l.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.reactnativecommunity.webview;
import android.app.Activity;
import android.app.DownloadManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.os.Parcelable;
import android.util.Log;
import android.webkit.MimeTypeMap;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.widget.Toast;
import androidx.core.content.FileProvider;
import com.facebook.react.bridge.ActivityEventListener;
import com.facebook.react.bridge.ReactApplicationContext;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicReference;
import okhttp3.HttpUrl;
import okio.internal.BufferKt;
public class l implements ActivityEventListener {
protected static final d v = new d();
private final ReactApplicationContext p;
private DownloadManager.Request q;
private ValueCallback r;
private ValueCallback s;
private File t;
private File u;
class a implements com.facebook.react.modules.core.h {
final String p;
final String q;
a(String str, String str2) {
this.p = str;
this.q = str2;
}
public boolean onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
if (i != 1) {
return false;
}
if (iArr.length <= 0 || iArr[0] != 0) {
Toast.makeText((Context) l.this.p, (CharSequence) this.q, 1).show();
} else if (l.this.q != null) {
l.this.h(this.p);
}
return true;
}
}
static class b {
static final int[] a;
static {
int[] iArr = new int[c.values().length];
a = iArr;
try {
iArr[c.IMAGE.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[c.VIDEO.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
}
}
private enum c {
DEFAULT("*/*"),
IMAGE("image"),
VIDEO("video");
private final String value;
c(String str) {
this.value = str;
}
}
protected static class d {
private double a = 1.0d;
private final HashMap b = new HashMap();
protected enum a {
UNDECIDED,
SHOULD_OVERRIDE,
DO_NOT_OVERRIDE
}
protected d() {
}
public synchronized AtomicReference a(Double d) {
return (AtomicReference) this.b.get(d);
}
public synchronized androidx.core.util.d b() {
double d;
AtomicReference atomicReference;
d = this.a;
this.a = 1.0d + d;
atomicReference = new AtomicReference(a.UNDECIDED);
this.b.put(Double.valueOf(d), atomicReference);
return new androidx.core.util.d(Double.valueOf(d), atomicReference);
}
public synchronized void c(Double d) {
this.b.remove(d);
}
}
public l(ReactApplicationContext reactApplicationContext) {
this.p = reactApplicationContext;
reactApplicationContext.addActivityEventListener(this);
}
private Boolean c(String str) {
if (str.matches("\\.\\w+")) {
str = m(str.replace(".", HttpUrl.FRAGMENT_ENCODE_SET));
}
return Boolean.valueOf(str.isEmpty() || str.toLowerCase().contains(c.IMAGE.value));
}
private Boolean d(String[] strArr) {
String[] i = i(strArr);
return Boolean.valueOf(g(i, c.DEFAULT.value).booleanValue() || g(i, c.IMAGE.value).booleanValue());
}
private Boolean e(String str) {
if (str.matches("\\.\\w+")) {
str = m(str.replace(".", HttpUrl.FRAGMENT_ENCODE_SET));
}
return Boolean.valueOf(str.isEmpty() || str.toLowerCase().contains(c.VIDEO.value));
}
private Boolean f(String[] strArr) {
String[] i = i(strArr);
return Boolean.valueOf(g(i, c.DEFAULT.value).booleanValue() || g(i, c.VIDEO.value).booleanValue());
}
private Boolean g(String[] strArr, String str) {
for (String str2 : strArr) {
if (str2.contains(str)) {
return Boolean.TRUE;
}
}
return Boolean.FALSE;
}
private String[] i(String[] strArr) {
if (w(strArr).booleanValue()) {
return new String[]{c.DEFAULT.value};
}
String[] strArr2 = new String[strArr.length];
for (int i = 0; i < strArr.length; i++) {
String str = strArr[i];
if (str.matches("\\.\\w+")) {
String m = m(str.replace(".", HttpUrl.FRAGMENT_ENCODE_SET));
if (m != null) {
strArr2[i] = m;
} else {
strArr2[i] = str;
}
} else {
strArr2[i] = str;
}
}
return strArr2;
}
private Intent k(String str) {
String str2 = str.isEmpty() ? c.DEFAULT.value : str;
if (str.matches("\\.\\w+")) {
str2 = m(str.replace(".", HttpUrl.FRAGMENT_ENCODE_SET));
}
Intent intent = new Intent("android.intent.action.GET_CONTENT");
intent.addCategory("android.intent.category.OPENABLE");
intent.setType(str2);
return intent;
}
private Intent l(String[] strArr, boolean z) {
Intent intent = new Intent("android.intent.action.GET_CONTENT");
intent.addCategory("android.intent.category.OPENABLE");
intent.setType(c.DEFAULT.value);
intent.putExtra("android.intent.extra.MIME_TYPES", i(strArr));
intent.putExtra("android.intent.extra.ALLOW_MULTIPLE", z);
return intent;
}
private String m(String str) {
if (str != null) {
return MimeTypeMap.getSingleton().getMimeTypeFromExtension(str);
}
return null;
}
private com.facebook.react.modules.core.g o() {
com.facebook.react.modules.core.g currentActivity = this.p.getCurrentActivity();
if (currentActivity == null) {
throw new IllegalStateException("Tried to use permissions API while not attached to an Activity.");
}
if (currentActivity instanceof com.facebook.react.modules.core.g) {
return currentActivity;
}
throw new IllegalStateException("Tried to use permissions API but the host Activity doesn't implement PermissionAwareActivity.");
}
private com.facebook.react.modules.core.h s(String str, String str2) {
return new a(str, str2);
}
private Boolean w(String[] strArr) {
String str;
boolean z = true;
if (strArr.length != 0 && (strArr.length != 1 || (str = strArr[0]) == null || str.length() != 0)) {
z = false;
}
return Boolean.valueOf(z);
}
public boolean A(String[] strArr, boolean z, ValueCallback valueCallback, boolean z2) {
Intent r;
this.s = valueCallback;
Activity currentActivity = this.p.getCurrentActivity();
ArrayList arrayList = new ArrayList();
Intent intent = null;
if (!v()) {
if (d(strArr).booleanValue() && (intent = p()) != null) {
arrayList.add(intent);
}
if (f(strArr).booleanValue() && (r = r()) != null) {
arrayList.add(r);
}
}
Intent intent2 = new Intent("android.intent.action.CHOOSER");
if (!z2) {
intent2.putExtra("android.intent.extra.INTENT", l(strArr, z));
intent2.putExtra("android.intent.extra.INITIAL_INTENTS", (Parcelable[]) arrayList.toArray(new Parcelable[0]));
intent = intent2;
}
if (intent == null) {
Log.w("RNCWebViewModule", "there is no Camera permission");
} else if (intent.resolveActivity(currentActivity.getPackageManager()) != null) {
currentActivity.startActivityForResult(intent, 1);
} else {
Log.w("RNCWebViewModule", "there is no Activity to handle this Intent");
}
return true;
}
public void h(String str) {
try {
((DownloadManager) this.p.getSystemService("download")).enqueue(this.q);
Toast.makeText((Context) this.p, (CharSequence) str, 1).show();
} catch (IllegalArgumentException | SecurityException e) {
Log.w("RNCWebViewModule", "Unsupported URI, aborting download", e);
}
}
public File j(c cVar) {
String str;
String str2;
int i = b.a[cVar.ordinal()];
if (i == 1) {
String str3 = Environment.DIRECTORY_PICTURES;
str = "image-";
str2 = ".jpg";
} else if (i != 2) {
str = HttpUrl.FRAGMENT_ENCODE_SET;
str2 = HttpUrl.FRAGMENT_ENCODE_SET;
} else {
String str4 = Environment.DIRECTORY_MOVIES;
str = "video-";
str2 = ".mp4";
}
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.append(String.valueOf(System.currentTimeMillis()));
sb.append(str2);
return File.createTempFile(str, str2, this.p.getExternalFilesDir(null));
}
public Uri n(File file) {
String packageName = this.p.getPackageName();
return FileProvider.f(this.p, packageName + ".fileprovider", file);
}
public void onActivityResult(Activity activity, int i, int i2, Intent intent) {
if (this.s == null && this.r == null) {
return;
}
File file = this.t;
boolean z = file != null && file.length() > 0;
File file2 = this.u;
boolean z2 = file2 != null && file2.length() > 0;
if (i != 1) {
if (i == 3) {
if (i2 != -1) {
this.r.onReceiveValue(null);
} else if (z) {
this.r.onReceiveValue(n(this.t));
} else if (z2) {
this.r.onReceiveValue(n(this.u));
} else {
this.r.onReceiveValue(intent.getData());
}
}
} else if (i2 != -1) {
ValueCallback valueCallback = this.s;
if (valueCallback != null) {
valueCallback.onReceiveValue(null);
}
} else if (z) {
this.s.onReceiveValue(new Uri[]{n(this.t)});
} else if (z2) {
this.s.onReceiveValue(new Uri[]{n(this.u)});
} else {
this.s.onReceiveValue(q(intent, i2));
}
File file3 = this.t;
if (file3 != null && !z) {
file3.delete();
}
File file4 = this.u;
if (file4 != null && !z2) {
file4.delete();
}
this.s = null;
this.r = null;
this.t = null;
this.u = null;
}
public void onNewIntent(Intent intent) {
}
public Intent p() {
Intent intent;
Throwable e;
Uri n;
try {
File j = j(c.IMAGE);
this.t = j;
n = n(j);
intent = new Intent("android.media.action.IMAGE_CAPTURE");
} catch (IOException | IllegalArgumentException e2) {
intent = null;
e = e2;
}
try {
intent.putExtra("output", n);
} catch (IOException e3) {
e = e3;
Log.e("CREATE FILE", "Error occurred while creating the File", e);
e.printStackTrace();
return intent;
} catch (IllegalArgumentException e4) {
e = e4;
Log.e("CREATE FILE", "Error occurred while creating the File", e);
e.printStackTrace();
return intent;
}
return intent;
}
public Uri[] q(Intent intent, int i) {
if (intent == null) {
return null;
}
if (intent.getClipData() == null) {
if (intent.getData() == null || i != -1) {
return null;
}
return WebChromeClient.FileChooserParams.parseResult(i, intent);
}
int itemCount = intent.getClipData().getItemCount();
Uri[] uriArr = new Uri[itemCount];
for (int i2 = 0; i2 < itemCount; i2++) {
uriArr[i2] = intent.getClipData().getItemAt(i2).getUri();
}
return uriArr;
}
public Intent r() {
Intent intent;
Throwable e;
Uri n;
try {
File j = j(c.VIDEO);
this.u = j;
n = n(j);
intent = new Intent("android.media.action.VIDEO_CAPTURE");
} catch (IOException | IllegalArgumentException e2) {
intent = null;
e = e2;
}
try {
intent.putExtra("output", n);
} catch (IOException e3) {
e = e3;
Log.e("CREATE FILE", "Error occurred while creating the File", e);
e.printStackTrace();
return intent;
} catch (IllegalArgumentException e4) {
e = e4;
Log.e("CREATE FILE", "Error occurred while creating the File", e);
e.printStackTrace();
return intent;
}
return intent;
}
public boolean t(String str, String str2) {
Activity currentActivity = this.p.getCurrentActivity();
if (Build.VERSION.SDK_INT > 28) {
return true;
}
boolean z = androidx.core.content.a.a(currentActivity, "android.permission.WRITE_EXTERNAL_STORAGE") == 0;
if (!z) {
o().requestPermissions(new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 1, s(str, str2));
}
return z;
}
public boolean u() {
return true;
}
protected boolean v() {
Activity currentActivity = this.p.getCurrentActivity();
try {
if (Arrays.asList(currentActivity.getPackageManager().getPackageInfo(currentActivity.getApplicationContext().getPackageName(), BufferKt.SEGMENTING_THRESHOLD).requestedPermissions).contains("android.permission.CAMERA")) {
if (androidx.core.content.a.a(currentActivity, "android.permission.CAMERA") != 0) {
return true;
}
}
return false;
} catch (PackageManager.NameNotFoundException unused) {
return true;
}
}
public void x(DownloadManager.Request request) {
this.q = request;
}
public void y(boolean z, double d2) {
AtomicReference a2 = v.a(Double.valueOf(d2));
if (a2 != null) {
synchronized (a2) {
a2.set(z ? d.a.DO_NOT_OVERRIDE : d.a.SHOULD_OVERRIDE);
a2.notify();
}
}
}
public void z(String str, ValueCallback valueCallback) {
Intent r;
Intent p;
this.r = valueCallback;
Activity currentActivity = this.p.getCurrentActivity();
Intent createChooser = Intent.createChooser(k(str), HttpUrl.FRAGMENT_ENCODE_SET);
ArrayList arrayList = new ArrayList();
if (c(str).booleanValue() && (p = p()) != null) {
arrayList.add(p);
}
if (e(str).booleanValue() && (r = r()) != null) {
arrayList.add(r);
}
createChooser.putExtra("android.intent.extra.INITIAL_INTENTS", (Parcelable[]) arrayList.toArray(new Parcelable[0]));
if (createChooser.resolveActivity(currentActivity.getPackageManager()) != null) {
currentActivity.startActivityForResult(createChooser, 3);
} else {
Log.w("RNCWebViewModule", "there is no Activity to handle this Intent");
}
}
}