discord-jadx/app/src/main/java/c/i/a/f/i/b/q7.java

943 lines
42 KiB
Java

package c.i.a.f.i.b;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.Signature;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabaseLockedException;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteFullException;
import android.os.Looper;
import android.os.Parcel;
import android.os.RemoteException;
import android.os.SystemClock;
import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
import c.i.a.f.e.c;
import c.i.a.f.e.n.a;
import c.i.a.f.e.o.d;
import c.i.a.f.e.p.b;
import c.i.a.f.h.l.da;
import c.i.a.f.h.l.ob;
import c.i.a.f.h.l.rb;
import c.i.a.f.h.l.t8;
import com.airbnb.lottie.parser.AnimatableValueParser;
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelReader$ParseException;
import com.google.android.gms.measurement.internal.zzaq;
import com.google.android.gms.measurement.internal.zzku;
import com.google.android.gms.measurement.internal.zzn;
import com.google.android.gms.measurement.internal.zzz;
import java.lang.reflect.Method;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference;
/* compiled from: com.google.android.gms:play-services-measurement-impl@@18.0.0 */
public final class q7 extends a5 {
/* renamed from: c reason: collision with root package name */
public final k8 f1190c;
public i3 d;
public volatile Boolean e;
public final i f;
public final e9 g;
public final List<Runnable> h = new ArrayList();
public final i i;
public q7(u4 u4Var) {
super(u4Var);
this.g = new e9(u4Var.o);
this.f1190c = new k8(this);
this.f = new p7(this, u4Var);
this.i = new z7(this, u4Var);
}
public static void x(q7 q7Var, ComponentName componentName) {
q7Var.b();
if (q7Var.d != null) {
q7Var.d = null;
q7Var.g().n.b("Disconnected from device MeasurementService", componentName);
q7Var.b();
q7Var.C();
}
}
@WorkerThread
public final void A(AtomicReference<String> atomicReference) {
b();
t();
z(new v7(this, atomicReference, I(false)));
}
@WorkerThread
public final boolean B() {
b();
t();
return this.d != null;
}
@WorkerThread
public final void C() {
b();
t();
if (!B()) {
if (G()) {
k8 k8Var = this.f1190c;
k8Var.k.b();
Context context = k8Var.k.a.b;
synchronized (k8Var) {
if (k8Var.i) {
k8Var.k.g().n.a("Connection attempt already in progress");
} else if (k8Var.j == null || (!k8Var.j.e() && !k8Var.j.j())) {
k8Var.j = new r3(context, Looper.getMainLooper(), k8Var, k8Var);
k8Var.k.g().n.a("Connecting to remote service");
k8Var.i = true;
k8Var.j.q();
} else {
k8Var.k.g().n.a("Already awaiting connection attempt");
}
}
} else if (!this.a.h.C()) {
List<ResolveInfo> queryIntentServices = this.a.b.getPackageManager().queryIntentServices(new Intent().setClassName(this.a.b, "com.google.android.gms.measurement.AppMeasurementService"), 65536);
if (queryIntentServices != null && queryIntentServices.size() > 0) {
Intent intent = new Intent("com.google.android.gms.measurement.START");
intent.setComponent(new ComponentName(this.a.b, "com.google.android.gms.measurement.AppMeasurementService"));
k8 k8Var2 = this.f1190c;
k8Var2.k.b();
Context context2 = k8Var2.k.a.b;
a b = a.b();
synchronized (k8Var2) {
if (k8Var2.i) {
k8Var2.k.g().n.a("Connection attempt already in progress");
return;
}
k8Var2.k.g().n.a("Using local app measurement service");
k8Var2.i = true;
b.a(context2, intent, k8Var2.k.f1190c, 129);
return;
}
}
g().f.a("Unable to use remote or local measurement implementation. Please register the AppMeasurementService service in the app manifest");
}
}
}
@WorkerThread
public final void D() {
b();
t();
k8 k8Var = this.f1190c;
if (k8Var.j != null && (k8Var.j.j() || k8Var.j.e())) {
k8Var.j.h();
}
k8Var.j = null;
try {
a.b().c(this.a.b, this.f1190c);
} catch (IllegalArgumentException | IllegalStateException unused) {
}
this.d = null;
}
@WorkerThread
public final boolean E() {
b();
t();
if (!this.a.h.o(p.J0)) {
return false;
}
return !G() || e().y0() >= p.K0.a(null).intValue();
}
@WorkerThread
public final void F() {
b();
e9 e9Var = this.g;
Objects.requireNonNull((d) e9Var.a);
e9Var.b = SystemClock.elapsedRealtime();
this.f.b(p.J.a(null).longValue());
}
/* JADX WARNING: Removed duplicated region for block: B:38:0x00ea */
/* JADX WARNING: Removed duplicated region for block: B:43:0x0103 */
@WorkerThread
public final boolean G() {
boolean z2;
b();
t();
if (this.e == null) {
b();
t();
d4 l = l();
l.b();
boolean z3 = false;
Boolean valueOf = !l.w().contains("use_service") ? null : Boolean.valueOf(l.w().getBoolean("use_service", false));
boolean z4 = true;
if (valueOf == null || !valueOf.booleanValue()) {
n3 o = o();
o.t();
if (o.j != 1) {
g().n.a("Checking service availability");
t9 e = e();
Objects.requireNonNull(e);
int b = c.b.b(e.a.b, 12451000);
if (b != 0) {
if (b == 1) {
g().n.a("Service missing");
} else if (b != 2) {
if (b == 3) {
g().i.a("Service disabled");
} else if (b == 9) {
g().i.a("Service invalid");
} else if (b != 18) {
g().i.b("Unexpected service status", Integer.valueOf(b));
} else {
g().i.a("Service updating");
}
z4 = false;
} else {
g().m.a("Service container out of date");
if (e().y0() >= 17443) {
if (valueOf != null) {
z4 = false;
}
z2 = false;
if (!z4 || !this.a.h.C()) {
z3 = z2;
} else {
g().f.a("No way to upload. Consider using the full version of Analytics");
}
if (z3) {
d4 l2 = l();
l2.b();
SharedPreferences.Editor edit = l2.w().edit();
edit.putBoolean("use_service", z4);
edit.apply();
}
}
}
z2 = z4;
z4 = false;
if (!z4) {
}
z3 = z2;
if (z3) {
}
} else {
g().n.a("Service available");
}
}
z2 = true;
if (!z4) {
}
z3 = z2;
if (z3) {
}
}
this.e = Boolean.valueOf(z4);
}
return this.e.booleanValue();
}
@WorkerThread
public final void H() {
b();
g().n.b("Processing queued up service tasks", Integer.valueOf(this.h.size()));
for (Runnable runnable : this.h) {
try {
runnable.run();
} catch (Exception e) {
g().f.b("Task exception while flushing queue", e);
}
}
this.h.clear();
this.i.c();
}
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x0127: APUT
(r11v10 java.lang.Object[])
(0 ??[int, short, byte, char])
(wrap: android.content.Context : 0x0122: IGET (r10v17 android.content.Context) = (wrap: c.i.a.f.i.b.u4 : 0x0120: IGET (r10v16 c.i.a.f.i.b.u4) = (r1v0 c.i.a.f.i.b.n3) c.i.a.f.i.b.s5.a c.i.a.f.i.b.u4) c.i.a.f.i.b.u4.b android.content.Context)
*/
/* JADX WARNING: Removed duplicated region for block: B:56:0x017a */
/* JADX WARNING: Removed duplicated region for block: B:57:0x0181 */
/* JADX WARNING: Removed duplicated region for block: B:60:0x01ac */
/* JADX WARNING: Removed duplicated region for block: B:66:0x01e1 */
/* JADX WARNING: Removed duplicated region for block: B:67:0x01e4 */
/* JADX WARNING: Removed duplicated region for block: B:70:0x01fa */
/* JADX WARNING: Removed duplicated region for block: B:73:0x0212 */
/* JADX WARNING: Removed duplicated region for block: B:77:0x021e */
@Nullable
@WorkerThread
public final zzn I(boolean z2) {
boolean z3;
String str;
Long valueOf;
long j;
String str2;
String str3;
long j2;
List<String> list;
long j3;
n3 o = o();
String E = z2 ? g().E() : null;
o.b();
o.t();
String str4 = o.f1172c;
o.t();
String str5 = o.k;
o.t();
String str6 = o.d;
o.t();
long j4 = (long) o.e;
o.t();
String str7 = o.f;
o.t();
o.b();
if (o.g == 0) {
t9 t = o.a.t();
Context context = o.a.b;
String packageName = context.getPackageName();
t.b();
AnimatableValueParser.w(packageName);
PackageManager packageManager = context.getPackageManager();
MessageDigest x0 = t9.x0();
long j5 = -1;
if (x0 == null) {
t.g().f.a("Could not get MD5 instance");
} else {
if (packageManager != null) {
try {
if (!t.o0(context, packageName)) {
Signature[] signatureArr = b.a(context).b(t.a.b.getPackageName(), 64).signatures;
if (signatureArr == null || signatureArr.length <= 0) {
t.g().i.a("Could not get signatures");
} else {
j5 = t9.w(x0.digest(signatureArr[0].toByteArray()));
}
}
} catch (PackageManager.NameNotFoundException e) {
t.g().f.b("Package name not found", e);
}
}
j3 = 0;
o.g = j3;
}
j3 = j5;
o.g = j3;
}
long j6 = o.g;
boolean d = o.a.d();
boolean z4 = !o.l().w;
o.b();
if (o.a.d()) {
if (!((rb) ob.i.a()).a() || !o.a.h.o(p.l0)) {
try {
Class<?> loadClass = o.a.b.getClassLoader().loadClass("com.google.firebase.analytics.FirebaseAnalytics");
if (loadClass != null) {
try {
Method declaredMethod = loadClass.getDeclaredMethod("getInstance", Context.class);
Object[] objArr = new Object[1];
z3 = d;
try {
objArr[0] = o.a.b;
Object invoke = declaredMethod.invoke(null, objArr);
if (invoke == null) {
str = null;
} else {
try {
str = (String) loadClass.getDeclaredMethod("getFirebaseInstanceId", new Class[0]).invoke(invoke, new Object[0]);
} catch (Exception unused) {
o.g().k.a("Failed to retrieve Firebase Instance Id");
}
}
} catch (Exception unused2) {
o.g().j.a("Failed to obtain Firebase Analytics instance");
str = null;
u4 u4Var = o.a;
valueOf = Long.valueOf(u4Var.o().k.a());
if (valueOf.longValue() != 0) {
}
o.t();
int i = o.j;
boolean booleanValue = o.a.h.y().booleanValue();
Boolean w = o.a.h.w("google_analytics_ssaid_collection_enabled");
boolean booleanValue2 = Boolean.valueOf(w != null || w.booleanValue()).booleanValue();
d4 l = o.l();
l.b();
boolean z5 = l.w().getBoolean("deferred_analytics_collection", false);
o.t();
String str8 = o.l;
Boolean w2 = o.a.h.w("google_analytics_default_allow_ad_personalization_signals");
if (w2 != null) {
}
long j7 = o.h;
List<String> list2 = o.i;
if (!da.b()) {
}
str3 = null;
return new zzn(str4, str5, str6, j4, str7, 33025, j6, E, z3, z4, str2, 0, j, i, booleanValue, booleanValue2, z5, str8, r28, j2, list, str3, (t8.b() || !o.a.h.o(p.H0)) ? "" : o.l().y().d());
}
} catch (Exception unused3) {
z3 = d;
o.g().j.a("Failed to obtain Firebase Analytics instance");
str = null;
u4 u4Var = o.a;
valueOf = Long.valueOf(u4Var.o().k.a());
if (valueOf.longValue() != 0) {
}
o.t();
int i = o.j;
boolean booleanValue = o.a.h.y().booleanValue();
Boolean w = o.a.h.w("google_analytics_ssaid_collection_enabled");
boolean booleanValue2 = Boolean.valueOf(w != null || w.booleanValue()).booleanValue();
d4 l = o.l();
l.b();
boolean z5 = l.w().getBoolean("deferred_analytics_collection", false);
o.t();
String str8 = o.l;
Boolean w2 = o.a.h.w("google_analytics_default_allow_ad_personalization_signals");
if (w2 != null) {
}
long j7 = o.h;
List<String> list2 = o.i;
if (!da.b()) {
}
str3 = null;
return new zzn(str4, str5, str6, j4, str7, 33025, j6, E, z3, z4, str2, 0, j, i, booleanValue, booleanValue2, z5, str8, r28, j2, list, str3, (t8.b() || !o.a.h.o(p.H0)) ? "" : o.l().y().d());
}
u4 u4Var = o.a;
valueOf = Long.valueOf(u4Var.o().k.a());
if (valueOf.longValue() != 0) {
str2 = str;
j = u4Var.H;
} else {
str2 = str;
j = Math.min(u4Var.H, valueOf.longValue());
}
o.t();
int i = o.j;
boolean booleanValue = o.a.h.y().booleanValue();
Boolean w = o.a.h.w("google_analytics_ssaid_collection_enabled");
boolean booleanValue2 = Boolean.valueOf(w != null || w.booleanValue()).booleanValue();
d4 l = o.l();
l.b();
boolean z5 = l.w().getBoolean("deferred_analytics_collection", false);
o.t();
String str8 = o.l;
Boolean w2 = o.a.h.w("google_analytics_default_allow_ad_personalization_signals");
Boolean valueOf2 = w2 != null ? null : Boolean.valueOf(!w2.booleanValue());
long j7 = o.h;
List<String> list2 = o.i;
if (!da.b()) {
list = list2;
j2 = j7;
if (o.a.h.o(p.f1184j0)) {
o.t();
str3 = o.m;
return new zzn(str4, str5, str6, j4, str7, 33025, j6, E, z3, z4, str2, 0, j, i, booleanValue, booleanValue2, z5, str8, valueOf2, j2, list, str3, (t8.b() || !o.a.h.o(p.H0)) ? "" : o.l().y().d());
}
} else {
list = list2;
j2 = j7;
}
str3 = null;
return new zzn(str4, str5, str6, j4, str7, 33025, j6, E, z3, z4, str2, 0, j, i, booleanValue, booleanValue2, z5, str8, valueOf2, j2, list, str3, (t8.b() || !o.a.h.o(p.H0)) ? "" : o.l().y().d());
}
} catch (ClassNotFoundException unused4) {
}
} else {
o.g().n.a("Disabled IID for tests.");
}
}
z3 = d;
str = null;
u4 u4Var = o.a;
valueOf = Long.valueOf(u4Var.o().k.a());
if (valueOf.longValue() != 0) {
}
o.t();
int i = o.j;
boolean booleanValue = o.a.h.y().booleanValue();
Boolean w = o.a.h.w("google_analytics_ssaid_collection_enabled");
boolean booleanValue2 = Boolean.valueOf(w != null || w.booleanValue()).booleanValue();
d4 l = o.l();
l.b();
boolean z5 = l.w().getBoolean("deferred_analytics_collection", false);
o.t();
String str8 = o.l;
Boolean w2 = o.a.h.w("google_analytics_default_allow_ad_personalization_signals");
if (w2 != null) {
}
long j7 = o.h;
List<String> list2 = o.i;
if (!da.b()) {
}
str3 = null;
return new zzn(str4, str5, str6, j4, str7, 33025, j6, E, z3, z4, str2, 0, j, i, booleanValue, booleanValue2, z5, str8, valueOf2, j2, list, str3, (t8.b() || !o.a.h.o(p.H0)) ? "" : o.l().y().d());
}
@Override // c.i.a.f.i.b.a5
public final boolean v() {
return false;
}
/* JADX INFO: finally extract failed */
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x0174: APUT
(r5v6 java.lang.String[])
(0 ??[int, short, byte, char])
(wrap: java.lang.String : 0x016e: INVOKE (r15v3 java.lang.String) = (r25v1 long) type: STATIC call: java.lang.Long.toString(long):java.lang.String)
*/
/* JADX WARNING: Removed duplicated region for block: B:111:0x01c8 A[SYNTHETIC, Splitter:B:111:0x01c8] */
/* JADX WARNING: Removed duplicated region for block: B:117:0x01df */
/* JADX WARNING: Removed duplicated region for block: B:119:0x01e4 */
/* JADX WARNING: Removed duplicated region for block: B:126:0x01f4 */
/* JADX WARNING: Removed duplicated region for block: B:128:0x01f9 */
/* JADX WARNING: Removed duplicated region for block: B:134:0x0210 */
/* JADX WARNING: Removed duplicated region for block: B:136:0x0215 */
/* JADX WARNING: Removed duplicated region for block: B:139:0x0222 */
/* JADX WARNING: Removed duplicated region for block: B:141:0x0227 */
/* JADX WARNING: Removed duplicated region for block: B:145:0x023b */
/* JADX WARNING: Removed duplicated region for block: B:146:0x0244 */
/* JADX WARNING: Removed duplicated region for block: B:153:0x0255 */
/* JADX WARNING: Removed duplicated region for block: B:179:0x0218 A[SYNTHETIC] */
/* JADX WARNING: Removed duplicated region for block: B:181:0x0218 A[SYNTHETIC] */
/* JADX WARNING: Removed duplicated region for block: B:183:0x0218 A[SYNTHETIC] */
@WorkerThread
public final void w(i3 i3Var, AbstractSafeParcelable abstractSafeParcelable, zzn zzn) {
ArrayList arrayList;
int i;
int size;
int i2;
Cursor cursor;
SQLiteDatabase sQLiteDatabase;
Throwable th;
Cursor cursor2;
SQLiteDatabase sQLiteDatabase2;
SQLiteFullException e;
SQLiteException e2;
String[] strArr;
String str;
zzz zzz;
zzku zzku;
b();
t();
int i3 = 100;
int i4 = 0;
int i5 = 100;
int i6 = 0;
while (i6 < 1001 && i5 == i3) {
ArrayList arrayList2 = new ArrayList();
m3 r = r();
r.b();
if (!r.d) {
ArrayList arrayList3 = new ArrayList();
if (!r.a.b.getDatabasePath("google_app_measurement_local.db").exists()) {
arrayList = arrayList3;
if (arrayList != null) {
arrayList2.addAll(arrayList);
i = arrayList.size();
} else {
i = 0;
}
if (abstractSafeParcelable != null && i < 100) {
arrayList2.add(abstractSafeParcelable);
}
size = arrayList2.size();
i2 = 0;
while (i2 < size) {
int i7 = i2 + 1;
AbstractSafeParcelable abstractSafeParcelable2 = (AbstractSafeParcelable) arrayList2.get(i2);
if (abstractSafeParcelable2 instanceof zzaq) {
try {
i3Var.q0((zzaq) abstractSafeParcelable2, zzn);
} catch (RemoteException e3) {
g().f.b("Failed to send event to the service", e3);
}
} else if (abstractSafeParcelable2 instanceof zzku) {
try {
i3Var.u0((zzku) abstractSafeParcelable2, zzn);
} catch (RemoteException e4) {
g().f.b("Failed to send user property to the service", e4);
}
} else if (abstractSafeParcelable2 instanceof zzz) {
try {
i3Var.v0((zzz) abstractSafeParcelable2, zzn);
} catch (RemoteException e5) {
g().f.b("Failed to send conditional user property to the service", e5);
}
} else {
g().f.a("Discarding data. Unrecognized parcel type.");
}
i2 = i7;
}
i6++;
i5 = i;
i3 = 100;
i4 = 0;
} else {
int i8 = 5;
int i9 = 0;
int i10 = 5;
while (true) {
if (i9 >= i8) {
r.g().i.a("Failed to read events from database in reasonable time");
arrayList = null;
break;
}
try {
sQLiteDatabase2 = r.A();
if (sQLiteDatabase2 == null) {
try {
r.d = true;
if (sQLiteDatabase2 != null) {
sQLiteDatabase2.close();
}
} catch (SQLiteFullException e6) {
e = e6;
} catch (SQLiteDatabaseLockedException unused) {
cursor2 = null;
SystemClock.sleep((long) i10);
i10 += 20;
if (cursor2 != null) {
cursor2.close();
}
if (sQLiteDatabase2 == null) {
sQLiteDatabase2.close();
}
i9++;
i3 = 100;
i4 = 0;
i8 = 5;
} catch (SQLiteException e7) {
e2 = e7;
cursor2 = null;
if (sQLiteDatabase2 != null) {
try {
if (sQLiteDatabase2.inTransaction()) {
sQLiteDatabase2.endTransaction();
}
} catch (Throwable th2) {
th = th2;
sQLiteDatabase = sQLiteDatabase2;
cursor = cursor2;
if (cursor != null) {
}
if (sQLiteDatabase != null) {
}
throw th;
}
}
r.g().f.b("Error reading entries from local database", e2);
r.d = true;
if (cursor2 != null) {
cursor2.close();
}
if (sQLiteDatabase2 == null) {
sQLiteDatabase2.close();
}
i9++;
i3 = 100;
i4 = 0;
i8 = 5;
} catch (Throwable th3) {
th = th3;
sQLiteDatabase = sQLiteDatabase2;
cursor = null;
if (cursor != null) {
cursor.close();
}
if (sQLiteDatabase != null) {
sQLiteDatabase.close();
}
throw th;
}
} else {
sQLiteDatabase2.beginTransaction();
long w = m3.w(sQLiteDatabase2);
long j = -1;
if (w != -1) {
String[] strArr2 = new String[1];
strArr2[i4] = String.valueOf(w);
str = "rowid<?";
strArr = strArr2;
} else {
str = null;
strArr = null;
}
cursor2 = sQLiteDatabase2.query("messages", new String[]{"rowid", "type", "entry"}, str, strArr, null, null, "rowid asc", Integer.toString(i3));
while (cursor2.moveToNext()) {
try {
j = cursor2.getLong(i4);
int i11 = cursor2.getInt(1);
byte[] blob = cursor2.getBlob(2);
if (i11 == 0) {
Parcel obtain = Parcel.obtain();
try {
obtain.unmarshall(blob, i4, blob.length);
obtain.setDataPosition(i4);
zzaq createFromParcel = zzaq.CREATOR.createFromParcel(obtain);
if (createFromParcel != null) {
arrayList3.add(createFromParcel);
}
} catch (SafeParcelReader$ParseException unused2) {
r.g().f.a("Failed to load event from local database");
} finally {
obtain.recycle();
}
} else if (i11 == 1) {
Parcel obtain2 = Parcel.obtain();
try {
obtain2.unmarshall(blob, i4, blob.length);
obtain2.setDataPosition(i4);
zzku = zzku.CREATOR.createFromParcel(obtain2);
obtain2.recycle();
} catch (SafeParcelReader$ParseException unused3) {
r.g().f.a("Failed to load user property from local database");
obtain2.recycle();
zzku = null;
} catch (Throwable th4) {
obtain2.recycle();
throw th4;
}
if (zzku != null) {
arrayList3.add(zzku);
}
} else if (i11 == 2) {
Parcel obtain3 = Parcel.obtain();
try {
obtain3.unmarshall(blob, i4, blob.length);
obtain3.setDataPosition(i4);
zzz = zzz.CREATOR.createFromParcel(obtain3);
obtain3.recycle();
} catch (SafeParcelReader$ParseException unused4) {
r.g().f.a("Failed to load conditional user property from local database");
obtain3.recycle();
zzz = null;
} catch (Throwable th5) {
obtain3.recycle();
throw th5;
}
if (zzz != null) {
arrayList3.add(zzz);
}
} else if (i11 == 3) {
r.g().i.a("Skipping app launch break");
} else {
r.g().f.a("Unknown record type in local database");
}
} catch (SQLiteFullException e8) {
e = e8;
r.g().f.b("Error reading entries from local database", e);
r.d = true;
if (cursor2 != null) {
cursor2.close();
}
if (sQLiteDatabase2 != null) {
sQLiteDatabase2.close();
}
i9++;
i3 = 100;
i4 = 0;
i8 = 5;
} catch (SQLiteDatabaseLockedException unused5) {
SystemClock.sleep((long) i10);
i10 += 20;
if (cursor2 != null) {
}
if (sQLiteDatabase2 == null) {
}
i9++;
i3 = 100;
i4 = 0;
i8 = 5;
} catch (SQLiteException e9) {
e2 = e9;
if (sQLiteDatabase2 != null) {
}
r.g().f.b("Error reading entries from local database", e2);
r.d = true;
if (cursor2 != null) {
}
if (sQLiteDatabase2 == null) {
}
i9++;
i3 = 100;
i4 = 0;
i8 = 5;
}
}
String[] strArr3 = new String[1];
try {
strArr3[0] = Long.toString(j);
if (sQLiteDatabase2.delete("messages", "rowid <= ?", strArr3) < arrayList3.size()) {
r.g().f.a("Fewer entries removed from local database than expected");
}
sQLiteDatabase2.setTransactionSuccessful();
sQLiteDatabase2.endTransaction();
cursor2.close();
sQLiteDatabase2.close();
arrayList = arrayList3;
} catch (SQLiteFullException e10) {
e = e10;
r.g().f.b("Error reading entries from local database", e);
r.d = true;
if (cursor2 != null) {
}
if (sQLiteDatabase2 != null) {
}
i9++;
i3 = 100;
i4 = 0;
i8 = 5;
} catch (SQLiteDatabaseLockedException unused6) {
SystemClock.sleep((long) i10);
i10 += 20;
if (cursor2 != null) {
}
if (sQLiteDatabase2 == null) {
}
i9++;
i3 = 100;
i4 = 0;
i8 = 5;
} catch (SQLiteException e11) {
e2 = e11;
if (sQLiteDatabase2 != null) {
}
r.g().f.b("Error reading entries from local database", e2);
r.d = true;
if (cursor2 != null) {
}
if (sQLiteDatabase2 == null) {
}
i9++;
i3 = 100;
i4 = 0;
i8 = 5;
}
}
} catch (SQLiteFullException e12) {
e = e12;
sQLiteDatabase2 = null;
cursor2 = null;
r.g().f.b("Error reading entries from local database", e);
r.d = true;
if (cursor2 != null) {
}
if (sQLiteDatabase2 != null) {
}
i9++;
i3 = 100;
i4 = 0;
i8 = 5;
} catch (SQLiteDatabaseLockedException unused7) {
sQLiteDatabase2 = null;
cursor2 = null;
SystemClock.sleep((long) i10);
i10 += 20;
if (cursor2 != null) {
}
if (sQLiteDatabase2 == null) {
}
i9++;
i3 = 100;
i4 = 0;
i8 = 5;
} catch (SQLiteException e13) {
e2 = e13;
sQLiteDatabase2 = null;
cursor2 = null;
if (sQLiteDatabase2 != null) {
}
r.g().f.b("Error reading entries from local database", e2);
r.d = true;
if (cursor2 != null) {
}
if (sQLiteDatabase2 == null) {
}
i9++;
i3 = 100;
i4 = 0;
i8 = 5;
} catch (Throwable th6) {
th = th6;
sQLiteDatabase = null;
cursor = null;
if (cursor != null) {
}
if (sQLiteDatabase != null) {
}
throw th;
}
i9++;
i3 = 100;
i4 = 0;
i8 = 5;
}
if (arrayList != null) {
}
arrayList2.add(abstractSafeParcelable);
size = arrayList2.size();
i2 = 0;
while (i2 < size) {
}
i6++;
i5 = i;
i3 = 100;
i4 = 0;
}
}
arrayList = null;
if (arrayList != null) {
}
arrayList2.add(abstractSafeParcelable);
size = arrayList2.size();
i2 = 0;
while (i2 < size) {
}
i6++;
i5 = i;
i3 = 100;
i4 = 0;
}
}
@WorkerThread
public final void y(zzz zzz) {
boolean z2;
b();
t();
m3 r = r();
r.e();
byte[] g02 = t9.g0(zzz);
if (g02.length > 131072) {
r.g().g.a("Conditional user property too long for local database. Sending directly to service");
z2 = false;
} else {
z2 = r.x(2, g02);
}
z(new g8(this, z2, new zzz(zzz), I(true), zzz));
}
@WorkerThread
public final void z(Runnable runnable) throws IllegalStateException {
b();
if (B()) {
runnable.run();
} else if (((long) this.h.size()) >= 1000) {
g().f.a("Discarding data. Max runnable queue size reached");
} else {
this.h.add(runnable);
this.i.b(60000);
C();
}
}
}