207 lines
7.3 KiB
Java
207 lines
7.3 KiB
Java
|
package com.google.android.gms.clearcut;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.content.pm.PackageManager;
|
||
|
import com.google.android.gms.common.api.Api;
|
||
|
import com.google.android.gms.common.api.GoogleApiClient;
|
||
|
import com.google.android.gms.common.api.PendingResults;
|
||
|
import com.google.android.gms.common.api.Status;
|
||
|
import com.google.android.gms.common.internal.Preconditions;
|
||
|
import com.google.android.gms.common.util.Clock;
|
||
|
import com.google.android.gms.common.util.DefaultClock;
|
||
|
import com.google.android.gms.internal.clearcut.zzaa;
|
||
|
import com.google.android.gms.internal.clearcut.zzge;
|
||
|
import com.google.android.gms.internal.clearcut.zzha;
|
||
|
import com.google.android.gms.internal.clearcut.zzj;
|
||
|
import com.google.android.gms.internal.clearcut.zzp;
|
||
|
import com.google.android.gms.internal.clearcut.zzr;
|
||
|
import com.google.android.gms.phenotype.ExperimentTokens;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.TimeZone;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class ClearcutLogger {
|
||
|
|
||
|
@Deprecated
|
||
|
public static final Api<Api.ApiOptions.NoOptions> API;
|
||
|
private static final Api.AbstractClientBuilder<zzj, Api.ApiOptions.NoOptions> CLIENT_BUILDER;
|
||
|
private static final Api.ClientKey<zzj> CLIENT_KEY;
|
||
|
private static final ExperimentTokens[] zze;
|
||
|
private static final String[] zzf;
|
||
|
private static final byte[][] zzg;
|
||
|
private final String packageName;
|
||
|
private final Context zzh;
|
||
|
private final int zzi;
|
||
|
private String zzj;
|
||
|
private int zzk;
|
||
|
private String zzl;
|
||
|
private String zzm;
|
||
|
private final boolean zzn;
|
||
|
private zzge.zzv.zzb zzo;
|
||
|
private final com.google.android.gms.clearcut.zzb zzp;
|
||
|
private final Clock zzq;
|
||
|
private zzc zzr;
|
||
|
private final zza zzs;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public interface zza {
|
||
|
boolean zza(zze zzeVar);
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public interface zzb {
|
||
|
byte[] zza();
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public static final class zzc {
|
||
|
}
|
||
|
|
||
|
public final LogEventBuilder newEvent(byte[] bArr) {
|
||
|
return new LogEventBuilder(this, bArr, (com.google.android.gms.clearcut.zza) null);
|
||
|
}
|
||
|
|
||
|
static /* synthetic */ int[] zzb(ArrayList arrayList) {
|
||
|
return zza((ArrayList<Integer>) null);
|
||
|
}
|
||
|
|
||
|
private static int[] zza(ArrayList<Integer> arrayList) {
|
||
|
if (arrayList == null) {
|
||
|
return null;
|
||
|
}
|
||
|
int[] iArr = new int[arrayList.size()];
|
||
|
int size = arrayList.size();
|
||
|
int i = 0;
|
||
|
int i2 = 0;
|
||
|
while (i < size) {
|
||
|
Integer num = arrayList.get(i);
|
||
|
i++;
|
||
|
iArr[i2] = num.intValue();
|
||
|
i2++;
|
||
|
}
|
||
|
return iArr;
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public class LogEventBuilder {
|
||
|
private final zzha zzaa;
|
||
|
private boolean zzab;
|
||
|
private final ClearcutLogger zzac;
|
||
|
private String zzj;
|
||
|
private int zzk;
|
||
|
private String zzl;
|
||
|
private String zzm;
|
||
|
private zzge.zzv.zzb zzo;
|
||
|
private final zzb zzt;
|
||
|
private ArrayList<Integer> zzu;
|
||
|
private ArrayList<String> zzv;
|
||
|
private ArrayList<Integer> zzw;
|
||
|
private ArrayList<ExperimentTokens> zzx;
|
||
|
private ArrayList<byte[]> zzy;
|
||
|
private boolean zzz;
|
||
|
|
||
|
public LogEventBuilder setEventCode(int i) {
|
||
|
this.zzaa.zzbji = i;
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public void log() {
|
||
|
if (this.zzab) {
|
||
|
throw new IllegalStateException("do not reuse LogEventBuilder");
|
||
|
}
|
||
|
this.zzab = true;
|
||
|
zze zzeVar = new zze(new zzr(this.zzac.packageName, this.zzac.zzi, this.zzk, this.zzj, this.zzl, this.zzm, this.zzac.zzn, this.zzo), this.zzaa, null, null, ClearcutLogger.zzb((ArrayList) null), null, ClearcutLogger.zzb((ArrayList) null), null, null, this.zzz);
|
||
|
if (this.zzac.zzs.zza(zzeVar)) {
|
||
|
this.zzac.zzp.zzb(zzeVar);
|
||
|
} else {
|
||
|
PendingResults.immediatePendingResult(Status.RESULT_SUCCESS, (GoogleApiClient) null);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* synthetic */ LogEventBuilder(ClearcutLogger clearcutLogger, byte[] bArr, com.google.android.gms.clearcut.zza zzaVar) {
|
||
|
this(clearcutLogger, bArr);
|
||
|
}
|
||
|
|
||
|
private LogEventBuilder(ClearcutLogger clearcutLogger, byte[] bArr, zzb zzbVar) {
|
||
|
this.zzac = clearcutLogger;
|
||
|
this.zzk = clearcutLogger.zzk;
|
||
|
this.zzj = clearcutLogger.zzj;
|
||
|
this.zzl = clearcutLogger.zzl;
|
||
|
this.zzm = null;
|
||
|
this.zzo = clearcutLogger.zzo;
|
||
|
this.zzu = null;
|
||
|
this.zzv = null;
|
||
|
this.zzw = null;
|
||
|
this.zzx = null;
|
||
|
this.zzy = null;
|
||
|
this.zzz = true;
|
||
|
zzha zzhaVar = new zzha();
|
||
|
this.zzaa = zzhaVar;
|
||
|
this.zzab = false;
|
||
|
this.zzl = clearcutLogger.zzl;
|
||
|
this.zzm = null;
|
||
|
zzhaVar.zzbkc = zzaa.zze(clearcutLogger.zzh);
|
||
|
zzhaVar.zzbjf = clearcutLogger.zzq.currentTimeMillis();
|
||
|
zzhaVar.zzbjg = clearcutLogger.zzq.elapsedRealtime();
|
||
|
zzc unused = clearcutLogger.zzr;
|
||
|
zzhaVar.zzbju = TimeZone.getDefault().getOffset(zzhaVar.zzbjf) / 1000;
|
||
|
if (bArr != null) {
|
||
|
zzhaVar.zzbjp = bArr;
|
||
|
}
|
||
|
this.zzt = null;
|
||
|
}
|
||
|
|
||
|
private LogEventBuilder(ClearcutLogger clearcutLogger, byte[] bArr) {
|
||
|
this(clearcutLogger, bArr, (zzb) null);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private static int zza(Context context) {
|
||
|
try {
|
||
|
return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode;
|
||
|
} catch (PackageManager.NameNotFoundException unused) {
|
||
|
return 0;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static ClearcutLogger anonymousLogger(Context context, String str) {
|
||
|
return new ClearcutLogger(context, -1, str, null, null, true, com.google.android.gms.internal.clearcut.zze.zzb(context), DefaultClock.getInstance(), null, new zzp(context));
|
||
|
}
|
||
|
|
||
|
public ClearcutLogger(Context context, String str, String str2) {
|
||
|
this(context, -1, str, str2, null, false, com.google.android.gms.internal.clearcut.zze.zzb(context), DefaultClock.getInstance(), null, new zzp(context));
|
||
|
}
|
||
|
|
||
|
private ClearcutLogger(Context context, int i, String str, String str2, String str3, boolean z, com.google.android.gms.clearcut.zzb zzbVar, Clock clock, zzc zzcVar, zza zzaVar) {
|
||
|
this.zzk = -1;
|
||
|
this.zzo = zzge.zzv.zzb.DEFAULT;
|
||
|
this.zzh = context;
|
||
|
this.packageName = context.getPackageName();
|
||
|
this.zzi = zza(context);
|
||
|
this.zzk = -1;
|
||
|
this.zzj = str;
|
||
|
this.zzl = str2;
|
||
|
this.zzm = null;
|
||
|
this.zzn = z;
|
||
|
this.zzp = zzbVar;
|
||
|
this.zzq = clock;
|
||
|
this.zzr = new zzc();
|
||
|
this.zzo = zzge.zzv.zzb.DEFAULT;
|
||
|
this.zzs = zzaVar;
|
||
|
if (z) {
|
||
|
Preconditions.checkArgument(str2 == null, "can't be anonymous with an upload account");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static {
|
||
|
Api.ClientKey<zzj> clientKey = new Api.ClientKey<>();
|
||
|
CLIENT_KEY = clientKey;
|
||
|
com.google.android.gms.clearcut.zza zzaVar = new com.google.android.gms.clearcut.zza();
|
||
|
CLIENT_BUILDER = zzaVar;
|
||
|
API = new Api<>("ClearcutLogger.API", zzaVar, clientKey);
|
||
|
zze = new ExperimentTokens[0];
|
||
|
zzf = new String[0];
|
||
|
zzg = new byte[0];
|
||
|
}
|
||
|
}
|