Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,132 @@
package com.unity3d.player;
import android.content.Context;
import android.graphics.Rect;
import android.hardware.Camera;
/* loaded from: classes2.dex */
public class Camera2Wrapper implements d {
private Context a;
private a b = null;
private final int c = 100;
public Camera2Wrapper(Context context) {
this.a = context;
initCamera2Jni();
}
private static int a(float f) {
return (int) Math.min(Math.max((f * 2000.0f) - 1000.0f, -900.0f), 900.0f);
}
private final native void initCamera2Jni();
private final native void nativeFrameReady(Object obj, Object obj2, Object obj3, int i, int i2, int i3);
private final native void nativeSurfaceTextureReady(Object obj);
public final void a() {
closeCamera2();
}
@Override // com.unity3d.player.d
public final void a(Object obj) {
nativeSurfaceTextureReady(obj);
}
@Override // com.unity3d.player.d
public final void a(Object obj, Object obj2, Object obj3, int i, int i2, int i3) {
nativeFrameReady(obj, obj2, obj3, i, i2, i3);
}
protected void closeCamera2() {
a aVar = this.b;
if (aVar != null) {
aVar.b();
}
this.b = null;
}
protected int getCamera2Count() {
if (j.b) {
return a.a(this.a);
}
return 0;
}
protected int[] getCamera2Resolutions(int i) {
if (j.b) {
return a.d(this.a, i);
}
return null;
}
protected int getCamera2SensorOrientation(int i) {
if (j.b) {
return a.a(this.a, i);
}
return 0;
}
protected Object getCameraFocusArea(float f, float f2) {
int a = a(f);
int a2 = a(1.0f - f2);
return new Camera.Area(new Rect(a - 100, a2 - 100, a + 100, a2 + 100), 1000);
}
protected Rect getFrameSizeCamera2() {
a aVar = this.b;
return aVar != null ? aVar.a() : new Rect();
}
protected boolean initializeCamera2(int i, int i2, int i3, int i4, int i5) {
if (!j.b || this.b != null || UnityPlayer.currentActivity == null) {
return false;
}
this.b = new a(this);
return this.b.a(this.a, i, i2, i3, i4, i5);
}
protected boolean isCamera2AutoFocusPointSupported(int i) {
if (j.b) {
return a.c(this.a, i);
}
return false;
}
protected boolean isCamera2FrontFacing(int i) {
if (j.b) {
return a.b(this.a, i);
}
return false;
}
protected void pauseCamera2() {
a aVar = this.b;
if (aVar != null) {
aVar.d();
}
}
protected boolean setAutoFocusPoint(float f, float f2) {
a aVar;
if (!j.b || (aVar = this.b) == null) {
return false;
}
return aVar.a(f, f2);
}
protected void startCamera2() {
a aVar = this.b;
if (aVar != null) {
aVar.c();
}
}
protected void stopCamera2() {
a aVar = this.b;
if (aVar != null) {
aVar.e();
}
}
}

View File

@@ -0,0 +1,12 @@
package com.unity3d.player;
import android.app.Activity;
/* loaded from: classes2.dex */
public class GoogleARCoreApi {
public final native void initializeARCore(Activity activity);
public final native void pauseARCore();
public final native void resumeARCore();
}

View File

@@ -0,0 +1,27 @@
package com.unity3d.player;
import java.util.concurrent.atomic.AtomicReference;
/* loaded from: classes2.dex */
public class GoogleVrApi {
private static AtomicReference a = new AtomicReference();
private GoogleVrApi() {
}
static void a() {
a.set(null);
}
static void a(f fVar) {
a.compareAndSet(null, new GoogleVrProxy(fVar));
}
static GoogleVrProxy b() {
return (GoogleVrProxy) a.get();
}
public static GoogleVrVideo getGoogleVrVideo() {
return (GoogleVrVideo) a.get();
}
}

View File

@@ -0,0 +1,377 @@
package com.unity3d.player;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.view.Surface;
import android.view.SurfaceView;
import android.view.View;
import com.unity3d.player.GoogleVrVideo;
import java.lang.reflect.Array;
import java.util.Iterator;
import java.util.Vector;
import java.util.concurrent.atomic.AtomicLong;
/* loaded from: classes2.dex */
class GoogleVrProxy extends c implements GoogleVrVideo {
private boolean f;
private boolean g;
private Runnable h;
private Vector i;
private SurfaceView j;
private a k;
private Thread l;
private Handler m;
class a {
public boolean a = false;
public boolean b = false;
public boolean c = false;
public boolean d = false;
public boolean e = true;
public boolean f = false;
a() {
}
public final boolean a() {
return this.a && this.b;
}
public final void b() {
this.a = false;
this.b = false;
this.d = false;
this.e = true;
this.f = false;
}
}
public GoogleVrProxy(f fVar) {
super("Google VR", fVar);
this.f = false;
this.g = false;
this.h = null;
this.i = new Vector();
this.j = null;
this.k = new a();
this.l = null;
this.m = new Handler(Looper.getMainLooper()) { // from class: com.unity3d.player.GoogleVrProxy.1
@Override // android.os.Handler
public final void handleMessage(Message message) {
if (message.what != 135711) {
super.handleMessage(message);
}
switch (message.arg1) {
case 2147483645:
Iterator it = GoogleVrProxy.this.i.iterator();
while (it.hasNext()) {
((GoogleVrVideo.GoogleVrVideoCallbacks) it.next()).onFrameAvailable();
}
break;
case 2147483646:
Surface surface = (Surface) message.obj;
Iterator it2 = GoogleVrProxy.this.i.iterator();
while (it2.hasNext()) {
((GoogleVrVideo.GoogleVrVideoCallbacks) it2.next()).onSurfaceAvailable(surface);
}
break;
default:
super.handleMessage(message);
break;
}
}
};
initVrJni();
}
/* JADX INFO: Access modifiers changed from: private */
public void a(boolean z) {
this.k.d = z;
}
private static boolean a(int i) {
return Build.VERSION.SDK_INT >= i;
}
private boolean a(ClassLoader classLoader) {
try {
Class<?> loadClass = classLoader.loadClass("com.unity3d.unitygvr.GoogleVR");
o oVar = new o(loadClass, loadClass.getConstructor(new Class[0]).newInstance(new Object[0]));
oVar.a("initialize", new Class[]{Activity.class, Context.class, SurfaceView.class, Boolean.TYPE, Handler.class});
oVar.a("deinitialize", new Class[0]);
oVar.a("load", new Class[]{Boolean.TYPE, Boolean.TYPE, Boolean.TYPE, Boolean.TYPE, Boolean.TYPE, Runnable.class});
oVar.a("enable", new Class[]{Boolean.TYPE});
oVar.a("unload", new Class[0]);
oVar.a("pause", new Class[0]);
oVar.a("resume", new Class[0]);
oVar.a("getGvrLayout", new Class[0]);
oVar.a("getVideoSurfaceId", new Class[0]);
oVar.a("getVideoSurface", new Class[0]);
this.a = oVar;
return true;
} catch (Exception e) {
reportError("Exception initializing GoogleVR from Unity library. " + e.getLocalizedMessage());
return false;
}
}
/* JADX INFO: Access modifiers changed from: private */
public boolean d() {
return this.k.d;
}
private void e() {
Activity activity = (Activity) this.c;
if (this.g) {
a aVar = this.k;
if (aVar.f || activity == null) {
return;
}
aVar.f = true;
Intent intent = new Intent("android.intent.action.MAIN");
intent.addCategory("android.intent.category.HOME");
intent.setFlags(268435456);
activity.startActivity(intent);
}
}
private final native void initVrJni();
private final native boolean isQuiting();
private final native void setVrVideoTransform(float[][] fArr);
public final void a(Intent intent) {
if (intent == null || !intent.getBooleanExtra("android.intent.extra.VR_LAUNCH", false)) {
return;
}
this.g = true;
}
public final boolean a() {
return this.k.a;
}
public final boolean a(Activity activity, Context context, SurfaceView surfaceView, Runnable runnable) {
String str;
boolean z;
if (activity == null || context == null || surfaceView == null || runnable == null) {
str = "Invalid parameters passed to Google VR initiialization.";
} else {
this.k.b();
this.c = context;
this.h = runnable;
if (!a(19)) {
str = "Google VR requires a device that supports an api version of 19 (KitKat) or better.";
} else if (this.g && !a(24)) {
str = "Daydream requires a device that supports an api version of 24 (Nougat) or better.";
} else {
if (!a(UnityPlayer.class.getClassLoader())) {
return false;
}
try {
z = ((Boolean) this.a.a("initialize", activity, context, surfaceView, Boolean.valueOf(this.g), this.m)).booleanValue();
} catch (Exception e) {
reportError("Exception while trying to intialize Unity Google VR Library. " + e.getLocalizedMessage());
z = false;
}
if (z) {
this.j = surfaceView;
this.k.a = true;
this.d = "";
return true;
}
str = "Unable to initialize GoogleVR library.";
}
}
reportError(str);
return false;
}
public final void b() {
resumeGvrLayout();
}
public final void c() {
SurfaceView surfaceView = this.j;
if (surfaceView != null) {
surfaceView.getHolder().setSizeFromLayout();
}
}
@Override // com.unity3d.player.GoogleVrVideo
public void deregisterGoogleVrVideoListener(GoogleVrVideo.GoogleVrVideoCallbacks googleVrVideoCallbacks) {
if (this.i.contains(googleVrVideoCallbacks)) {
googleVrVideoCallbacks.onSurfaceUnavailable();
this.i.remove(googleVrVideoCallbacks);
}
}
protected Object getVideoSurface() {
if (d() && !this.k.e) {
try {
return this.a.a("getVideoSurface", new Object[0]);
} catch (Exception e) {
reportError("Exception caught while Getting GoogleVR Video Surface. " + e.getLocalizedMessage());
}
}
return null;
}
protected int getVideoSurfaceId() {
if (d() && !this.k.e) {
try {
return ((Integer) this.a.a("getVideoSurfaceId", new Object[0])).intValue();
} catch (Exception e) {
reportError("Exception caught while getting Video Surface ID from GoogleVR. " + e.getLocalizedMessage());
}
}
return -1;
}
protected long loadGoogleVr(final boolean z, final boolean z2, final boolean z3, final boolean z4, final boolean z5) {
if (!this.k.a) {
return 0L;
}
final AtomicLong atomicLong = new AtomicLong(0L);
this.d = (z || z2) ? "Daydream" : "Cardboard";
if (!runOnUiThreadWithSync(new Runnable() { // from class: com.unity3d.player.GoogleVrProxy.2
@Override // java.lang.Runnable
public final void run() {
try {
atomicLong.set(((Long) GoogleVrProxy.this.a.a("load", Boolean.valueOf(z), Boolean.valueOf(z2), Boolean.valueOf(z3), Boolean.valueOf(z4), Boolean.valueOf(z5), GoogleVrProxy.this.h)).longValue());
GoogleVrProxy.this.k.b = true;
} catch (Exception e) {
GoogleVrProxy.this.reportError("Exception caught while loading GoogleVR. " + e.getLocalizedMessage());
atomicLong.set(0L);
}
}
}) || atomicLong.longValue() == 0) {
reportError("Google VR had a fatal issue while loading. VR will not be available.");
}
return atomicLong.longValue();
}
protected void pauseGvrLayout() {
if (this.k.a() && !this.k.e) {
if (d()) {
Iterator it = this.i.iterator();
while (it.hasNext()) {
((GoogleVrVideo.GoogleVrVideoCallbacks) it.next()).onSurfaceUnavailable();
}
}
o oVar = this.a;
if (oVar != null) {
oVar.a("pause", new Object[0]);
}
this.k.e = true;
}
}
@Override // com.unity3d.player.GoogleVrVideo
public void registerGoogleVrVideoListener(GoogleVrVideo.GoogleVrVideoCallbacks googleVrVideoCallbacks) {
if (this.i.contains(googleVrVideoCallbacks)) {
return;
}
this.i.add(googleVrVideoCallbacks);
Surface surface = (Surface) getVideoSurface();
if (surface != null) {
googleVrVideoCallbacks.onSurfaceAvailable(surface);
}
}
protected void resumeGvrLayout() {
if (this.k.a() && this.k.e) {
o oVar = this.a;
if (oVar != null) {
oVar.a("resume", new Object[0]);
}
this.k.e = false;
}
}
protected void setGoogleVrModeEnabled(final boolean z) {
if (!this.k.a() || this.b == null || this.c == null) {
return;
}
if (!z && isQuiting()) {
e();
}
runOnUiThread(new Runnable() { // from class: com.unity3d.player.GoogleVrProxy.3
@Override // java.lang.Runnable
public final void run() {
if (z == GoogleVrProxy.this.d()) {
return;
}
try {
if (z && !GoogleVrProxy.this.d()) {
if (GoogleVrProxy.this.a != null && GoogleVrProxy.this.b != null && !GoogleVrProxy.this.b.addViewToPlayer((View) GoogleVrProxy.this.a.a("getGvrLayout", new Object[0]), true)) {
GoogleVrProxy.this.reportError("Unable to add Google VR to view hierarchy.");
return;
}
if (GoogleVrProxy.this.a != null) {
GoogleVrProxy.this.a.a("enable", true);
}
GoogleVrProxy.this.a(true);
return;
}
if (z || !GoogleVrProxy.this.d()) {
return;
}
GoogleVrProxy.this.a(false);
if (GoogleVrProxy.this.a != null) {
GoogleVrProxy.this.a.a("enable", false);
}
if (GoogleVrProxy.this.a == null || GoogleVrProxy.this.b == null) {
return;
}
GoogleVrProxy.this.b.removeViewFromPlayer((View) GoogleVrProxy.this.a.a("getGvrLayout", new Object[0]));
} catch (Exception e) {
GoogleVrProxy.this.reportError("Exception enabling Google VR on UI Thread. " + e.getLocalizedMessage());
}
}
});
}
@Override // com.unity3d.player.GoogleVrVideo
public void setVideoLocationTransform(float[] fArr) {
float[][] fArr2 = (float[][]) Array.newInstance((Class<?>) float.class, 4, 4);
for (int i = 0; i < 4; i++) {
for (int i2 = 0; i2 < 4; i2++) {
fArr2[i][i2] = fArr[(i * 4) + i2];
}
}
setVrVideoTransform(fArr2);
}
protected void unloadGoogleVr() {
if (this.k.d) {
setGoogleVrModeEnabled(false);
}
a aVar = this.k;
if (aVar.c) {
aVar.c = false;
}
this.j = null;
runOnUiThread(new Runnable() { // from class: com.unity3d.player.GoogleVrProxy.4
@Override // java.lang.Runnable
public final void run() {
try {
if (GoogleVrProxy.this.a != null) {
GoogleVrProxy.this.a.a("unload", new Object[0]);
GoogleVrProxy.this.a.a("deinitialize", new Object[0]);
GoogleVrProxy.this.a = null;
}
GoogleVrProxy.this.k.b = false;
} catch (Exception e) {
GoogleVrProxy.this.reportError("Exception unloading Google VR on UI Thread. " + e.getLocalizedMessage());
}
}
});
}
}

