Files
rr3-apk/decompiled/sources/com/google/vr/dynamite/client/ObjectWrapper.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

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);
}
}
}