Files
rr3-apk/decompiled/sources/com/google/android/gms/dynamic/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

62 lines
2.1 KiB
Java

package com.google.android.gms.dynamic;
import android.os.IBinder;
import androidx.annotation.NonNull;
import com.google.android.gms.common.annotation.KeepForSdk;
import com.google.android.gms.common.internal.Preconditions;
import com.google.android.gms.common.util.RetainForClient;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.errorprone.annotations.ResultIgnorabilityUnspecified;
import java.lang.reflect.Field;
@RetainForClient
@KeepForSdk
/* loaded from: classes2.dex */
public final class ObjectWrapper<T> extends IObjectWrapper.Stub {
private final Object zza;
private ObjectWrapper(Object obj) {
this.zza = obj;
}
@NonNull
@ResultIgnorabilityUnspecified
@KeepForSdk
public static <T> T unwrap(@NonNull IObjectWrapper iObjectWrapper) {
if (iObjectWrapper instanceof ObjectWrapper) {
return (T) ((ObjectWrapper) iObjectWrapper).zza;
}
IBinder asBinder = iObjectWrapper.asBinder();
Field[] declaredFields = asBinder.getClass().getDeclaredFields();
Field field = null;
int i = 0;
for (Field field2 : declaredFields) {
if (!field2.isSynthetic()) {
i++;
field = field2;
}
}
if (i != 1) {
throw new IllegalArgumentException("Unexpected number of IObjectWrapper declared fields: " + declaredFields.length);
}
Preconditions.checkNotNull(field);
if (field.isAccessible()) {
throw new IllegalArgumentException("IObjectWrapper declared field not private!");
}
field.setAccessible(true);
try {
return (T) field.get(asBinder);
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("Could not access the field in remoteBinder.", e);
} catch (NullPointerException e2) {
throw new IllegalArgumentException("Binder object is null.", e2);
}
}
@NonNull
@KeepForSdk
public static <T> IObjectWrapper wrap(@NonNull T t) {
return new ObjectWrapper(t);
}
}