View File

@@ -0,0 +1,21 @@
package com.unity3d.player;
import android.view.Surface;
/* loaded from: classes2.dex */
public interface GoogleVrVideo {
public interface GoogleVrVideoCallbacks {
void onFrameAvailable();
void onSurfaceAvailable(Surface surface);
void onSurfaceUnavailable();
}
void deregisterGoogleVrVideoListener(GoogleVrVideoCallbacks googleVrVideoCallbacks);
void registerGoogleVrVideoListener(GoogleVrVideoCallbacks googleVrVideoCallbacks);
void setVideoLocationTransform(float[] fArr);
}

View File

@@ -0,0 +1,8 @@
package com.unity3d.player;
/* loaded from: classes2.dex */
public class NativeLoader {
static final native boolean load(String str);
static final native boolean unload();
}

View File

@@ -0,0 +1,381 @@
package com.unity3d.player;
import com.ijm.dataencryption.de.DataDecryptTool;
import com.ubt.jimu.base.util.FileUtil;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.Iterator;
/* loaded from: classes2.dex */
final class ReflectionHelper {
protected static boolean LOG = false;
protected static final boolean LOGV = false;
private static a[] a = new a[FileUtil.ZIP_BUFFER_SIZE];
private static class a {
public volatile Member a;
private final Class b;
private final String c;
private final String d;
private final int e;
a(Class cls, String str, String str2) {
this.b = cls;
this.c = str;
this.d = str2;
this.e = ((((this.b.hashCode() + 527) * 31) + this.c.hashCode()) * 31) + this.d.hashCode();
}
public final boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof a) {
a aVar = (a) obj;
if (this.e == aVar.e && this.d.equals(aVar.d) && this.c.equals(aVar.c) && this.b.equals(aVar.b)) {
return true;
}
}
return false;
}
public final int hashCode() {
return this.e;
}
}
ReflectionHelper() {
}
private static float a(Class cls, Class cls2) {
if (cls.equals(cls2)) {
return 1.0f;
}
if (cls.isPrimitive() || cls2.isPrimitive()) {
return 0.0f;
}
try {
if (cls.asSubclass(cls2) != null) {
return 0.5f;
}
} catch (ClassCastException unused) {
}
try {
return cls2.asSubclass(cls) != null ? 0.1f : 0.0f;
} catch (ClassCastException unused2) {
return 0.0f;
}
}
private static float a(Class cls, Class[] clsArr, Class[] clsArr2) {
if (clsArr2.length == 0) {
return 0.1f;
}
int i = 0;
if ((clsArr == null ? 0 : clsArr.length) + 1 != clsArr2.length) {
return 0.0f;
}
float f = 1.0f;
if (clsArr != null) {
int length = clsArr.length;
int i2 = 0;
while (i < length) {
f *= a(clsArr[i], clsArr2[i2]);
i++;
i2++;
}
}
return f * a(cls, clsArr2[clsArr2.length - 1]);
}
private static Class a(String str, int[] iArr) {
while (iArr[0] < str.length()) {
int i = iArr[0];
iArr[0] = i + 1;
char charAt = str.charAt(i);
if (charAt != '(' && charAt != ')') {
if (charAt == 'L') {
int indexOf = str.indexOf(59, iArr[0]);
if (indexOf == -1) {
return null;
}
String substring = str.substring(iArr[0], indexOf);
iArr[0] = indexOf + 1;
try {
return Class.forName(substring.replace('/', '.'));
} catch (ClassNotFoundException unused) {
return null;
}
}
if (charAt == 'Z') {
return Boolean.TYPE;
}
if (charAt == 'I') {
return Integer.TYPE;
}
if (charAt == 'F') {
return Float.TYPE;
}
if (charAt == 'V') {
return Void.TYPE;
}
if (charAt == 'B') {
return Byte.TYPE;
}
if (charAt == 'C') {
return Character.TYPE;
}
if (charAt == 'S') {
return Short.TYPE;
}
if (charAt == 'J') {
return Long.TYPE;
}
if (charAt == 'D') {
return Double.TYPE;
}
if (charAt == '[') {
return Array.newInstance((Class<?>) a(str, iArr), 0).getClass();
}
g.Log(5, "! parseType; " + charAt + " is not known!");
return null;
}
}
return null;
}
private static void a(a aVar, Member member) {
aVar.a = member;
a[aVar.hashCode() & (a.length - 1)] = aVar;
}
private static boolean a(a aVar) {
a aVar2 = a[aVar.hashCode() & (a.length - 1)];
if (!aVar.equals(aVar2)) {
return false;
}
aVar.a = aVar2.a;
return true;
}
private static Class[] a(String str) {
Class a2;
int i = 0;
int[] iArr = {0};
ArrayList arrayList = new ArrayList();
while (iArr[0] < str.length() && (a2 = a(str, iArr)) != null) {
arrayList.add(a2);
}
Class[] clsArr = new Class[arrayList.size()];
Iterator it = arrayList.iterator();
while (it.hasNext()) {
clsArr[i] = (Class) it.next();
i++;
}
return clsArr;
}
protected static Constructor getConstructorID(Class cls, String str) {
Constructor<?> constructor;
a aVar = new a(cls, "", str);
if (a(aVar)) {
constructor = (Constructor) aVar.a;
} else {
Class[] a2 = a(str);
float f = 0.0f;
Constructor<?> constructor2 = null;
for (Constructor<?> constructor3 : cls.getConstructors()) {
float a3 = a(Void.TYPE, constructor3.getParameterTypes(), a2);
if (a3 > f) {
constructor2 = constructor3;
if (a3 == 1.0f) {
break;
}
f = a3;
}
}
a(aVar, constructor2);
constructor = constructor2;
}
if (constructor != null) {
return constructor;
}
throw new NoSuchMethodError("<init>" + str + " in class " + cls.getName());
}
protected static Field getFieldID(Class cls, String str, String str2, boolean z) {
Field field;
Class cls2 = cls;
a aVar = new a(cls2, str, str2);
if (a(aVar)) {
field = (Field) aVar.a;
} else {
Class[] a2 = a(str2);
float f = 0.0f;
Field field2 = null;
while (cls2 != null) {
Field[] declaredFields = cls2.getDeclaredFields();
int length = declaredFields.length;
Field field3 = field2;
float f2 = f;
int i = 0;
while (true) {
if (i >= length) {
f = f2;
field2 = field3;
break;
}
Field field4 = declaredFields[i];
if (z == Modifier.isStatic(field4.getModifiers()) && field4.getName().compareTo(str) == 0) {
float a3 = a(field4.getType(), (Class[]) null, a2);
if (a3 > f2) {
if (a3 == 1.0f) {
field2 = field4;
f = a3;
break;
}
field3 = field4;
f2 = a3;
} else {
continue;
}
}
i++;
}
if (f == 1.0f || cls2.isPrimitive() || cls2.isInterface() || cls2.equals(Object.class) || cls2.equals(Void.TYPE)) {
break;
}
cls2 = cls2.getSuperclass();
}
a(aVar, field2);
field = field2;
}
if (field != null) {
return field;
}
Object[] objArr = new Object[4];
objArr[0] = z ? "static" : "non-static";
objArr[1] = str;
objArr[2] = str2;
objArr[3] = cls2.getName();
throw new NoSuchFieldError(String.format("no %s field with name='%s' signature='%s' in class L%s;", objArr));
}
protected static Method getMethodID(Class cls, String str, String str2, boolean z) {
Method method;
a aVar = new a(cls, str, str2);
if (a(aVar)) {
method = (Method) aVar.a;
} else {
Class[] a2 = a(str2);
float f = 0.0f;
Method method2 = null;
while (cls != null) {
Method[] declaredMethods = cls.getDeclaredMethods();
int length = declaredMethods.length;
Method method3 = method2;
float f2 = f;
int i = 0;
while (true) {
if (i >= length) {
f = f2;
method2 = method3;
break;
}
Method method4 = declaredMethods[i];
if (z == Modifier.isStatic(method4.getModifiers()) && method4.getName().compareTo(str) == 0) {
float a3 = a(method4.getReturnType(), method4.getParameterTypes(), a2);
if (a3 > f2) {
if (a3 == 1.0f) {
method2 = method4;
f = a3;
break;
}
method3 = method4;
f2 = a3;
} else {
continue;
}
}
i++;
}
if (f == 1.0f || cls.isPrimitive() || cls.isInterface() || cls.equals(Object.class) || cls.equals(Void.TYPE)) {
break;
}
cls = cls.getSuperclass();
}
a(aVar, method2);
method = method2;
}
if (method != null) {
return method;
}
Object[] objArr = new Object[4];
objArr[0] = z ? "static" : "non-static";
objArr[1] = str;
objArr[2] = str2;
objArr[3] = cls.getName();
throw new NoSuchMethodError(String.format("no %s method with name='%s' signature='%s' in class L%s;", objArr));
}
/* JADX INFO: Access modifiers changed from: private */
public static native void nativeProxyFinalize(int i);
/* JADX INFO: Access modifiers changed from: private */
public static native Object nativeProxyInvoke(int i, String str, Object[] objArr);
/* JADX INFO: Access modifiers changed from: private */
public static native void nativeProxyLogJNIInvokeException();
protected static Object newProxyInstance(int i, Class cls) {
return newProxyInstance(i, new Class[]{cls});
}
protected static Object newProxyInstance(final int i, final Class[] clsArr) {
return Proxy.newProxyInstance(ReflectionHelper.class.getClassLoader(), clsArr, new InvocationHandler() { // from class: com.unity3d.player.ReflectionHelper.1
private static Object a(Object obj, Method method, Object[] objArr) {
if (objArr == null) {
try {
objArr = new Object[0];
} catch (NoClassDefFoundError unused) {
g.Log(6, String.format("Java interface default methods are only supported since Android Oreo", new Object[0]));
ReflectionHelper.nativeProxyLogJNIInvokeException();
return null;
}
}
Class<?> declaringClass = method.getDeclaringClass();
Constructor declaredConstructor = MethodHandles.Lookup.class.getDeclaredConstructor(Class.class, Integer.TYPE);
declaredConstructor.setAccessible(true);
return ((MethodHandles.Lookup) declaredConstructor.newInstance(declaringClass, 2)).in(declaringClass).unreflectSpecial(method, declaringClass).bindTo(obj).invokeWithArguments(objArr);
}
protected final void finalize() {
try {
ReflectionHelper.nativeProxyFinalize(i);
} finally {
super.finalize();
}
}
@Override // java.lang.reflect.InvocationHandler
public final Object invoke(Object obj, Method method, Object[] objArr) {
Object nativeProxyInvoke = ReflectionHelper.nativeProxyInvoke(i, method.getName(), objArr);
if (nativeProxyInvoke == null) {
if ((method.getModifiers() & DataDecryptTool.DECRYPT_SP_FILE) == 0) {
return a(obj, method, objArr);
}
ReflectionHelper.nativeProxyLogJNIInvokeException();
}
return nativeProxyInvoke;
}
});
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,108 @@
package com.unity3d.player;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MotionEvent;
/* loaded from: classes2.dex */
public class UnityPlayerActivity extends Activity {
protected UnityPlayer mUnityPlayer;
@Override // android.app.Activity, android.view.Window.Callback
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
return keyEvent.getAction() == 2 ? this.mUnityPlayer.injectEvent(keyEvent) : super.dispatchKeyEvent(keyEvent);
}
@Override // android.app.Activity, android.content.ComponentCallbacks
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
this.mUnityPlayer.configurationChanged(configuration);
}
@Override // android.app.Activity
protected void onCreate(Bundle bundle) {
requestWindowFeature(1);
super.onCreate(bundle);
this.mUnityPlayer = new UnityPlayer(this);
setContentView(this.mUnityPlayer);
this.mUnityPlayer.requestFocus();
}
@Override // android.app.Activity
protected void onDestroy() {
this.mUnityPlayer.destroy();
super.onDestroy();
}
@Override // android.app.Activity
public boolean onGenericMotionEvent(MotionEvent motionEvent) {
return this.mUnityPlayer.injectEvent(motionEvent);
}
@Override // android.app.Activity, android.view.KeyEvent.Callback
public boolean onKeyDown(int i, KeyEvent keyEvent) {
return this.mUnityPlayer.injectEvent(keyEvent);
}
@Override // android.app.Activity, android.view.KeyEvent.Callback
public boolean onKeyUp(int i, KeyEvent keyEvent) {
return this.mUnityPlayer.injectEvent(keyEvent);
}
@Override // android.app.Activity, android.content.ComponentCallbacks
public void onLowMemory() {
super.onLowMemory();
this.mUnityPlayer.lowMemory();
}
@Override // android.app.Activity
protected void onNewIntent(Intent intent) {
setIntent(intent);
}
@Override // android.app.Activity
protected void onPause() {
super.onPause();
this.mUnityPlayer.pause();
}
@Override // android.app.Activity
protected void onResume() {
super.onResume();
this.mUnityPlayer.resume();
}
@Override // android.app.Activity
protected void onStart() {
super.onStart();
this.mUnityPlayer.start();
}
@Override // android.app.Activity
protected void onStop() {
super.onStop();
this.mUnityPlayer.stop();
}
@Override // android.app.Activity
public boolean onTouchEvent(MotionEvent motionEvent) {
return this.mUnityPlayer.injectEvent(motionEvent);
}
@Override // android.app.Activity, android.content.ComponentCallbacks2
public void onTrimMemory(int i) {
super.onTrimMemory(i);
if (i == 15) {
this.mUnityPlayer.lowMemory();
}
}
@Override // android.app.Activity, android.view.Window.Callback
public void onWindowFocusChanged(boolean z) {
super.onWindowFocusChanged(z);
this.mUnityPlayer.windowFocusChanged(z);
}
}

