- 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
151 lines
6.0 KiB
Java
151 lines
6.0 KiB
Java
package com.google.firebase.abt;
|
|
|
|
import android.content.Context;
|
|
import com.google.firebase.analytics.connector.AnalyticsConnector;
|
|
import com.google.firebase.inject.Provider;
|
|
import java.util.ArrayDeque;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public class FirebaseABTesting {
|
|
public final Provider analyticsConnector;
|
|
public Integer maxUserProperties = null;
|
|
public final String originService;
|
|
|
|
public FirebaseABTesting(Context context, Provider provider, String str) {
|
|
this.analyticsConnector = provider;
|
|
this.originService = str;
|
|
}
|
|
|
|
public void replaceAllExperiments(List list) {
|
|
throwAbtExceptionIfAnalyticsIsNull();
|
|
if (list == null) {
|
|
throw new IllegalArgumentException("The replacementExperiments list is null.");
|
|
}
|
|
replaceAllExperimentsWith(convertMapsToExperimentInfos(list));
|
|
}
|
|
|
|
public void removeAllExperiments() {
|
|
throwAbtExceptionIfAnalyticsIsNull();
|
|
removeExperiments(getAllExperimentsInAnalytics());
|
|
}
|
|
|
|
public List getAllExperiments() {
|
|
throwAbtExceptionIfAnalyticsIsNull();
|
|
List allExperimentsInAnalytics = getAllExperimentsInAnalytics();
|
|
ArrayList arrayList = new ArrayList();
|
|
Iterator it = allExperimentsInAnalytics.iterator();
|
|
while (it.hasNext()) {
|
|
arrayList.add(AbtExperimentInfo.fromConditionalUserProperty((AnalyticsConnector.ConditionalUserProperty) it.next()));
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
public final void replaceAllExperimentsWith(List list) {
|
|
if (list.isEmpty()) {
|
|
removeAllExperiments();
|
|
return;
|
|
}
|
|
List allExperiments = getAllExperiments();
|
|
removeExperiments(getExperimentsToRemove(allExperiments, list));
|
|
addExperiments(getExperimentsToAdd(list, allExperiments));
|
|
}
|
|
|
|
public final ArrayList getExperimentsToRemove(List list, List list2) {
|
|
ArrayList arrayList = new ArrayList();
|
|
Iterator it = list.iterator();
|
|
while (it.hasNext()) {
|
|
AbtExperimentInfo abtExperimentInfo = (AbtExperimentInfo) it.next();
|
|
if (!experimentsListContainsExperiment(list2, abtExperimentInfo)) {
|
|
arrayList.add(abtExperimentInfo.toConditionalUserProperty(this.originService));
|
|
}
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
public final ArrayList getExperimentsToAdd(List list, List list2) {
|
|
ArrayList arrayList = new ArrayList();
|
|
Iterator it = list.iterator();
|
|
while (it.hasNext()) {
|
|
AbtExperimentInfo abtExperimentInfo = (AbtExperimentInfo) it.next();
|
|
if (!experimentsListContainsExperiment(list2, abtExperimentInfo)) {
|
|
arrayList.add(abtExperimentInfo);
|
|
}
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
public final boolean experimentsListContainsExperiment(List list, AbtExperimentInfo abtExperimentInfo) {
|
|
String experimentId = abtExperimentInfo.getExperimentId();
|
|
String variantId = abtExperimentInfo.getVariantId();
|
|
Iterator it = list.iterator();
|
|
while (it.hasNext()) {
|
|
AbtExperimentInfo abtExperimentInfo2 = (AbtExperimentInfo) it.next();
|
|
if (abtExperimentInfo2.getExperimentId().equals(experimentId) && abtExperimentInfo2.getVariantId().equals(variantId)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final void addExperiments(List list) {
|
|
ArrayDeque arrayDeque = new ArrayDeque(getAllExperimentsInAnalytics());
|
|
int maxUserPropertiesInAnalytics = getMaxUserPropertiesInAnalytics();
|
|
Iterator it = list.iterator();
|
|
while (it.hasNext()) {
|
|
AbtExperimentInfo abtExperimentInfo = (AbtExperimentInfo) it.next();
|
|
while (arrayDeque.size() >= maxUserPropertiesInAnalytics) {
|
|
removeExperimentFromAnalytics(((AnalyticsConnector.ConditionalUserProperty) arrayDeque.pollFirst()).name);
|
|
}
|
|
AnalyticsConnector.ConditionalUserProperty conditionalUserProperty = abtExperimentInfo.toConditionalUserProperty(this.originService);
|
|
addExperimentToAnalytics(conditionalUserProperty);
|
|
arrayDeque.offer(conditionalUserProperty);
|
|
}
|
|
}
|
|
|
|
public final void removeExperiments(Collection collection) {
|
|
Iterator it = collection.iterator();
|
|
while (it.hasNext()) {
|
|
removeExperimentFromAnalytics(((AnalyticsConnector.ConditionalUserProperty) it.next()).name);
|
|
}
|
|
}
|
|
|
|
public static List convertMapsToExperimentInfos(List list) {
|
|
ArrayList arrayList = new ArrayList();
|
|
Iterator it = list.iterator();
|
|
while (it.hasNext()) {
|
|
arrayList.add(AbtExperimentInfo.fromMap((Map) it.next()));
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
public final void addExperimentToAnalytics(AnalyticsConnector.ConditionalUserProperty conditionalUserProperty) {
|
|
((AnalyticsConnector) this.analyticsConnector.get()).setConditionalUserProperty(conditionalUserProperty);
|
|
}
|
|
|
|
public final void throwAbtExceptionIfAnalyticsIsNull() {
|
|
if (this.analyticsConnector.get() == null) {
|
|
throw new AbtException("The Analytics SDK is not available. Please check that the Analytics SDK is included in your app dependencies.");
|
|
}
|
|
}
|
|
|
|
public final void removeExperimentFromAnalytics(String str) {
|
|
((AnalyticsConnector) this.analyticsConnector.get()).clearConditionalUserProperty(str, null, null);
|
|
}
|
|
|
|
public final int getMaxUserPropertiesInAnalytics() {
|
|
if (this.maxUserProperties == null) {
|
|
this.maxUserProperties = Integer.valueOf(((AnalyticsConnector) this.analyticsConnector.get()).getMaxUserProperties(this.originService));
|
|
}
|
|
return this.maxUserProperties.intValue();
|
|
}
|
|
|
|
public final List getAllExperimentsInAnalytics() {
|
|
return ((AnalyticsConnector) this.analyticsConnector.get()).getConditionalUserProperties(this.originService, "");
|
|
}
|
|
}
|