正在查看: 万能钥匙 v1.1.23 应用的 j.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 万能钥匙 v1.1.23 应用的 j.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.Parcelable;
import android.util.Log;
import android.webkit.MimeTypeMap;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import androidx.core.util.Pair;
import com.facebook.react.bridge.ActivityEventListener;
import com.facebook.react.bridge.ReactApplicationContext;
import com.google.android.inner_exoplayer2.util.MimeTypes;
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;
public class j implements ActivityEventListener {
public static final d g = new d();
public final ReactApplicationContext a;
public DownloadManager.Request b;
public ValueCallback<Uri> c;
public ValueCallback<Uri[]> d;
public File e;
public File f;
public class a implements uf.e {
public final String a;
public final String b;
public a(String str, String str2) {
this.a = str;
this.b = str2;
}
public boolean onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
if (i != 1) {
return false;
}
if (iArr.length <= 0 || iArr[0] != 0) {
gq.g.b(Toast.makeText((Context) j.this.a, (CharSequence) this.b, 1));
} else if (j.this.b != null) {
j.this.h(this.a);
}
return true;
}
}
public static class b {
public 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) {
}
}
}
public enum c {
DEFAULT("*/*"),
IMAGE("image"),
VIDEO(MimeTypes.BASE_TYPE_VIDEO);
public final String a;
c(String str) {
this.a = str;
}
}
public static class d {
public double a = 1.0d;
public final HashMap<Double, AtomicReference<a>> b = new HashMap<>();
public enum a {
UNDECIDED,
SHOULD_OVERRIDE,
DO_NOT_OVERRIDE
}
@Nullable
public synchronized AtomicReference<a> a(Double d) {
return this.b.get(d);
}
public synchronized Pair<Double, AtomicReference<a>> b() {
double d;
AtomicReference<a> atomicReference;
d = this.a;
this.a = 1.0d + d;
atomicReference = new AtomicReference<>(a.UNDECIDED);
this.b.put(Double.valueOf(d), atomicReference);
return new Pair<>(Double.valueOf(d), atomicReference);
}
public synchronized void c(Double d) {
this.b.remove(d);
}
}
public j(ReactApplicationContext reactApplicationContext) {
this.a = reactApplicationContext;
reactApplicationContext.addActivityEventListener(this);
}
private uf.d o() {
uf.d currentActivity = this.a.getCurrentActivity();
if (currentActivity == null) {
throw new IllegalStateException("Tried to use permissions API while not attached to an Activity.");
}
if (currentActivity instanceof uf.d) {
return currentActivity;
}
throw new IllegalStateException("Tried to use permissions API but the host Activity doesn't implement PermissionAwareActivity.");
}
public boolean A(String[] strArr, boolean z, ValueCallback<Uri[]> valueCallback, boolean z2) {
Intent r;
this.d = valueCallback;
Activity currentActivity = this.a.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 final Boolean c(String str) {
if (str.matches("\\.\\w+")) {
str = m(str.replace(".", ""));
}
return Boolean.valueOf(str.isEmpty() || str.toLowerCase().contains(c.IMAGE.a));
}
public final Boolean d(String[] strArr) {
String[] i = i(strArr);
return Boolean.valueOf(g(i, c.DEFAULT.a).booleanValue() || g(i, c.IMAGE.a).booleanValue());
}
public final Boolean e(String str) {
if (Build.VERSION.SDK_INT < 23) {
return Boolean.FALSE;
}
if (str.matches("\\.\\w+")) {
str = m(str.replace(".", ""));
}
return Boolean.valueOf(str.isEmpty() || str.toLowerCase().contains(c.VIDEO.a));
}
public final Boolean f(String[] strArr) {
if (Build.VERSION.SDK_INT < 23) {
return Boolean.FALSE;
}
String[] i = i(strArr);
return Boolean.valueOf(g(i, c.DEFAULT.a).booleanValue() || g(i, c.VIDEO.a).booleanValue());
}
public final Boolean g(String[] strArr, String str) {
for (String str2 : strArr) {
if (str2.contains(str)) {
return Boolean.TRUE;
}
}
return Boolean.FALSE;
}
public void h(String str) {
try {
((DownloadManager) this.a.getSystemService("download")).enqueue(this.b);
gq.g.b(Toast.makeText((Context) this.a, (CharSequence) str, 1));
} catch (IllegalArgumentException | SecurityException e) {
Log.w("RNCWebViewModule", "Unsupported URI, aborting download", e);
}
}
public final String[] i(String[] strArr) {
if (w(strArr).booleanValue()) {
return new String[]{c.DEFAULT.a};
}
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(".", ""));
if (m != null) {
strArr2[i] = m;
} else {
strArr2[i] = str;
}
} else {
strArr2[i] = str;
}
}
return strArr2;
}
public java.io.File j(com.reactnativecommunity.webview.j.c r7) throws java.io.IOException {
throw new UnsupportedOperationException("Method not decompiled: com.reactnativecommunity.webview.j.j(com.reactnativecommunity.webview.j$c):java.io.File");
}
public final Intent k(String str) {
String str2 = str.isEmpty() ? c.DEFAULT.a : str;
if (str.matches("\\.\\w+")) {
str2 = m(str.replace(".", ""));
}
Intent intent = new Intent("android.intent.action.GET_CONTENT");
intent.addCategory("android.intent.category.OPENABLE");
intent.setType(str2);
return intent;
}
public final 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.a);
intent.putExtra("android.intent.extra.MIME_TYPES", i(strArr));
intent.putExtra("android.intent.extra.ALLOW_MULTIPLE", z);
return intent;
}
public final String m(String str) {
if (str != null) {
return MimeTypeMap.getSingleton().getMimeTypeFromExtension(str);
}
return null;
}
public Uri n(File file) {
if (Build.VERSION.SDK_INT < 23) {
return Uri.fromFile(file);
}
String packageName = this.a.getPackageName();
return FileProvider.getUriForFile(this.a, packageName + ".fileprovider", file);
}
public void onActivityResult(Activity activity, int i, int i2, Intent intent) {
if (this.d == null && this.c == null) {
return;
}
File file = this.e;
boolean z = file != null && file.length() > 0;
File file2 = this.f;
boolean z2 = file2 != null && file2.length() > 0;
if (i != 1) {
if (i == 3) {
if (i2 != -1) {
this.c.onReceiveValue(null);
} else if (z) {
this.c.onReceiveValue(n(this.e));
} else if (z2) {
this.c.onReceiveValue(n(this.f));
} else {
this.c.onReceiveValue(intent.getData());
}
}
} else if (i2 != -1) {
ValueCallback<Uri[]> valueCallback = this.d;
if (valueCallback != null) {
valueCallback.onReceiveValue(null);
}
} else if (z) {
this.d.onReceiveValue(new Uri[]{n(this.e)});
} else if (z2) {
this.d.onReceiveValue(new Uri[]{n(this.f)});
} else {
this.d.onReceiveValue(q(intent, i2));
}
File file3 = this.e;
if (file3 != null && !z) {
file3.delete();
}
File file4 = this.f;
if (file4 != null && !z2) {
file4.delete();
}
this.d = null;
this.c = null;
this.e = null;
this.f = null;
}
public void onNewIntent(Intent intent) {
}
public Intent p() {
Intent intent;
Throwable e;
Uri n;
try {
File j = j(c.IMAGE);
this.e = 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);
return intent;
} 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;
}
}
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.f = 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);
return intent;
} 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;
}
}
public final uf.e s(String str, String str2) {
return new a(str, str2);
}
public boolean t(String str, String str2) {
Activity currentActivity = this.a.getCurrentActivity();
int i = Build.VERSION.SDK_INT;
if (i > 28) {
return true;
}
boolean z = ContextCompat.checkSelfPermission(currentActivity, "android.permission.WRITE_EXTERNAL_STORAGE") == 0;
if (!z && i >= 23) {
o().k(new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 1, s(str, str2));
}
return z;
}
public boolean u() {
return true;
}
public boolean v() {
Activity currentActivity = this.a.getCurrentActivity();
try {
if (Arrays.asList(currentActivity.getPackageManager().getPackageInfo(currentActivity.getApplicationContext().getPackageName(), 4096).requestedPermissions).contains("android.permission.CAMERA")) {
return ContextCompat.checkSelfPermission(currentActivity, "android.permission.CAMERA") != 0;
}
return false;
} catch (PackageManager.NameNotFoundException unused) {
return true;
}
}
public final 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 void x(DownloadManager.Request request) {
this.b = request;
}
public void y(boolean z, double d2) {
AtomicReference<d.a> a2 = g.a(Double.valueOf(d2));
if (a2 != null) {
synchronized (a2) {
try {
a2.set(z ? d.a.DO_NOT_OVERRIDE : d.a.SHOULD_OVERRIDE);
a2.notify();
} catch (Throwable th) {
throw th;
}
}
}
}
public void z(String str, ValueCallback<Uri> valueCallback) {
Intent r;
Intent p;
this.c = valueCallback;
Activity currentActivity = this.a.getCurrentActivity();
Intent createChooser = Intent.createChooser(k(str), "");
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");
}
}
}