View File

@@ -0,0 +1,207 @@
package com.unity3d.player;
import java.net.CookieHandler;
import java.net.CookieManager;
import java.net.CookieStore;
import java.net.HttpCookie;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.ByteBuffer;
import java.security.cert.CertPathValidatorException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLKeyException;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLSession;
/* loaded from: classes2.dex */
class UnityWebRequest implements Runnable {
private static final HostnameVerifier k;
private long a;
private String b;
private String c;
private Map d;
private boolean e;
private int f;
private long g;
private long h;
private boolean i;
private boolean j;
static {
if (CookieHandler.getDefault() == null) {
CookieHandler.setDefault(new CookieManager());
}
k = new HostnameVerifier() { // from class: com.unity3d.player.UnityWebRequest.1
@Override // javax.net.ssl.HostnameVerifier
public final boolean verify(String str, SSLSession sSLSession) {
return true;
}
};
}
UnityWebRequest(long j, String str, Map map, String str2, boolean z, int i) {
this.a = j;
this.b = str2;
this.c = str;
this.d = map;
this.e = z;
this.f = i;
}
static void clearCookieCache(String str, String str2) {
CookieStore cookieStore;
CookieHandler cookieHandler = CookieHandler.getDefault();
if (cookieHandler == null || !(cookieHandler instanceof CookieManager) || (cookieStore = ((CookieManager) cookieHandler).getCookieStore()) == null) {
return;
}
if (str == null) {
cookieStore.removeAll();
return;
}
try {
URI uri = new URI(null, str, str2, null);
List<HttpCookie> list = cookieStore.get(uri);
if (list != null) {
Iterator<HttpCookie> it = list.iterator();
while (it.hasNext()) {
cookieStore.remove(uri, it.next());
}
}
} catch (URISyntaxException unused) {
}
}
private static native void contentLengthCallback(long j, int i);
private static native boolean downloadCallback(long j, ByteBuffer byteBuffer, int i);
private static native void errorCallback(long j, int i, String str);
private boolean hasTimedOut() {
return this.f > 0 && System.currentTimeMillis() - this.g >= ((long) this.f);
}
private static native void headerCallback(long j, String str, String str2);
private static native void responseCodeCallback(long j, int i);
/* JADX WARN: Code restructure failed: missing block: B:124:0x0244, code lost:
r0.close();
*/
/* JADX WARN: Code restructure failed: missing block: B:125:0x0247, code lost:
return;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
private void runSafe() {
/*
Method dump skipped, instructions count: 647
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.unity3d.player.UnityWebRequest.runSafe():void");
}
private static native int uploadCallback(long j, ByteBuffer byteBuffer);
private static native boolean validateCertificateCallback(long j, byte[] bArr);
protected void badProtocolCallback(String str) {
errorCallback(this.a, 4, str);
}
protected void contentLengthCallback(int i) {
contentLengthCallback(this.a, i);
}
protected boolean downloadCallback(ByteBuffer byteBuffer, int i) {
return downloadCallback(this.a, byteBuffer, i);
}
protected void errorCallback(String str) {
errorCallback(this.a, 2, str);
}
protected void headerCallback(String str, String str2) {
headerCallback(this.a, str, str2);
}
protected void headerCallback(Map map) {
if (map == null || map.size() == 0) {
return;
}
for (Map.Entry entry : map.entrySet()) {
String str = (String) entry.getKey();
if (str == null) {
str = "Status";
}
Iterator it = ((List) entry.getValue()).iterator();
while (it.hasNext()) {
headerCallback(str, (String) it.next());
}
}
}
protected void malformattedUrlCallback(String str) {
errorCallback(this.a, 5, str);
}
protected void responseCodeCallback(int i) {
responseCodeCallback(this.a, i);
}
@Override // java.lang.Runnable
public void run() {
try {
runSafe();
} catch (Exception e) {
errorCallback(e.toString());
}
}
void setupTransferSettings(long j, boolean z, boolean z2) {
this.h = j;
this.i = z;
this.j = z2;
}
protected void sslCannotConnectCallback(SSLException sSLException) {
int i;
String sSLException2 = sSLException.toString();
SSLException sSLException3 = sSLException;
while (true) {
if (sSLException3 == null) {
i = 16;
break;
} else if (sSLException3 instanceof SSLKeyException) {
i = 23;
break;
} else if ((sSLException3 instanceof SSLPeerUnverifiedException) || (sSLException3 instanceof CertPathValidatorException)) {
break;
} else {
sSLException3 = sSLException3.getCause();
}
}
i = 25;
errorCallback(this.a, i, sSLException2);
}
protected void unknownHostCallback(String str) {
errorCallback(this.a, 7, str);
}
protected int uploadCallback(ByteBuffer byteBuffer) {
return uploadCallback(this.a, byteBuffer);
}
protected boolean validateCertificateCallback(byte[] bArr) {
return validateCertificateCallback(this.a, bArr);
}
}

View File

@@ -0,0 +1,565 @@
package com.unity3d.player;
import android.content.Context;
import android.graphics.Rect;
import android.graphics.SurfaceTexture;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCaptureSession;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraDevice;
import android.hardware.camera2.CameraManager;
import android.hardware.camera2.CaptureFailure;
import android.hardware.camera2.CaptureRequest;
import android.hardware.camera2.TotalCaptureResult;
import android.hardware.camera2.params.MeteringRectangle;
import android.hardware.camera2.params.StreamConfigurationMap;
import android.media.Image;
import android.media.ImageReader;
import android.os.Handler;
import android.os.HandlerThread;
import android.util.Range;
import android.util.Size;
import android.view.Surface;
import java.util.Arrays;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
/* loaded from: classes2.dex */
public final class a {
private static CameraManager b;
private static String[] c;
private static Semaphore e = new Semaphore(1);
private d a;
private CameraDevice d;
private HandlerThread f;
private Handler g;
private Rect h;
private Rect i;
private int j;
private int k;
private int n;
private int o;
private Range q;
private Image s;
private CaptureRequest.Builder t;
private int w;
private SurfaceTexture x;
private float l = -1.0f;
private float m = -1.0f;
private boolean p = false;
private ImageReader r = null;
private CameraCaptureSession u = null;
private Object v = new Object();
private Surface y = null;
private int z = EnumC0042a.c;
private CameraCaptureSession.CaptureCallback A = new CameraCaptureSession.CaptureCallback() { // from class: com.unity3d.player.a.1
@Override // android.hardware.camera2.CameraCaptureSession.CaptureCallback
public final void onCaptureCompleted(CameraCaptureSession cameraCaptureSession, CaptureRequest captureRequest, TotalCaptureResult totalCaptureResult) {
a.this.a(captureRequest.getTag());
}
@Override // android.hardware.camera2.CameraCaptureSession.CaptureCallback
public final void onCaptureFailed(CameraCaptureSession cameraCaptureSession, CaptureRequest captureRequest, CaptureFailure captureFailure) {
g.Log(5, "Camera2: Capture session failed " + captureRequest.getTag() + " reason " + captureFailure.getReason());
a.this.a(captureRequest.getTag());
}
@Override // android.hardware.camera2.CameraCaptureSession.CaptureCallback
public final void onCaptureSequenceAborted(CameraCaptureSession cameraCaptureSession, int i) {
}
@Override // android.hardware.camera2.CameraCaptureSession.CaptureCallback
public final void onCaptureSequenceCompleted(CameraCaptureSession cameraCaptureSession, int i, long j) {
}
};
private final CameraDevice.StateCallback B = new CameraDevice.StateCallback() { // from class: com.unity3d.player.a.3
@Override // android.hardware.camera2.CameraDevice.StateCallback
public final void onClosed(CameraDevice cameraDevice) {
a.e.release();
}
@Override // android.hardware.camera2.CameraDevice.StateCallback
public final void onDisconnected(CameraDevice cameraDevice) {
g.Log(5, "Camera2: CameraDevice disconnected.");
a.this.a(cameraDevice);
a.e.release();
}
@Override // android.hardware.camera2.CameraDevice.StateCallback
public final void onError(CameraDevice cameraDevice, int i) {
g.Log(6, "Camera2: Error opeining CameraDevice " + i);
a.this.a(cameraDevice);
a.e.release();
}
@Override // android.hardware.camera2.CameraDevice.StateCallback
public final void onOpened(CameraDevice cameraDevice) {
a.this.d = cameraDevice;
a.e.release();
}
};
private final ImageReader.OnImageAvailableListener C = new ImageReader.OnImageAvailableListener() { // from class: com.unity3d.player.a.4
@Override // android.media.ImageReader.OnImageAvailableListener
public final void onImageAvailable(ImageReader imageReader) {
if (a.e.tryAcquire()) {
Image acquireNextImage = imageReader.acquireNextImage();
if (acquireNextImage != null) {
Image.Plane[] planes = acquireNextImage.getPlanes();
if (acquireNextImage.getFormat() == 35 && planes != null && planes.length == 3) {
a.this.a.a(planes[0].getBuffer(), planes[1].getBuffer(), planes[2].getBuffer(), planes[0].getRowStride(), planes[1].getRowStride(), planes[1].getPixelStride());
} else {
g.Log(6, "Camera2: Wrong image format.");
}
if (a.this.s != null) {
a.this.s.close();
}
a.this.s = acquireNextImage;
}
a.e.release();
}
}
};
private final SurfaceTexture.OnFrameAvailableListener D = new SurfaceTexture.OnFrameAvailableListener() { // from class: com.unity3d.player.a.5
@Override // android.graphics.SurfaceTexture.OnFrameAvailableListener
public final void onFrameAvailable(SurfaceTexture surfaceTexture) {
a.this.a.a(surfaceTexture);
}
};
/* JADX WARN: $VALUES field not found */
/* JADX WARN: Failed to restore enum class, 'enum' modifier and super class removed */
/* renamed from: com.unity3d.player.a$a, reason: collision with other inner class name */
private static final class EnumC0042a {
public static final int a = 1;
public static final int b = 2;
public static final int c = 3;
private static final /* synthetic */ int[] d = {a, b, c};
}
protected a(d dVar) {
this.a = null;
this.a = dVar;
g();
}
public static int a(Context context) {
return c(context).length;
}
public static int a(Context context, int i) {
try {
return ((Integer) b(context).getCameraCharacteristics(c(context)[i]).get(CameraCharacteristics.SENSOR_ORIENTATION)).intValue();
} catch (CameraAccessException e2) {
g.Log(6, "Camera2: CameraAccessException " + e2);
return 0;
}
}
private static int a(Range[] rangeArr, int i) {
int i2 = -1;
double d = Double.MAX_VALUE;
for (int i3 = 0; i3 < rangeArr.length; i3++) {
int intValue = ((Integer) rangeArr[i3].getLower()).intValue();
int intValue2 = ((Integer) rangeArr[i3].getUpper()).intValue();
float f = i;
if (f + 0.1f > intValue && f - 0.1f < intValue2) {
return i;
}
if (r4 < d) {
i2 = i3;
d = r4;
}
}
return ((Integer) (i > ((Integer) rangeArr[i2].getUpper()).intValue() ? rangeArr[i2].getUpper() : rangeArr[i2].getLower())).intValue();
}
private static Rect a(Size[] sizeArr, double d, double d2) {
double d3 = Double.MAX_VALUE;
int i = 0;
int i2 = 0;
for (int i3 = 0; i3 < sizeArr.length; i3++) {
int width = sizeArr[i3].getWidth();
int height = sizeArr[i3].getHeight();
double abs = Math.abs(Math.log(d / width)) + Math.abs(Math.log(d2 / height));
if (abs < d3) {
i = width;
i2 = height;
d3 = abs;
}
}
return new Rect(0, 0, i, i2);
}
/* JADX INFO: Access modifiers changed from: private */
public void a(CameraDevice cameraDevice) {
synchronized (this.v) {
this.u = null;
}
cameraDevice.close();
this.d = null;
}
/* JADX INFO: Access modifiers changed from: private */
public void a(Object obj) {
if (obj != "Focus") {
if (obj == "Cancel focus") {
synchronized (this.v) {
if (this.u != null) {
j();
}
}
return;
}
return;
}
this.p = false;
synchronized (this.v) {
if (this.u != null) {
try {
this.t.set(CaptureRequest.CONTROL_AF_TRIGGER, 0);
this.t.setTag("Regular");
this.u.setRepeatingRequest(this.t.build(), this.A, this.g);
} catch (CameraAccessException e2) {
g.Log(6, "Camera2: CameraAccessException " + e2);
}
}
}
}
private static Size[] a(CameraCharacteristics cameraCharacteristics) {
String str;
StreamConfigurationMap streamConfigurationMap = (StreamConfigurationMap) cameraCharacteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
if (streamConfigurationMap == null) {
str = "Camera2: configuration map is not available.";
} else {
Size[] outputSizes = streamConfigurationMap.getOutputSizes(35);
if (outputSizes != null && outputSizes.length != 0) {
return outputSizes;
}
str = "Camera2: output sizes for YUV_420_888 format are not avialable.";
}
g.Log(6, str);
return null;
}
private static CameraManager b(Context context) {
if (b == null) {
b = (CameraManager) context.getSystemService("camera");
}
return b;
}
private void b(CameraCharacteristics cameraCharacteristics) {
this.k = ((Integer) cameraCharacteristics.get(CameraCharacteristics.CONTROL_MAX_REGIONS_AF)).intValue();
if (this.k > 0) {
this.i = (Rect) cameraCharacteristics.get(CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE);
float width = this.h.width() / this.h.height();
if (width > this.i.width() / this.i.height()) {
this.n = 0;
this.o = (int) ((this.i.height() - (this.i.width() / width)) / 2.0f);
} else {
this.o = 0;
this.n = (int) ((this.i.width() - (this.i.height() * width)) / 2.0f);
}
this.j = Math.min(this.i.width(), this.i.height()) / 20;
}
}
public static boolean b(Context context, int i) {
try {
return ((Integer) b(context).getCameraCharacteristics(c(context)[i]).get(CameraCharacteristics.LENS_FACING)).intValue() == 0;
} catch (CameraAccessException e2) {
g.Log(6, "Camera2: CameraAccessException " + e2);
return false;
}
}
public static boolean c(Context context, int i) {
try {
return ((Integer) b(context).getCameraCharacteristics(c(context)[i]).get(CameraCharacteristics.CONTROL_MAX_REGIONS_AF)).intValue() > 0;
} catch (CameraAccessException e2) {
g.Log(6, "Camera2: CameraAccessException " + e2);
return false;
}
}
private static String[] c(Context context) {
if (c == null) {
try {
c = b(context).getCameraIdList();
} catch (CameraAccessException e2) {
g.Log(6, "Camera2: CameraAccessException " + e2);
c = new String[0];
}
}
return c;
}
public static int[] d(Context context, int i) {
try {
Size[] a = a(b(context).getCameraCharacteristics(c(context)[i]));
if (a == null) {
return null;
}
int[] iArr = new int[a.length * 2];
for (int i2 = 0; i2 < a.length; i2++) {
int i3 = i2 * 2;
iArr[i3] = a[i2].getWidth();
iArr[i3 + 1] = a[i2].getHeight();
}
return iArr;
} catch (CameraAccessException e2) {
g.Log(6, "Camera2: CameraAccessException " + e2);
return null;
}
}
private void g() {
this.f = new HandlerThread("CameraBackground");
this.f.start();
this.g = new Handler(this.f.getLooper());
}
private void h() {
this.f.quit();
try {
this.f.join(4000L);
this.f = null;
this.g = null;
} catch (InterruptedException e2) {
this.f.interrupt();
g.Log(6, "Camera2: Interrupted while waiting for the background thread to finish " + e2);
}
}
private void i() {
try {
if (!e.tryAcquire(4L, TimeUnit.SECONDS)) {
g.Log(5, "Camera2: Timeout waiting to lock camera for closing.");
return;
}
this.d.close();
try {
if (!e.tryAcquire(4L, TimeUnit.SECONDS)) {
g.Log(5, "Camera2: Timeout waiting to close camera.");
}
} catch (InterruptedException e2) {
g.Log(6, "Camera2: Interrupted while waiting to close camera " + e2);
}
this.d = null;
e.release();
} catch (InterruptedException e3) {
g.Log(6, "Camera2: Interrupted while trying to lock camera for closing " + e3);
}
}
/* JADX INFO: Access modifiers changed from: private */
public void j() {
try {
if (this.k != 0 && this.l >= 0.0f && this.l <= 1.0f && this.m >= 0.0f && this.m <= 1.0f) {
this.p = true;
this.t.set(CaptureRequest.CONTROL_AF_REGIONS, new MeteringRectangle[]{new MeteringRectangle(Math.max(this.j + 1, Math.min((int) (((this.i.width() - (this.n * 2)) * this.l) + this.n), (this.i.width() - this.j) - 1)) - this.j, Math.max(this.j + 1, Math.min((int) (((this.i.height() - (this.o * 2)) * (1.0d - this.m)) + this.o), (this.i.height() - this.j) - 1)) - this.j, this.j * 2, this.j * 2, 999)});
this.t.set(CaptureRequest.CONTROL_AF_MODE, 1);
this.t.set(CaptureRequest.CONTROL_AF_TRIGGER, 1);
this.t.setTag("Focus");
this.u.capture(this.t.build(), this.A, this.g);
return;
}
this.t.set(CaptureRequest.CONTROL_AF_MODE, 4);
this.t.setTag("Regular");
if (this.u != null) {
this.u.setRepeatingRequest(this.t.build(), this.A, this.g);
}
} catch (CameraAccessException e2) {
g.Log(6, "Camera2: CameraAccessException " + e2);
}
}
private void k() {
try {
if (this.u != null) {
this.u.stopRepeating();
this.t.set(CaptureRequest.CONTROL_AF_TRIGGER, 2);
this.t.set(CaptureRequest.CONTROL_AF_MODE, 0);
this.t.setTag("Cancel focus");
this.u.capture(this.t.build(), this.A, this.g);
}
} catch (CameraAccessException e2) {
g.Log(6, "Camera2: CameraAccessException " + e2);
}
}
public final Rect a() {
return this.h;
}
public final boolean a(float f, float f2) {
if (this.k <= 0) {
return false;
}
if (this.p) {
g.Log(5, "Camera2: Setting manual focus point already started.");
return false;
}
this.l = f;
this.m = f2;
synchronized (this.v) {
if (this.u != null && this.z != EnumC0042a.b) {
k();
}
}
return true;
}
public final boolean a(Context context, int i, int i2, int i3, int i4, int i5) {
try {
CameraCharacteristics cameraCharacteristics = b.getCameraCharacteristics(c(context)[i]);
if (((Integer) cameraCharacteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL)).intValue() == 2) {
g.Log(5, "Camera2: only LEGACY hardware level is supported.");
return false;
}
Size[] a = a(cameraCharacteristics);
if (a != null && a.length != 0) {
this.h = a(a, i2, i3);
Range[] rangeArr = (Range[]) cameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES);
if (rangeArr != null && rangeArr.length != 0) {
int a2 = a(rangeArr, i4);
this.q = new Range(Integer.valueOf(a2), Integer.valueOf(a2));
try {
if (!e.tryAcquire(4L, TimeUnit.SECONDS)) {
g.Log(5, "Camera2: Timeout waiting to lock camera for opening.");
return false;
}
try {
b.openCamera(c(context)[i], this.B, this.g);
try {
} catch (InterruptedException e2) {
g.Log(6, "Camera2: Interrupted while waiting to open camera " + e2);
}
if (!e.tryAcquire(4L, TimeUnit.SECONDS)) {
g.Log(5, "Camera2: Timeout waiting to open camera.");
return false;
}
e.release();
this.w = i5;
b(cameraCharacteristics);
return this.d != null;
} catch (CameraAccessException e3) {
g.Log(6, "Camera2: CameraAccessException " + e3);
e.release();
return false;
}
} catch (InterruptedException e4) {
g.Log(6, "Camera2: Interrupted while trying to lock camera for opening " + e4);
return false;
}
}
g.Log(6, "Camera2: target FPS ranges are not avialable.");
}
return false;
} catch (CameraAccessException e5) {
g.Log(6, "Camera2: CameraAccessException " + e5);
return false;
}
}
public final void b() {
if (this.d != null) {
e();
i();
this.A = null;
this.y = null;
this.x = null;
Image image = this.s;
if (image != null) {
image.close();
this.s = null;
}
ImageReader imageReader = this.r;
if (imageReader != null) {
imageReader.close();
this.r = null;
}
}
h();
}
public final void c() {
if (this.r == null) {
this.r = ImageReader.newInstance(this.h.width(), this.h.height(), 35, 2);
this.r.setOnImageAvailableListener(this.C, this.g);
this.s = null;
int i = this.w;
if (i != 0) {
this.x = new SurfaceTexture(i);
this.x.setDefaultBufferSize(this.h.width(), this.h.height());
this.x.setOnFrameAvailableListener(this.D, this.g);
this.y = new Surface(this.x);
}
}
try {
if (this.u == null) {
this.d.createCaptureSession(this.y != null ? Arrays.asList(this.y, this.r.getSurface()) : Arrays.asList(this.r.getSurface()), new CameraCaptureSession.StateCallback() { // from class: com.unity3d.player.a.2
@Override // android.hardware.camera2.CameraCaptureSession.StateCallback
public final void onConfigureFailed(CameraCaptureSession cameraCaptureSession) {
g.Log(6, "Camera2: CaptureSession configuration failed.");
}
@Override // android.hardware.camera2.CameraCaptureSession.StateCallback
public final void onConfigured(CameraCaptureSession cameraCaptureSession) {
if (a.this.d == null) {
return;
}
synchronized (a.this.v) {
a.this.u = cameraCaptureSession;
try {
a.this.t = a.this.d.createCaptureRequest(1);
if (a.this.y != null) {
a.this.t.addTarget(a.this.y);
}
a.this.t.addTarget(a.this.r.getSurface());
a.this.t.set(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE, a.this.q);
a.this.j();
} catch (CameraAccessException e2) {
g.Log(6, "Camera2: CameraAccessException " + e2);
}
}
}
}, this.g);
} else if (this.z == EnumC0042a.b) {
this.u.setRepeatingRequest(this.t.build(), this.A, this.g);
}
this.z = EnumC0042a.a;
} catch (CameraAccessException e2) {
g.Log(6, "Camera2: CameraAccessException " + e2);
}
}
public final void d() {
synchronized (this.v) {
if (this.u != null) {
try {
this.u.stopRepeating();
this.z = EnumC0042a.b;
} catch (CameraAccessException e2) {
g.Log(6, "Camera2: CameraAccessException " + e2);
}
}
}
}
public final void e() {
synchronized (this.v) {
if (this.u != null) {
try {
this.u.abortCaptures();
} catch (CameraAccessException e2) {
g.Log(6, "Camera2: CameraAccessException " + e2);
}
this.u.close();
this.u = null;
this.z = EnumC0042a.c;
}
}
}
}

