29 lines
1.1 KiB
Java
29 lines
1.1 KiB
Java
|
package com.google.android.gms.measurement.internal;
|
||
|
|
||
|
import android.os.Bundle;
|
||
|
import com.google.android.gms.measurement.api.AppMeasurementSdk;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class zzgr {
|
||
|
public static <T> T zza(Bundle bundle, String str, Class<T> cls, T t) {
|
||
|
T t2 = (T) bundle.get(str);
|
||
|
if (t2 == null) {
|
||
|
return t;
|
||
|
}
|
||
|
if (cls.isAssignableFrom(t2.getClass())) {
|
||
|
return t2;
|
||
|
}
|
||
|
throw new IllegalStateException(String.format("Invalid conditional user property field type. '%s' expected [%s] but was [%s]", str, cls.getCanonicalName(), t2.getClass().getCanonicalName()));
|
||
|
}
|
||
|
|
||
|
public static void zzb(Bundle bundle, Object obj) {
|
||
|
if (obj instanceof Double) {
|
||
|
bundle.putDouble(AppMeasurementSdk.ConditionalUserProperty.VALUE, ((Double) obj).doubleValue());
|
||
|
} else if (obj instanceof Long) {
|
||
|
bundle.putLong(AppMeasurementSdk.ConditionalUserProperty.VALUE, ((Long) obj).longValue());
|
||
|
} else {
|
||
|
bundle.putString(AppMeasurementSdk.ConditionalUserProperty.VALUE, obj.toString());
|
||
|
}
|
||
|
}
|
||
|
}
|