Files
rr3-apk/decompiled/sources/com/google/firebase/abt/AbtExperimentInfo.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

88 lines
4.0 KiB
Java

package com.google.firebase.abt;
import android.text.TextUtils;
import com.google.firebase.analytics.connector.AnalyticsConnector;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Locale;
import java.util.Map;
/* loaded from: classes3.dex */
public class AbtExperimentInfo {
public static final String[] ALL_REQUIRED_KEYS = {"experimentId", "experimentStartTime", "timeToLiveMillis", "triggerTimeoutMillis", "variantId"};
public static final DateFormat protoTimestampStringParser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US);
public final String experimentId;
public final Date experimentStartTime;
public final long timeToLiveInMillis;
public final String triggerEventName;
public final long triggerTimeoutInMillis;
public final String variantId;
public String getExperimentId() {
return this.experimentId;
}
public String getVariantId() {
return this.variantId;
}
public AbtExperimentInfo(String str, String str2, String str3, Date date, long j, long j2) {
this.experimentId = str;
this.variantId = str2;
this.triggerEventName = str3;
this.experimentStartTime = date;
this.triggerTimeoutInMillis = j;
this.timeToLiveInMillis = j2;
}
public static AbtExperimentInfo fromMap(Map map) {
validateExperimentInfoMap(map);
try {
return new AbtExperimentInfo((String) map.get("experimentId"), (String) map.get("variantId"), map.containsKey("triggerEvent") ? (String) map.get("triggerEvent") : "", protoTimestampStringParser.parse((String) map.get("experimentStartTime")), Long.parseLong((String) map.get("triggerTimeoutMillis")), Long.parseLong((String) map.get("timeToLiveMillis")));
} catch (NumberFormatException e) {
throw new AbtException("Could not process experiment: one of the durations could not be converted into a long.", e);
} catch (ParseException e2) {
throw new AbtException("Could not process experiment: parsing experiment start time failed.", e2);
}
}
public long getStartTimeInMillisSinceEpoch() {
return this.experimentStartTime.getTime();
}
public static void validateExperimentInfoMap(Map map) {
ArrayList arrayList = new ArrayList();
for (String str : ALL_REQUIRED_KEYS) {
if (!map.containsKey(str)) {
arrayList.add(str);
}
}
if (!arrayList.isEmpty()) {
throw new AbtException(String.format("The following keys are missing from the experiment info map: %s", arrayList));
}
}
public AnalyticsConnector.ConditionalUserProperty toConditionalUserProperty(String str) {
AnalyticsConnector.ConditionalUserProperty conditionalUserProperty = new AnalyticsConnector.ConditionalUserProperty();
conditionalUserProperty.origin = str;
conditionalUserProperty.creationTimestamp = getStartTimeInMillisSinceEpoch();
conditionalUserProperty.name = this.experimentId;
conditionalUserProperty.value = this.variantId;
conditionalUserProperty.triggerEventName = TextUtils.isEmpty(this.triggerEventName) ? null : this.triggerEventName;
conditionalUserProperty.triggerTimeout = this.triggerTimeoutInMillis;
conditionalUserProperty.timeToLive = this.timeToLiveInMillis;
return conditionalUserProperty;
}
public static AbtExperimentInfo fromConditionalUserProperty(AnalyticsConnector.ConditionalUserProperty conditionalUserProperty) {
String str = conditionalUserProperty.triggerEventName;
if (str == null) {
str = "";
}
return new AbtExperimentInfo(conditionalUserProperty.name, String.valueOf(conditionalUserProperty.value), str, new Date(conditionalUserProperty.creationTimestamp), conditionalUserProperty.triggerTimeout, conditionalUserProperty.timeToLive);
}
}