View File

@@ -0,0 +1,174 @@
package com.unity3d.player;
import android.os.Build;
import java.net.InetAddress;
import java.net.Socket;
import java.security.KeyStore;
import java.security.cert.X509Certificate;
import javax.net.ssl.HandshakeCompletedEvent;
import javax.net.ssl.HandshakeCompletedListener;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;
/* loaded from: classes2.dex */
public final class b extends SSLSocketFactory {
private static volatile SSLSocketFactory c;
private static volatile X509TrustManager d;
private static final Object e = new Object[0];
private static final Object f = new Object[0];
private static final boolean g;
private final SSLSocketFactory a;
private final a b;
class a implements HandshakeCompletedListener {
@Override // javax.net.ssl.HandshakeCompletedListener
public final void handshakeCompleted(HandshakeCompletedEvent handshakeCompletedEvent) {
SSLSession session = handshakeCompletedEvent.getSession();
session.getCipherSuite();
session.getProtocol();
try {
session.getPeerPrincipal().getName();
} catch (SSLPeerUnverifiedException unused) {
}
}
}
/* renamed from: com.unity3d.player.b$b, reason: collision with other inner class name */
public static abstract class AbstractC0043b implements X509TrustManager {
protected X509TrustManager a = b.c();
@Override // javax.net.ssl.X509TrustManager
public final void checkClientTrusted(X509Certificate[] x509CertificateArr, String str) {
this.a.checkClientTrusted(x509CertificateArr, str);
}
@Override // javax.net.ssl.X509TrustManager
public void checkServerTrusted(X509Certificate[] x509CertificateArr, String str) {
this.a.checkServerTrusted(x509CertificateArr, str);
}
@Override // javax.net.ssl.X509TrustManager
public final X509Certificate[] getAcceptedIssuers() {
return this.a.getAcceptedIssuers();
}
}
static {
boolean z = false;
int i = Build.VERSION.SDK_INT;
if (i >= 16 && i < 20) {
z = true;
}
g = z;
}
private b(AbstractC0043b[] abstractC0043bArr) {
SSLContext sSLContext = SSLContext.getInstance("TLS");
sSLContext.init(null, abstractC0043bArr, null);
this.a = sSLContext.getSocketFactory();
this.b = null;
}
private Socket a(Socket socket) {
if (socket != null && (socket instanceof SSLSocket)) {
if (g) {
SSLSocket sSLSocket = (SSLSocket) socket;
sSLSocket.setEnabledProtocols(sSLSocket.getSupportedProtocols());
}
a aVar = this.b;
if (aVar != null) {
((SSLSocket) socket).addHandshakeCompletedListener(aVar);
}
}
return socket;
}
public static SSLSocketFactory a(AbstractC0043b abstractC0043b) {
try {
return abstractC0043b == null ? b() : new b(new AbstractC0043b[]{abstractC0043b});
} catch (Exception e2) {
g.Log(5, "CustomSSLSocketFactory: Failed to create SSLSocketFactory (" + e2.getMessage() + ")");
return null;
}
}
private static SSLSocketFactory b() {
synchronized (e) {
if (c != null) {
return c;
}
b bVar = new b(null);
c = bVar;
return bVar;
}
}
/* JADX INFO: Access modifiers changed from: private */
public static X509TrustManager c() {
synchronized (f) {
if (d != null) {
return d;
}
try {
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustManagerFactory.init((KeyStore) null);
for (TrustManager trustManager : trustManagerFactory.getTrustManagers()) {
if (trustManager instanceof X509TrustManager) {
X509TrustManager x509TrustManager = (X509TrustManager) trustManager;
d = x509TrustManager;
return x509TrustManager;
}
}
} catch (Exception e2) {
g.Log(5, "CustomSSLSocketFactory: Failed to find X509TrustManager (" + e2.getMessage() + ")");
}
return null;
}
}
@Override // javax.net.SocketFactory
public final Socket createSocket() {
return a(this.a.createSocket());
}
@Override // javax.net.SocketFactory
public final Socket createSocket(String str, int i) {
return a(this.a.createSocket(str, i));
}
@Override // javax.net.SocketFactory
public final Socket createSocket(String str, int i, InetAddress inetAddress, int i2) {
return a(this.a.createSocket(str, i, inetAddress, i2));
}
@Override // javax.net.SocketFactory
public final Socket createSocket(InetAddress inetAddress, int i) {
return a(this.a.createSocket(inetAddress, i));
}
@Override // javax.net.SocketFactory
public final Socket createSocket(InetAddress inetAddress, int i, InetAddress inetAddress2, int i2) {
return a(this.a.createSocket(inetAddress, i, inetAddress2, i2));
}
@Override // javax.net.ssl.SSLSocketFactory
public final Socket createSocket(Socket socket, String str, int i, boolean z) {
return a(this.a.createSocket(socket, str, i, z));
}
@Override // javax.net.ssl.SSLSocketFactory
public final String[] getDefaultCipherSuites() {
return this.a.getDefaultCipherSuites();
}
@Override // javax.net.ssl.SSLSocketFactory
public final String[] getSupportedCipherSuites() {
return this.a.getSupportedCipherSuites();
}
}

