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

285 lines
12 KiB
Java

package c.i.a.f.i.b;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.Bundle;
import android.text.TextUtils;
import androidx.core.os.EnvironmentCompat;
import c.c.a.a0.d;
import c.i.a.f.e.h.j.h;
import c.i.a.f.e.o.f;
import c.i.a.f.h.l.da;
import c.i.a.f.h.l.ib;
import c.i.a.f.h.l.lb;
import com.google.android.gms.common.R;
import com.google.android.gms.common.api.Status;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
/* compiled from: com.google.android.gms:play-services-measurement-impl@@18.0.0 */
public final class n3 extends a5 {
/* renamed from: c reason: collision with root package name */
public String f1217c;
public String d;
public int e;
public String f;
public long g;
public long h;
public List<String> i;
public int j;
public String k;
public String l;
public String m;
public n3(u4 u4Var, long j) {
super(u4Var);
this.h = j;
}
@Override // c.i.a.f.i.b.a5
public final boolean v() {
return true;
}
/* JADX WARNING: Removed duplicated region for block: B:104:0x0240 A[Catch:{ IllegalStateException -> 0x01c3 }] */
/* JADX WARNING: Removed duplicated region for block: B:110:0x0267 A[Catch:{ IllegalStateException -> 0x01c3 }] */
/* JADX WARNING: Removed duplicated region for block: B:118:0x02a5 */
/* JADX WARNING: Removed duplicated region for block: B:119:0x02b1 */
/* JADX WARNING: Removed duplicated region for block: B:124:0x02c4 A[SYNTHETIC, Splitter:B:124:0x02c4] */
/* JADX WARNING: Removed duplicated region for block: B:132:0x02ea */
/* JADX WARNING: Removed duplicated region for block: B:142:0x031c */
/* JADX WARNING: Removed duplicated region for block: B:144:0x0320 */
/* JADX WARNING: Removed duplicated region for block: B:146:0x032b */
/* JADX WARNING: Removed duplicated region for block: B:66:0x0197 */
/* JADX WARNING: Removed duplicated region for block: B:79:0x01d4 A[Catch:{ IllegalStateException -> 0x01c3 }] */
/* JADX WARNING: Removed duplicated region for block: B:80:0x01d7 A[Catch:{ IllegalStateException -> 0x01c3 }] */
public final void w() {
Status status;
boolean z2;
List<String> list;
Bundle D;
Integer num;
String D1;
String str = EnvironmentCompat.MEDIA_UNKNOWN;
String str2 = "Unknown";
String packageName = this.a.b.getPackageName();
PackageManager packageManager = this.a.b.getPackageManager();
int i = Integer.MIN_VALUE;
if (packageManager == null) {
g().f.b("PackageManager is null, app identity information might be inaccurate. appId", q3.s(packageName));
} else {
try {
str = packageManager.getInstallerPackageName(packageName);
} catch (IllegalArgumentException unused) {
g().f.b("Error retrieving app installer package name. appId", q3.s(packageName));
}
if (str == null) {
str = "manual_install";
} else if ("com.android.vending".equals(str)) {
str = "";
}
try {
PackageInfo packageInfo = packageManager.getPackageInfo(this.a.b.getPackageName(), 0);
if (packageInfo != null) {
CharSequence applicationLabel = packageManager.getApplicationLabel(packageInfo.applicationInfo);
if (!TextUtils.isEmpty(applicationLabel)) {
applicationLabel.toString();
}
str2 = packageInfo.versionName;
i = packageInfo.versionCode;
}
} catch (PackageManager.NameNotFoundException unused2) {
g().f.c("Error retrieving package info. appId, appName", q3.s(packageName), "Unknown");
}
}
this.f1217c = packageName;
this.f = str;
this.d = str2;
this.e = i;
this.g = 0;
Context context = this.a.b;
Object obj = h.a;
d.z(context, "Context must not be null.");
synchronized (h.a) {
if (h.b == null) {
h.b = new h(context);
}
status = h.b.d;
}
boolean z3 = true;
boolean z4 = status != null && status.w0();
boolean z5 = !TextUtils.isEmpty(this.a.f1240c) && "am".equals(this.a.d);
boolean z6 = z4 | z5;
if (!z6) {
if (status == null) {
g().g.a("GoogleService failed to initialize (no status)");
} else {
g().g.c("GoogleService failed to initialize, status", Integer.valueOf(status.o), status.p);
}
}
if (z6) {
int e = this.a.e();
switch (e) {
case 0:
g().n.a("App measurement collection enabled");
break;
case 1:
g().l.a("App measurement deactivated via the manifest");
break;
case 2:
g().n.a("App measurement deactivated via the init parameters");
break;
case 3:
g().l.a("App measurement disabled by setAnalyticsCollectionEnabled(false)");
break;
case 4:
g().l.a("App measurement disabled via the manifest");
break;
case 5:
g().n.a("App measurement disabled via the init parameters");
break;
case 6:
g().k.a("App measurement deactivated via resources. This method is being deprecated. Please refer to https://firebase.google.com/support/guides/disable-analytics");
break;
case 7:
g().l.a("App measurement disabled via the global data collection setting");
break;
case 8:
g().l.a("App measurement disabled due to denied storage consent");
break;
default:
g().l.a("App measurement disabled");
g().g.a("Invalid scion state in identity");
break;
}
if (e == 0) {
z2 = true;
this.k = "";
this.l = "";
this.m = "";
if (z5) {
this.l = this.a.f1240c;
}
list = null;
D1 = (((lb) ib.i.a()).a() || !this.a.h.o(p.C0)) ? h.a("getGoogleAppId").f1084c : f.D1(this.a.b, "google_app_id");
this.k = !TextUtils.isEmpty(D1) ? "" : D1;
if (!da.b() && this.a.h.o(p.f1229j0)) {
Context context2 = this.a.b;
Objects.requireNonNull(context2, "null reference");
Resources resources = context2.getResources();
String resourcePackageName = resources.getResourcePackageName(R.a.common_google_play_services_unknown_issue);
int identifier = resources.getIdentifier("ga_app_id", "string", resourcePackageName);
String string = identifier == 0 ? null : resources.getString(identifier);
this.m = TextUtils.isEmpty(string) ? "" : string;
if (!TextUtils.isEmpty(D1) || !TextUtils.isEmpty(string)) {
int identifier2 = resources.getIdentifier("admob_app_id", "string", resourcePackageName);
this.l = identifier2 == 0 ? null : resources.getString(identifier2);
}
} else if (!TextUtils.isEmpty(D1)) {
Context context3 = this.a.b;
Objects.requireNonNull(context3, "null reference");
Resources resources2 = context3.getResources();
int identifier3 = resources2.getIdentifier("admob_app_id", "string", resources2.getResourcePackageName(R.a.common_google_play_services_unknown_issue));
this.l = identifier3 == 0 ? null : resources2.getString(identifier3);
}
if (z2) {
g().n.c("App measurement enabled for app package, google app id", this.f1217c, TextUtils.isEmpty(this.k) ? this.l : this.k);
}
this.i = null;
c cVar = this.a.h;
Objects.requireNonNull(cVar);
d.w("analytics.safelisted_events");
D = cVar.D();
if (D != null) {
cVar.g().f.a("Failed to load metadata: Metadata bundle is null");
} else if (D.containsKey("analytics.safelisted_events")) {
num = Integer.valueOf(D.getInt("analytics.safelisted_events"));
if (num != null) {
try {
String[] stringArray = cVar.a.b.getResources().getStringArray(num.intValue());
if (stringArray != null) {
list = Arrays.asList(stringArray);
}
} catch (Resources.NotFoundException e2) {
cVar.g().f.b("Failed to load string array from metadata: resource not found", e2);
}
}
if (list != null) {
if (list.size() == 0) {
g().k.a("Safelisted event list is empty. Ignoring");
} else {
Iterator<String> it = list.iterator();
while (true) {
if (it.hasNext()) {
if (!e().m0("safelisted event", it.next())) {
}
}
}
}
z3 = false;
}
if (z3) {
this.i = list;
}
if (packageManager != null) {
this.j = f.u0(this.a.b) ? 1 : 0;
return;
} else {
this.j = 0;
return;
}
}
num = null;
if (num != null) {
}
if (list != null) {
}
if (z3) {
}
if (packageManager != null) {
}
}
}
z2 = false;
this.k = "";
this.l = "";
this.m = "";
if (z5) {
}
list = null;
try {
if (((lb) ib.i.a()).a()) {
}
this.k = !TextUtils.isEmpty(D1) ? "" : D1;
if (!da.b()) {
}
if (!TextUtils.isEmpty(D1)) {
}
if (z2) {
}
} catch (IllegalStateException e3) {
g().f.c("Fetching Google App Id failed with exception. appId", q3.s(packageName), e3);
}
this.i = null;
c cVar = this.a.h;
Objects.requireNonNull(cVar);
d.w("analytics.safelisted_events");
D = cVar.D();
if (D != null) {
}
num = null;
if (num != null) {
}
if (list != null) {
}
if (z3) {
}
if (packageManager != null) {
}
}
}