- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
74 lines
2.6 KiB
Java
74 lines
2.6 KiB
Java
package com.google.vr.dynamite.client;
|
|
|
|
import android.os.IBinder;
|
|
import java.lang.reflect.Field;
|
|
|
|
@UsedByReflection
|
|
/* loaded from: classes3.dex */
|
|
public final class ObjectWrapper<T> extends c {
|
|
|
|
@UsedByReflection
|
|
private final T wrappedObject;
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public ObjectWrapper(Object obj) {
|
|
this.wrappedObject = obj;
|
|
}
|
|
|
|
public static IObjectWrapper b(Object obj) {
|
|
return new ObjectWrapper(obj);
|
|
}
|
|
|
|
@UsedByReflection
|
|
public static <T> T unwrap(IObjectWrapper iObjectWrapper, Class<T> cls) {
|
|
if (iObjectWrapper == null) {
|
|
return null;
|
|
}
|
|
if (iObjectWrapper instanceof ObjectWrapper) {
|
|
return ((ObjectWrapper) iObjectWrapper).wrappedObject;
|
|
}
|
|
IBinder asBinder = iObjectWrapper.asBinder();
|
|
Field[] declaredFields = asBinder.getClass().getDeclaredFields();
|
|
int length = declaredFields.length;
|
|
int i = 0;
|
|
Field field = null;
|
|
while (true) {
|
|
if (i >= length) {
|
|
break;
|
|
}
|
|
Field field2 = declaredFields[i];
|
|
if (!field2.isSynthetic()) {
|
|
if (field != null) {
|
|
field = null;
|
|
break;
|
|
}
|
|
field = field2;
|
|
}
|
|
i++;
|
|
}
|
|
if (field == null) {
|
|
throw new IllegalArgumentException("The concrete class implementing IObjectWrapper must have exactly *one* declared private field for the wrapped object. Preferably, this is an instance of the ObjectWrapper<T> class.");
|
|
}
|
|
if (field.isAccessible()) {
|
|
throw new IllegalArgumentException("The concrete class implementing IObjectWrapper must have exactly one declared *private* field for the wrapped object. Preferably, this is an instance of the ObjectWrapper<T> class.");
|
|
}
|
|
field.setAccessible(true);
|
|
try {
|
|
Object obj = field.get(asBinder);
|
|
if (obj == null) {
|
|
return null;
|
|
}
|
|
if (cls.isInstance(obj)) {
|
|
return cls.cast(obj);
|
|
}
|
|
throw new IllegalArgumentException("remoteBinder is the wrong class.");
|
|
} catch (IllegalAccessException e) {
|
|
throw new IllegalArgumentException("Could not access the field in remoteBinder.", e);
|
|
} catch (IllegalArgumentException e2) {
|
|
throw new IllegalArgumentException("remoteBinder is the wrong class.", e2);
|
|
} catch (NullPointerException e3) {
|
|
throw new IllegalArgumentException("Binder object is null.", e3);
|
|
}
|
|
}
|
|
}
|