View File

@@ -0,0 +1,73 @@
package com.unity3d.player;
import android.app.Activity;
import android.content.Context;
import android.os.Looper;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
/* loaded from: classes2.dex */
class c {
protected f b;
protected String e;
protected o a = null;
protected Context c = null;
protected String d = null;
c(String str, f fVar) {
this.b = null;
this.e = "";
this.e = str;
this.b = fVar;
}
protected void reportError(String str) {
f fVar = this.b;
if (fVar != null) {
fVar.reportError(this.e + " Error [" + this.d + "]", str);
return;
}
g.Log(6, this.e + " Error [" + this.d + "]: " + str);
}
protected void runOnUiThread(Runnable runnable) {
Context context = this.c;
if (context instanceof Activity) {
((Activity) context).runOnUiThread(runnable);
return;
}
g.Log(5, "Not running " + this.e + " from an Activity; Ignoring execution request...");
}
protected boolean runOnUiThreadWithSync(final Runnable runnable) {
if (Looper.getMainLooper().getThread() == Thread.currentThread()) {
runnable.run();
return true;
}
final Semaphore semaphore = new Semaphore(0);
runOnUiThread(new Runnable() { // from class: com.unity3d.player.c.1
@Override // java.lang.Runnable
public final void run() {
try {
try {
runnable.run();
} catch (Exception e) {
c.this.reportError("Exception unloading Google VR on UI Thread. " + e.getLocalizedMessage());
}
} finally {
semaphore.release();
}
}
});
try {
if (semaphore.tryAcquire(4L, TimeUnit.SECONDS)) {
return true;
}
reportError("Timeout waiting for vr state change!");
return false;
} catch (InterruptedException e) {
reportError("Interrupted while trying to acquire sync lock. " + e.getLocalizedMessage());
return false;
}
}
}

