231 lines
6.8 KiB
Java
231 lines
6.8 KiB
Java
package com.google.android.gms.measurement.internal;
|
|
|
|
import android.content.SharedPreferences;
|
|
import android.os.Build;
|
|
import android.text.TextUtils;
|
|
import android.util.Pair;
|
|
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
|
|
import java.math.BigInteger;
|
|
import java.security.MessageDigest;
|
|
import java.util.Locale;
|
|
|
|
/* loaded from: classes.dex */
|
|
final class zzbd extends zzcs {
|
|
static final Pair<String, Long> v = new Pair<>("", 0L);
|
|
private SharedPreferences c;
|
|
public zzbh d;
|
|
public final zzbg e;
|
|
public final zzbg f;
|
|
public final zzbg g;
|
|
public final zzbg h;
|
|
public final zzbg i;
|
|
public final zzbg j;
|
|
public final zzbg k;
|
|
public final zzbi l;
|
|
private String m;
|
|
private boolean n;
|
|
private long o;
|
|
public final zzbg p;
|
|
public final zzbg q;
|
|
public final zzbf r;
|
|
public final zzbg s;
|
|
public final zzbg t;
|
|
public boolean u;
|
|
|
|
zzbd(zzbw zzbwVar) {
|
|
super(zzbwVar);
|
|
this.e = new zzbg(this, "last_upload", 0L);
|
|
this.f = new zzbg(this, "last_upload_attempt", 0L);
|
|
this.g = new zzbg(this, "backoff", 0L);
|
|
this.h = new zzbg(this, "last_delete_stale", 0L);
|
|
this.p = new zzbg(this, "time_before_start", 10000L);
|
|
this.q = new zzbg(this, "session_timeout", 1800000L);
|
|
this.r = new zzbf(this, "start_new_session", true);
|
|
this.s = new zzbg(this, "last_pause_time", 0L);
|
|
this.t = new zzbg(this, "time_active", 0L);
|
|
this.i = new zzbg(this, "midnight_offset", 0L);
|
|
this.j = new zzbg(this, "first_open_time", 0L);
|
|
this.k = new zzbg(this, "app_install_time", 0L);
|
|
this.l = new zzbi(this, "app_instance_id", null);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public final SharedPreferences B() {
|
|
f();
|
|
o();
|
|
return this.c;
|
|
}
|
|
|
|
final boolean A() {
|
|
return this.c.contains("deferred_analytics_collection");
|
|
}
|
|
|
|
final Pair<String, Boolean> a(String str) {
|
|
f();
|
|
long b = d().b();
|
|
String str2 = this.m;
|
|
if (str2 != null && b < this.o) {
|
|
return new Pair<>(str2, Boolean.valueOf(this.n));
|
|
}
|
|
this.o = b + m().a(str, zzai.l);
|
|
AdvertisingIdClient.setShouldSkipGmsCoreVersionCheck(true);
|
|
try {
|
|
AdvertisingIdClient.Info advertisingIdInfo = AdvertisingIdClient.getAdvertisingIdInfo(b());
|
|
if (advertisingIdInfo != null) {
|
|
this.m = advertisingIdInfo.getId();
|
|
this.n = advertisingIdInfo.isLimitAdTrackingEnabled();
|
|
}
|
|
if (this.m == null) {
|
|
this.m = "";
|
|
}
|
|
} catch (Exception e) {
|
|
e().A().a("Unable to get advertising id", e);
|
|
this.m = "";
|
|
}
|
|
AdvertisingIdClient.setShouldSkipGmsCoreVersionCheck(false);
|
|
return new Pair<>(this.m, Boolean.valueOf(this.n));
|
|
}
|
|
|
|
final String b(String str) {
|
|
f();
|
|
String str2 = (String) a(str).first;
|
|
MessageDigest x = zzfy.x();
|
|
if (x == null) {
|
|
return null;
|
|
}
|
|
return String.format(Locale.US, "%032X", new BigInteger(1, x.digest(str2.getBytes())));
|
|
}
|
|
|
|
final void c(String str) {
|
|
f();
|
|
SharedPreferences.Editor edit = B().edit();
|
|
edit.putString("gmp_app_id", str);
|
|
edit.apply();
|
|
}
|
|
|
|
final void d(String str) {
|
|
f();
|
|
SharedPreferences.Editor edit = B().edit();
|
|
edit.putString("admob_app_id", str);
|
|
edit.apply();
|
|
}
|
|
|
|
@Override // com.google.android.gms.measurement.internal.zzcs
|
|
protected final boolean q() {
|
|
return true;
|
|
}
|
|
|
|
@Override // com.google.android.gms.measurement.internal.zzcs
|
|
protected final void r() {
|
|
this.c = b().getSharedPreferences("com.google.android.gms.measurement.prefs", 0);
|
|
this.u = this.c.getBoolean("has_been_opened", false);
|
|
if (!this.u) {
|
|
SharedPreferences.Editor edit = this.c.edit();
|
|
edit.putBoolean("has_been_opened", true);
|
|
edit.apply();
|
|
}
|
|
this.d = new zzbh(this, "health_monitor", Math.max(0L, zzai.m.a().longValue()));
|
|
}
|
|
|
|
final String t() {
|
|
f();
|
|
return B().getString("gmp_app_id", null);
|
|
}
|
|
|
|
final String u() {
|
|
f();
|
|
return B().getString("admob_app_id", null);
|
|
}
|
|
|
|
final Boolean v() {
|
|
f();
|
|
if (B().contains("use_service")) {
|
|
return Boolean.valueOf(B().getBoolean("use_service", false));
|
|
}
|
|
return null;
|
|
}
|
|
|
|
final void w() {
|
|
f();
|
|
e().B().a("Clearing collection preferences.");
|
|
if (m().a(zzai.m0)) {
|
|
Boolean x = x();
|
|
SharedPreferences.Editor edit = B().edit();
|
|
edit.clear();
|
|
edit.apply();
|
|
if (x != null) {
|
|
a(x.booleanValue());
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
boolean contains = B().contains("measurement_enabled");
|
|
boolean c = contains ? c(true) : true;
|
|
SharedPreferences.Editor edit2 = B().edit();
|
|
edit2.clear();
|
|
edit2.apply();
|
|
if (contains) {
|
|
a(c);
|
|
}
|
|
}
|
|
|
|
final Boolean x() {
|
|
f();
|
|
if (B().contains("measurement_enabled")) {
|
|
return Boolean.valueOf(B().getBoolean("measurement_enabled", true));
|
|
}
|
|
return null;
|
|
}
|
|
|
|
protected final String y() {
|
|
f();
|
|
String string = B().getString("previous_os_version", null);
|
|
i().o();
|
|
String str = Build.VERSION.RELEASE;
|
|
if (!TextUtils.isEmpty(str) && !str.equals(string)) {
|
|
SharedPreferences.Editor edit = B().edit();
|
|
edit.putString("previous_os_version", str);
|
|
edit.apply();
|
|
}
|
|
return string;
|
|
}
|
|
|
|
final boolean z() {
|
|
f();
|
|
return B().getBoolean("deferred_analytics_collection", false);
|
|
}
|
|
|
|
final void b(boolean z) {
|
|
f();
|
|
e().B().a("Setting useService", Boolean.valueOf(z));
|
|
SharedPreferences.Editor edit = B().edit();
|
|
edit.putBoolean("use_service", z);
|
|
edit.apply();
|
|
}
|
|
|
|
final boolean c(boolean z) {
|
|
f();
|
|
return B().getBoolean("measurement_enabled", z);
|
|
}
|
|
|
|
final void d(boolean z) {
|
|
f();
|
|
e().B().a("Updating deferred analytics collection", Boolean.valueOf(z));
|
|
SharedPreferences.Editor edit = B().edit();
|
|
edit.putBoolean("deferred_analytics_collection", z);
|
|
edit.apply();
|
|
}
|
|
|
|
final void a(boolean z) {
|
|
f();
|
|
e().B().a("Setting measurementEnabled", Boolean.valueOf(z));
|
|
SharedPreferences.Editor edit = B().edit();
|
|
edit.putBoolean("measurement_enabled", z);
|
|
edit.apply();
|
|
}
|
|
|
|
final boolean a(long j) {
|
|
return j - this.q.a() > this.s.a();
|
|
}
|
|
}
|