View File

@@ -0,0 +1,8 @@
package com.unity3d.player;
/* loaded from: classes2.dex */
public interface d {
void a(Object obj);
void a(Object obj, Object obj2, Object obj3, int i, int i2, int i3);
}

View File

@@ -0,0 +1,10 @@
package com.unity3d.player;
import android.app.Activity;
/* loaded from: classes2.dex */
public interface e {
void a(Activity activity, String str);
boolean a(Activity activity);
}

View File

@@ -0,0 +1,12 @@
package com.unity3d.player;
import android.view.View;
/* loaded from: classes2.dex */
interface f {
boolean addViewToPlayer(View view, boolean z);
void removeViewFromPlayer(View view);
void reportError(String str, String str2);
}

View File

@@ -0,0 +1,20 @@
package com.unity3d.player;
import android.util.Log;
/* loaded from: classes2.dex */
final class g {
protected static boolean a = false;
protected static void Log(int i, String str) {
if (a) {
return;
}
if (i == 6) {
Log.e("Unity", str);
}
if (i == 5) {
Log.w("Unity", str);
}
}
}

View File

@@ -0,0 +1,54 @@
package com.unity3d.player;
import android.app.Activity;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageItemInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import com.ubtrobot.jimu.robotapi.PeripheralType;
/* loaded from: classes2.dex */
public final class h implements e {
private static boolean a(PackageItemInfo packageItemInfo) {
try {
return packageItemInfo.metaData.getBoolean("unityplayer.SkipPermissionsDialog");
} catch (Exception unused) {
return false;
}
}
@Override // com.unity3d.player.e
public final void a(Activity activity, String str) {
if (activity == null || str == null) {
return;
}
FragmentManager fragmentManager = activity.getFragmentManager();
if (fragmentManager.findFragmentByTag("96489") == null) {
i iVar = new i();
Bundle bundle = new Bundle();
bundle.putString("PermissionNames", str);
iVar.setArguments(bundle);
FragmentTransaction beginTransaction = fragmentManager.beginTransaction();
beginTransaction.add(0, iVar, "96489");
beginTransaction.commit();
}
}
@Override // com.unity3d.player.e
public final boolean a(Activity activity) {
try {
PackageManager packageManager = activity.getPackageManager();
ActivityInfo activityInfo = packageManager.getActivityInfo(activity.getComponentName(), PeripheralType.SERVO);
ApplicationInfo applicationInfo = packageManager.getApplicationInfo(activity.getPackageName(), PeripheralType.SERVO);
if (a(activityInfo)) {
return true;
}
return a(applicationInfo);
} catch (Exception unused) {
return false;
}
}
}

View File

@@ -0,0 +1,28 @@
package com.unity3d.player;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.os.Bundle;
/* loaded from: classes2.dex */
public final class i extends Fragment {
@Override // android.app.Fragment
public final void onCreate(Bundle bundle) {
super.onCreate(bundle);
requestPermissions(new String[]{getArguments().getString("PermissionNames")}, 96489);
}
@Override // android.app.Fragment
public final void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
if (i != 96489) {
return;
}
if (strArr.length == 0) {
requestPermissions(new String[]{getArguments().getString("PermissionNames")}, 96489);
return;
}
FragmentTransaction beginTransaction = getActivity().getFragmentManager().beginTransaction();
beginTransaction.remove(this);
beginTransaction.commit();
}
}

View File

@@ -0,0 +1,19 @@
package com.unity3d.player;
import android.os.Build;
/* loaded from: classes2.dex */
public final class j {
static final boolean a;
static final boolean b;
static final boolean c;
static final e d;
static {
a = Build.VERSION.SDK_INT >= 19;
b = Build.VERSION.SDK_INT >= 21;
boolean z = Build.VERSION.SDK_INT >= 23;
c = z;
d = z ? new h() : null;
}
}

View File

@@ -0,0 +1,208 @@
package com.unity3d.player;
import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.ubt.jimu.base.dialog.SimpleQuestionDialog;
import com.ubtrobot.jimu.robotapi.PeripheralType;
/* loaded from: classes2.dex */
public final class k extends Dialog implements TextWatcher, View.OnClickListener {
private static int c = 1627389952;
private static int d = -1;
private static int e = 134217728;
private static int f = 67108864;
private Context a;
private UnityPlayer b;
public k(Context context, UnityPlayer unityPlayer, String str, int i, boolean z, boolean z2, boolean z3, String str2, int i2) {
super(context);
this.a = null;
this.b = null;
this.a = context;
this.b = unityPlayer;
getWindow().setGravity(80);
getWindow().requestFeature(1);
getWindow().setBackgroundDrawable(new ColorDrawable(0));
setContentView(createSoftInputView());
getWindow().setLayout(-1, -2);
getWindow().clearFlags(2);
if (j.a) {
getWindow().clearFlags(e);
getWindow().clearFlags(f);
}
EditText editText = (EditText) findViewById(1057292289);
Button button = (Button) findViewById(1057292290);
a(editText, str, i, z, z2, z3, str2, i2);
button.setOnClickListener(this);
editText.setOnFocusChangeListener(new View.OnFocusChangeListener() { // from class: com.unity3d.player.k.1
@Override // android.view.View.OnFocusChangeListener
public final void onFocusChange(View view, boolean z4) {
if (z4) {
k.this.getWindow().setSoftInputMode(5);
}
}
});
}
private static int a(int i, boolean z, boolean z2, boolean z3) {
int i2 = (z ? 32768 : 524288) | (z2 ? 131072 : 0) | (z3 ? PeripheralType.SERVO : 0);
if (i < 0 || i > 10) {
return i2;
}
int[] iArr = {1, 16385, 12290, 17, 2, 3, 8289, 33, 1, 16417, 17};
return (iArr[i] & 2) != 0 ? iArr[i] : iArr[i] | i2;
}
/* JADX INFO: Access modifiers changed from: private */
public String a() {
EditText editText = (EditText) findViewById(1057292289);
if (editText == null) {
return null;
}
return editText.getText().toString().trim();
}
private void a(EditText editText, String str, int i, boolean z, boolean z2, boolean z3, String str2, int i2) {
editText.setImeOptions(6);
editText.setText(str);
editText.setHint(str2);
editText.setHintTextColor(c);
editText.setInputType(a(i, z, z2, z3));
editText.setImeOptions(33554432);
if (i2 > 0) {
editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(i2)});
}
editText.addTextChangedListener(this);
editText.setSelection(editText.getText().length());
editText.setClickable(true);
}
/* JADX INFO: Access modifiers changed from: private */
public void a(String str, boolean z) {
((EditText) findViewById(1057292289)).setSelection(0, 0);
this.b.reportSoftInputStr(str, 1, z);
}
public final void a(int i) {
EditText editText = (EditText) findViewById(1057292289);
if (editText != null) {
if (i > 0) {
editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(i)});
} else {
editText.setFilters(new InputFilter[0]);
}
}
}
public final void a(int i, int i2) {
int i3;
EditText editText = (EditText) findViewById(1057292289);
if (editText == null || editText.getText().length() < (i3 = i2 + i)) {
return;
}
editText.setSelection(i, i3);
}
public final void a(String str) {
EditText editText = (EditText) findViewById(1057292289);
if (editText != null) {
editText.setText(str);
editText.setSelection(str.length());
}
}
@Override // android.text.TextWatcher
public final void afterTextChanged(Editable editable) {
this.b.reportSoftInputStr(editable.toString(), 0, false);
}
@Override // android.text.TextWatcher
public final void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
protected final View createSoftInputView() {
RelativeLayout relativeLayout = new RelativeLayout(this.a);
relativeLayout.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
relativeLayout.setBackgroundColor(d);
EditText editText = new EditText(this.a) { // from class: com.unity3d.player.k.2
@Override // android.widget.TextView, android.view.View
public final boolean onKeyPreIme(int i, KeyEvent keyEvent) {
if (i == 4) {
k kVar = k.this;
kVar.a(kVar.a(), true);
return true;
}
if (i == 84) {
return true;
}
return super.onKeyPreIme(i, keyEvent);
}
@Override // android.widget.TextView
protected final void onSelectionChanged(int i, int i2) {
k.this.b.reportSoftInputSelection(i, i2 - i);
}
@Override // android.widget.TextView, android.view.View
public final void onWindowFocusChanged(boolean z) {
super.onWindowFocusChanged(z);
if (z) {
((InputMethodManager) k.this.a.getSystemService("input_method")).showSoftInput(this, 0);
}
}
};
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -2);
layoutParams.addRule(15);
layoutParams.addRule(0, 1057292290);
editText.setLayoutParams(layoutParams);
editText.setId(1057292289);
relativeLayout.addView(editText);
Button button = new Button(this.a);
button.setText(this.a.getResources().getIdentifier(SimpleQuestionDialog.KEY_OK_BUTTON, "string", "android"));
RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-2, -2);
layoutParams2.addRule(15);
layoutParams2.addRule(11);
button.setLayoutParams(layoutParams2);
button.setId(1057292290);
button.setBackgroundColor(0);
relativeLayout.addView(button);
((EditText) relativeLayout.findViewById(1057292289)).setOnEditorActionListener(new TextView.OnEditorActionListener() { // from class: com.unity3d.player.k.3
@Override // android.widget.TextView.OnEditorActionListener
public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i == 6) {
k kVar = k.this;
kVar.a(kVar.a(), false);
}
return false;
}
});
relativeLayout.setPadding(16, 16, 16, 16);
return relativeLayout;
}
@Override // android.app.Dialog
public final void onBackPressed() {
a(a(), true);
}
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
a(a(), false);
}
@Override // android.text.TextWatcher
public final void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
}

View File

@@ -0,0 +1,87 @@
package com.unity3d.player;
import android.content.Context;
import android.graphics.Bitmap;
import android.view.View;
/* loaded from: classes2.dex */
public final class l extends View {
final int a;
final int b;
Bitmap c;
Bitmap d;
/* renamed from: com.unity3d.player.l$1, reason: invalid class name */
static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] a = new int[a.a().length];
static {
try {
a[a.a - 1] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[a.b - 1] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
a[a.c - 1] = 3;
} catch (NoSuchFieldError unused3) {
}
}
}
/* JADX WARN: $VALUES field not found */
/* JADX WARN: Failed to restore enum class, 'enum' modifier and super class removed */
static final class a {
public static final int a = 1;
public static final int b = 2;
public static final int c = 3;
private static final /* synthetic */ int[] d = {a, b, c};
public static int[] a() {
return (int[]) d.clone();
}
}
public l(Context context, int i) {
super(context);
this.a = i;
this.b = getResources().getIdentifier("unity_static_splash", "drawable", getContext().getPackageName());
if (this.b != 0) {
forceLayout();
}
}
@Override // android.view.View
public final void onDetachedFromWindow() {
super.onDetachedFromWindow();
Bitmap bitmap = this.c;
if (bitmap != null) {
bitmap.recycle();
this.c = null;
}
Bitmap bitmap2 = this.d;
if (bitmap2 != null) {
bitmap2.recycle();
this.d = null;
}
}
/* JADX WARN: Code restructure failed: missing block: B:41:0x006b, code lost:
if (r13 < r11) goto L32;
*/
@Override // android.view.View
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public final void onLayout(boolean r9, int r10, int r11, int r12, int r13) {
/*
Method dump skipped, instructions count: 205
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.unity3d.player.l.onLayout(boolean, int, int, int, int):void");
}
}

View File

@@ -0,0 +1,37 @@
package com.unity3d.player;
import android.os.Build;
import java.lang.Thread;
/* loaded from: classes2.dex */
final class m implements Thread.UncaughtExceptionHandler {
private volatile Thread.UncaughtExceptionHandler a;
m() {
}
final synchronized boolean a() {
boolean z;
Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
if (defaultUncaughtExceptionHandler == this) {
z = false;
} else {
this.a = defaultUncaughtExceptionHandler;
Thread.setDefaultUncaughtExceptionHandler(this);
z = true;
}
return z;
}
@Override // java.lang.Thread.UncaughtExceptionHandler
public final synchronized void uncaughtException(Thread thread, Throwable th) {
try {
Error error = new Error(String.format("FATAL EXCEPTION [%s]\n", thread.getName()) + String.format("Unity version : %s\n", "2018.3.0f2") + String.format("Device model : %s %s\n", Build.MANUFACTURER, Build.MODEL) + String.format("Device fingerprint: %s\n", Build.FINGERPRINT));
error.setStackTrace(new StackTraceElement[0]);
error.initCause(th);
this.a.uncaughtException(thread, error);
} catch (Throwable unused) {
this.a.uncaughtException(thread, th);
}
}
}

View File

@@ -0,0 +1,61 @@
package com.unity3d.player;
/* loaded from: classes2.dex */
final class n {
private static boolean a = false;
private boolean b = false;
private boolean c = false;
private boolean d = true;
private boolean e = false;
n() {
}
static void a() {
a = true;
}
static void b() {
a = false;
}
static boolean c() {
return a;
}
final void a(boolean z) {
this.b = z;
}
final void b(boolean z) {
this.d = z;
}
final void c(boolean z) {
this.e = z;
}
final void d(boolean z) {
this.c = z;
}
final boolean d() {
return this.d;
}
final boolean e() {
return this.e;
}
final boolean f() {
return a && this.b && !this.d && !this.c;
}
final boolean g() {
return this.c;
}
public final String toString() {
return super.toString();
}
}

View File

@@ -0,0 +1,68 @@
package com.unity3d.player;
import java.lang.reflect.Method;
import java.util.HashMap;
/* loaded from: classes2.dex */
final class o {
private HashMap a = new HashMap();
private Class b;
private Object c;
class a {
public Class[] a;
public Method b = null;
public a(Class[] clsArr) {
this.a = clsArr;
}
}
public o(Class cls, Object obj) {
this.b = null;
this.c = null;
this.b = cls;
this.c = obj;
}
private void a(String str, a aVar) {
try {
aVar.b = this.b.getMethod(str, aVar.a);
} catch (Exception e) {
g.Log(6, "Exception while trying to get method " + str + ". " + e.getLocalizedMessage());
aVar.b = null;
}
}
public final Object a(String str, Object... objArr) {
StringBuilder sb;
Object obj = null;
if (this.a.containsKey(str)) {
a aVar = (a) this.a.get(str);
if (aVar.b == null) {
a(str, aVar);
}
Method method = aVar.b;
if (method != null) {
try {
obj = objArr.length == 0 ? method.invoke(this.c, new Object[0]) : method.invoke(this.c, objArr);
} catch (Exception e) {
g.Log(6, "Error trying to call delegated method " + str + ". " + e.getLocalizedMessage());
}
return obj;
}
sb = new StringBuilder("Unable to create method: ");
} else {
sb = new StringBuilder("No definition for method ");
sb.append(str);
str = " can be found";
}
sb.append(str);
g.Log(6, sb.toString());
return null;
}
public final void a(String str, Class[] clsArr) {
this.a.put(str, new a(clsArr));
}
}

View File

@@ -0,0 +1,573 @@
package com.unity3d.player;
import android.app.Activity;
import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.media.MediaPlayer;
import android.net.Uri;
import android.util.Log;
import android.view.Display;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.MediaController;
import java.io.FileInputStream;
import java.io.IOException;
/* loaded from: classes2.dex */
public final class p extends FrameLayout implements MediaPlayer.OnBufferingUpdateListener, MediaPlayer.OnCompletionListener, MediaPlayer.OnPreparedListener, MediaPlayer.OnVideoSizeChangedListener, SurfaceHolder.Callback, MediaController.MediaPlayerControl {
private static boolean a = false;
private final Context b;
private final SurfaceView c;
private final SurfaceHolder d;
private final String e;
private final int f;
private final int g;
private final boolean h;
private final long i;
private final long j;
private final FrameLayout k;
private final Display l;
private int m;
private int n;
private int o;
private int p;
private MediaPlayer q;
private MediaController r;
private boolean s;
private boolean t;
private int u;
private boolean v;
private boolean w;
private a x;
private b y;
private volatile int z;
public interface a {
void a(int i);
}
public class b implements Runnable {
private p b;
private boolean c = false;
public b(p pVar) {
this.b = pVar;
}
public final void a() {
this.c = true;
}
@Override // java.lang.Runnable
public final void run() {
try {
Thread.sleep(5000L);
} catch (InterruptedException unused) {
Thread.currentThread().interrupt();
}
if (this.c) {
return;
}
if (p.a) {
p.b("Stopping the video player due to timeout.");
}
this.b.CancelOnPrepare();
}
}
protected p(Context context, String str, int i, int i2, int i3, boolean z, long j, long j2, a aVar) {
super(context);
this.s = false;
this.t = false;
this.u = 0;
this.v = false;
this.w = false;
this.z = 0;
this.x = aVar;
this.b = context;
this.k = this;
this.c = new SurfaceView(context);
this.d = this.c.getHolder();
this.d.addCallback(this);
this.k.setBackgroundColor(i);
this.k.addView(this.c);
this.l = ((WindowManager) this.b.getSystemService("window")).getDefaultDisplay();
this.e = str;
this.f = i2;
this.g = i3;
this.h = z;
this.i = j;
this.j = j2;
if (a) {
b("fileName: " + this.e);
}
if (a) {
b("backgroundColor: " + i);
}
if (a) {
b("controlMode: " + this.f);
}
if (a) {
b("scalingMode: " + this.g);
}
if (a) {
b("isURL: " + this.h);
}
if (a) {
b("videoOffset: " + this.i);
}
if (a) {
b("videoLength: " + this.j);
}
setFocusable(true);
setFocusableInTouchMode(true);
}
private void a(int i) {
this.z = i;
a aVar = this.x;
if (aVar != null) {
aVar.a(this.z);
}
}
/* JADX INFO: Access modifiers changed from: private */
public static void b(String str) {
Log.i("Video", "VideoPlayer: " + str);
}
private void c() {
FileInputStream fileInputStream;
MediaPlayer mediaPlayer = this.q;
if (mediaPlayer != null) {
mediaPlayer.setDisplay(this.d);
if (this.v) {
return;
}
if (a) {
b("Resuming playback");
}
this.q.start();
return;
}
a(0);
doCleanUp();
try {
this.q = new MediaPlayer();
if (this.h) {
this.q.setDataSource(this.b, Uri.parse(this.e));
} else {
if (this.j != 0) {
fileInputStream = new FileInputStream(this.e);
this.q.setDataSource(fileInputStream.getFD(), this.i, this.j);
} else {
try {
AssetFileDescriptor openFd = getResources().getAssets().openFd(this.e);
this.q.setDataSource(openFd.getFileDescriptor(), openFd.getStartOffset(), openFd.getLength());
openFd.close();
} catch (IOException unused) {
fileInputStream = new FileInputStream(this.e);
this.q.setDataSource(fileInputStream.getFD());
}
}
fileInputStream.close();
}
this.q.setDisplay(this.d);
this.q.setScreenOnWhilePlaying(true);
this.q.setOnBufferingUpdateListener(this);
this.q.setOnCompletionListener(this);
this.q.setOnPreparedListener(this);
this.q.setOnVideoSizeChangedListener(this);
this.q.setAudioStreamType(3);
this.q.prepareAsync();
this.y = new b(this);
new Thread(this.y).start();
} catch (Exception e) {
if (a) {
b("error: " + e.getMessage() + e);
}
a(2);
}
}
private void d() {
if (isPlaying()) {
return;
}
a(1);
if (a) {
b("startVideoPlayback");
}
updateVideoLayout();
if (this.v) {
return;
}
start();
}
public final void CancelOnPrepare() {
a(2);
}
final boolean a() {
return this.v;
}
@Override // android.widget.MediaController.MediaPlayerControl
public final boolean canPause() {
return true;
}
@Override // android.widget.MediaController.MediaPlayerControl
public final boolean canSeekBackward() {
return true;
}
@Override // android.widget.MediaController.MediaPlayerControl
public final boolean canSeekForward() {
return true;
}
protected final void destroyPlayer() {
if (a) {
b("destroyPlayer");
}
if (!this.v) {
pause();
}
doCleanUp();
}
protected final void doCleanUp() {
b bVar = this.y;
if (bVar != null) {
bVar.a();
this.y = null;
}
MediaPlayer mediaPlayer = this.q;
if (mediaPlayer != null) {
mediaPlayer.release();
this.q = null;
}
this.o = 0;
this.p = 0;
this.t = false;
this.s = false;
}
@Override // android.widget.MediaController.MediaPlayerControl
public final int getBufferPercentage() {
if (this.h) {
return this.u;
}
return 100;
}
@Override // android.widget.MediaController.MediaPlayerControl
public final int getCurrentPosition() {
MediaPlayer mediaPlayer = this.q;
if (mediaPlayer == null) {
return 0;
}
return mediaPlayer.getCurrentPosition();
}
@Override // android.widget.MediaController.MediaPlayerControl
public final int getDuration() {
MediaPlayer mediaPlayer = this.q;
if (mediaPlayer == null) {
return 0;
}
return mediaPlayer.getDuration();
}
@Override // android.widget.MediaController.MediaPlayerControl
public final boolean isPlaying() {
boolean z = this.t && this.s;
MediaPlayer mediaPlayer = this.q;
return mediaPlayer == null ? !z : mediaPlayer.isPlaying() || !z;
}
@Override // android.media.MediaPlayer.OnBufferingUpdateListener
public final void onBufferingUpdate(MediaPlayer mediaPlayer, int i) {
if (a) {
b("onBufferingUpdate percent:" + i);
}
this.u = i;
}
@Override // android.media.MediaPlayer.OnCompletionListener
public final void onCompletion(MediaPlayer mediaPlayer) {
if (a) {
b("onCompletion called");
}
destroyPlayer();
a(3);
}
@Override // android.view.View, android.view.KeyEvent.Callback
public final boolean onKeyDown(int i, KeyEvent keyEvent) {
if (i != 4 && (this.f != 2 || i == 0 || keyEvent.isSystem())) {
MediaController mediaController = this.r;
return mediaController != null ? mediaController.onKeyDown(i, keyEvent) : super.onKeyDown(i, keyEvent);
}
destroyPlayer();
a(3);
return true;
}
@Override // android.media.MediaPlayer.OnPreparedListener
public final void onPrepared(MediaPlayer mediaPlayer) {
if (a) {
b("onPrepared called");
}
b bVar = this.y;
if (bVar != null) {
bVar.a();
this.y = null;
}
int i = this.f;
if (i == 0 || i == 1) {
this.r = new MediaController(this.b);
this.r.setMediaPlayer(this);
this.r.setAnchorView(this);
this.r.setEnabled(true);
Context context = this.b;
if (context instanceof Activity) {
this.r.setSystemUiVisibility(((Activity) context).getWindow().getDecorView().getSystemUiVisibility());
}
this.r.show();
}
this.t = true;
if (this.t && this.s) {
d();
}
}
@Override // android.view.View
public final boolean onTouchEvent(MotionEvent motionEvent) {
int action = motionEvent.getAction() & 255;
if (this.f != 2 || action != 0) {
MediaController mediaController = this.r;
return mediaController != null ? mediaController.onTouchEvent(motionEvent) : super.onTouchEvent(motionEvent);
}
destroyPlayer();
a(3);
return true;
}
@Override // android.media.MediaPlayer.OnVideoSizeChangedListener
public final void onVideoSizeChanged(MediaPlayer mediaPlayer, int i, int i2) {
if (a) {
b("onVideoSizeChanged called " + i + "x" + i2);
}
if (i != 0 && i2 != 0) {
this.s = true;
this.o = i;
this.p = i2;
if (this.t && this.s) {
d();
return;
}
return;
}
if (a) {
b("invalid video width(" + i + ") or height(" + i2 + ")");
}
}
@Override // android.widget.MediaController.MediaPlayerControl
public final void pause() {
MediaPlayer mediaPlayer = this.q;
if (mediaPlayer == null) {
return;
}
if (this.w) {
mediaPlayer.pause();
}
this.v = true;
}
@Override // android.widget.MediaController.MediaPlayerControl
public final void seekTo(int i) {
MediaPlayer mediaPlayer = this.q;
if (mediaPlayer == null) {
return;
}
mediaPlayer.seekTo(i);
}
@Override // android.widget.MediaController.MediaPlayerControl
public final void start() {
if (a) {
b("Start");
}
MediaPlayer mediaPlayer = this.q;
if (mediaPlayer == null) {
return;
}
if (this.w) {
mediaPlayer.start();
}
this.v = false;
}
@Override // android.view.SurfaceHolder.Callback
public final void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i2, int i3) {
if (a) {
b("surfaceChanged called " + i + " " + i2 + "x" + i3);
}
if (this.m == i2 && this.n == i3) {
return;
}
this.m = i2;
this.n = i3;
if (this.w) {
updateVideoLayout();
}
}
@Override // android.view.SurfaceHolder.Callback
public final void surfaceCreated(SurfaceHolder surfaceHolder) {
if (a) {
b("surfaceCreated called");
}
this.w = true;
c();
}
@Override // android.view.SurfaceHolder.Callback
public final void surfaceDestroyed(SurfaceHolder surfaceHolder) {
if (a) {
b("surfaceDestroyed called");
}
this.w = false;
}
/* JADX WARN: Code restructure failed: missing block: B:17:0x004d, code lost:
if (r5 <= r3) goto L19;
*/
/* JADX WARN: Code restructure failed: missing block: B:18:0x004f, code lost:
r1 = (int) (r0 / r3);
*/
/* JADX WARN: Code restructure failed: missing block: B:29:0x0053, code lost:
r0 = (int) (r1 * r3);
*/
/* JADX WARN: Code restructure failed: missing block: B:33:0x005d, code lost:
if (r5 >= r3) goto L19;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
protected final void updateVideoLayout() {
/*
r8 = this;
boolean r0 = com.unity3d.player.p.a
if (r0 == 0) goto L9
java.lang.String r0 = "updateVideoLayout"
b(r0)
L9:
android.media.MediaPlayer r0 = r8.q
if (r0 != 0) goto Le
return
Le:
int r0 = r8.m
if (r0 == 0) goto L16
int r0 = r8.n
if (r0 != 0) goto L34
L16:
android.content.Context r0 = r8.b
java.lang.String r1 = "window"
java.lang.Object r0 = r0.getSystemService(r1)
android.view.WindowManager r0 = (android.view.WindowManager) r0
android.util.DisplayMetrics r1 = new android.util.DisplayMetrics
r1.<init>()
android.view.Display r0 = r0.getDefaultDisplay()
r0.getMetrics(r1)
int r0 = r1.widthPixels
r8.m = r0
int r0 = r1.heightPixels
r8.n = r0
L34:
int r0 = r8.m
int r1 = r8.n
boolean r2 = r8.s
if (r2 == 0) goto L65
int r2 = r8.o
float r3 = (float) r2
int r4 = r8.p
float r5 = (float) r4
float r3 = r3 / r5
float r5 = (float) r0
float r6 = (float) r1
float r5 = r5 / r6
int r6 = r8.g
r7 = 1
if (r6 != r7) goto L58
int r2 = (r5 > r3 ? 1 : (r5 == r3 ? 0 : -1))
if (r2 > 0) goto L53
L4f:
float r1 = (float) r0
float r1 = r1 / r3
int r1 = (int) r1
goto L6e
L53:
float r0 = (float) r1
float r0 = r0 * r3
int r0 = (int) r0
goto L6e
L58:
r7 = 2
if (r6 != r7) goto L60
int r2 = (r5 > r3 ? 1 : (r5 == r3 ? 0 : -1))
if (r2 < 0) goto L53
goto L4f
L60:
if (r6 != 0) goto L6e
r0 = r2
r1 = r4
goto L6e
L65:
boolean r2 = com.unity3d.player.p.a
if (r2 == 0) goto L6e
java.lang.String r2 = "updateVideoLayout: Video size is not known yet"
b(r2)
L6e:
int r2 = r8.m
if (r2 != r0) goto L76
int r2 = r8.n
if (r2 == r1) goto La1
L76:
boolean r2 = com.unity3d.player.p.a
if (r2 == 0) goto L93
java.lang.StringBuilder r2 = new java.lang.StringBuilder
java.lang.String r3 = "frameWidth = "
r2.<init>(r3)
r2.append(r0)
java.lang.String r3 = "; frameHeight = "
r2.append(r3)
r2.append(r1)
java.lang.String r2 = r2.toString()
b(r2)
L93:
android.widget.FrameLayout$LayoutParams r2 = new android.widget.FrameLayout$LayoutParams
r3 = 17
r2.<init>(r0, r1, r3)
android.widget.FrameLayout r0 = r8.k
android.view.SurfaceView r1 = r8.c
r0.updateViewLayout(r1, r2)
La1:
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.unity3d.player.p.updateVideoLayout():void");
}
}

View File

@@ -0,0 +1,191 @@
package com.unity3d.player;
import android.app.Activity;
import android.content.Context;
import com.unity3d.player.p;
import java.util.concurrent.Semaphore;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/* loaded from: classes2.dex */
final class q {
private UnityPlayer a;
private a c;
private Context b = null;
private final Semaphore d = new Semaphore(0);
private final Lock e = new ReentrantLock();
private p f = null;
private int g = 2;
private boolean h = false;
private boolean i = false;
/* renamed from: com.unity3d.player.q$1, reason: invalid class name */
final class AnonymousClass1 implements Runnable {
final /* synthetic */ String a;
final /* synthetic */ int b;
final /* synthetic */ int c;
final /* synthetic */ int d;
final /* synthetic */ boolean e;
final /* synthetic */ long f;
final /* synthetic */ long g;
AnonymousClass1(String str, int i, int i2, int i3, boolean z, long j, long j2) {
this.a = str;
this.b = i;
this.c = i2;
this.d = i3;
this.e = z;
this.f = j;
this.g = j2;
}
@Override // java.lang.Runnable
public final void run() {
if (q.this.f != null) {
g.Log(5, "Video already playing");
q.this.g = 2;
q.this.d.release();
} else {
q qVar = q.this;
qVar.f = new p(qVar.b, this.a, this.b, this.c, this.d, this.e, this.f, this.g, new p.a() { // from class: com.unity3d.player.q.1.1
@Override // com.unity3d.player.p.a
public final void a(int i) {
q.this.e.lock();
q.this.g = i;
if (i == 3 && q.this.i) {
q.this.runOnUiThread(new Runnable() { // from class: com.unity3d.player.q.1.1.1
@Override // java.lang.Runnable
public final void run() {
q.this.d();
q.this.a.resume();
}
});
}
if (i != 0) {
q.this.d.release();
}
q.this.e.unlock();
}
});
if (q.this.f != null) {
q.this.a.addView(q.this.f);
}
}
}
}
public interface a {
void a();
}
q(UnityPlayer unityPlayer) {
this.a = null;
this.a = unityPlayer;
}
/* JADX INFO: Access modifiers changed from: private */
public void d() {
p pVar = this.f;
if (pVar != null) {
this.a.removeViewFromPlayer(pVar);
this.i = false;
this.f.destroyPlayer();
this.f = null;
a aVar = this.c;
if (aVar != null) {
aVar.a();
}
}
}
static /* synthetic */ boolean h(q qVar) {
qVar.i = true;
return true;
}
public final void a() {
this.e.lock();
p pVar = this.f;
if (pVar != null) {
if (this.g == 0) {
pVar.CancelOnPrepare();
} else if (this.i) {
this.h = pVar.a();
if (!this.h) {
this.f.pause();
}
}
}
this.e.unlock();
}
public final boolean a(Context context, String str, int i, int i2, int i3, boolean z, long j, long j2, a aVar) {
this.e.lock();
this.c = aVar;
this.b = context;
this.d.drainPermits();
this.g = 2;
runOnUiThread(new AnonymousClass1(str, i, i2, i3, z, j, j2));
boolean z2 = false;
try {
this.e.unlock();
this.d.acquire();
this.e.lock();
if (this.g != 2) {
z2 = true;
}
} catch (InterruptedException unused) {
}
runOnUiThread(new Runnable() { // from class: com.unity3d.player.q.2
@Override // java.lang.Runnable
public final void run() {
q.this.a.pause();
}
});
runOnUiThread((!z2 || this.g == 3) ? new Runnable() { // from class: com.unity3d.player.q.4
@Override // java.lang.Runnable
public final void run() {
q.this.d();
q.this.a.resume();
}
} : new Runnable() { // from class: com.unity3d.player.q.3
@Override // java.lang.Runnable
public final void run() {
if (q.this.f != null) {
q.this.a.addViewToPlayer(q.this.f, true);
q.h(q.this);
q.this.f.requestFocus();
}
}
});
this.e.unlock();
return z2;
}
public final void b() {
this.e.lock();
p pVar = this.f;
if (pVar != null && this.i && !this.h) {
pVar.start();
}
this.e.unlock();
}
public final void c() {
this.e.lock();
p pVar = this.f;
if (pVar != null) {
pVar.updateVideoLayout();
}
this.e.unlock();
}
protected final void runOnUiThread(Runnable runnable) {
Context context = this.b;
if (context instanceof Activity) {
((Activity) context).runOnUiThread(runnable);
} else {
g.Log(5, "Not running from an Activity; Ignoring execution request...");
}
}
}