正在查看: BodyTech v7.6.4 应用的 a.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: BodyTech v7.6.4 应用的 a.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.mixpanel.android.mpmetrics;
import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import android.util.DisplayMetrics;
import com.mixpanel.android.mpmetrics.MPDbAdapter;
import com.mixpanel.android.util.RemoteService;
import com.newrelic.agent.android.instrumentation.Instrumented;
import com.newrelic.agent.android.instrumentation.JSONObjectInstrumentation;
import java.io.File;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
class a {
private static final Map<Context, a> d = new HashMap();
private final h a = c();
protected final Context b;
protected final pg.a c;
static class C0073a extends d {
private final String c;
private final JSONObject d;
private final boolean e;
public C0073a(String str, JSONObject jSONObject, String str2) {
this(str, jSONObject, str2, false, new JSONObject());
}
public String c() {
return this.c;
}
public JSONObject d() {
return b();
}
public JSONObject e() {
return this.d;
}
public C0073a(String str, JSONObject jSONObject, String str2, boolean z, JSONObject jSONObject2) {
super(str2, jSONObject);
this.c = str;
this.e = z;
this.d = jSONObject2;
}
}
@Instrumented
static class b extends d {
public String toString() {
JSONObject b = b();
return !(b instanceof JSONObject) ? b.toString() : JSONObjectInstrumentation.toString(b);
}
}
static class c {
private final String a;
public c(String str) {
this.a = str;
}
public String a() {
return this.a;
}
}
static class d extends c {
private final JSONObject b;
public d(String str, JSONObject jSONObject) {
super(str);
if (jSONObject != null && jSONObject.length() > 0) {
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
try {
jSONObject.get(next).toString();
} catch (AssertionError e) {
jSONObject.remove(next);
qg.c.d("MixpanelAPI.Messages", "Removing people profile property from update (see https://github.com/mixpanel/mixpanel-android/issues/567)", e);
} catch (JSONException unused) {
}
}
}
this.b = jSONObject;
}
public JSONObject b() {
return this.b;
}
}
@Instrumented
static class e extends d {
public e(JSONObject jSONObject, String str) {
super(str, jSONObject);
}
public boolean c() {
return !b().has("$distinct_id");
}
public String toString() {
JSONObject b = b();
return !(b instanceof JSONObject) ? b.toString() : JSONObjectInstrumentation.toString(b);
}
}
static class f extends c {
private final String b;
public f(String str, String str2) {
super(str2);
this.b = str;
}
public String b() {
return this.b;
}
public String toString() {
return this.b;
}
}
static class g extends c {
private final Map<String, String> b;
public Map<String, String> b() {
return this.b;
}
}
class h {
private j f;
private final Object a = new Object();
private long c = 0;
private long d = 0;
private long e = -1;
private Handler b = f();
@Instrumented
class HandlerC0074a extends Handler {
private MPDbAdapter a;
private final long b;
private long c;
private int d;
public HandlerC0074a(Looper looper) {
super(looper);
this.a = null;
h.this.f = j.f(a.this.b);
this.b = a.this.c.h();
}
private JSONObject a() throws JSONException {
JSONObject jSONObject = new JSONObject();
jSONObject.put("mp_lib", "android");
jSONObject.put("$lib_version", "7.4.1");
jSONObject.put("$os", "Android");
String str = Build.VERSION.RELEASE;
if (str == null) {
str = "UNKNOWN";
}
jSONObject.put("$os_version", str);
String str2 = Build.MANUFACTURER;
if (str2 == null) {
str2 = "UNKNOWN";
}
jSONObject.put("$manufacturer", str2);
String str3 = Build.BRAND;
if (str3 == null) {
str3 = "UNKNOWN";
}
jSONObject.put("$brand", str3);
String str4 = Build.MODEL;
jSONObject.put("$model", str4 != null ? str4 : "UNKNOWN");
DisplayMetrics e = h.this.f.e();
jSONObject.put("$screen_dpi", e.densityDpi);
jSONObject.put("$screen_height", e.heightPixels);
jSONObject.put("$screen_width", e.widthPixels);
String b = h.this.f.b();
if (b != null) {
jSONObject.put("$app_version", b);
jSONObject.put("$app_version_string", b);
}
Integer a = h.this.f.a();
if (a != null) {
String valueOf = String.valueOf(a);
jSONObject.put("$app_release", valueOf);
jSONObject.put("$app_build_number", valueOf);
}
Boolean valueOf2 = Boolean.valueOf(h.this.f.g());
if (valueOf2 != null) {
jSONObject.put("$has_nfc", valueOf2.booleanValue());
}
Boolean valueOf3 = Boolean.valueOf(h.this.f.h());
if (valueOf3 != null) {
jSONObject.put("$has_telephone", valueOf3.booleanValue());
}
String d = h.this.f.d();
if (d != null && !d.trim().isEmpty()) {
jSONObject.put("$carrier", d);
}
Boolean j = h.this.f.j();
if (j != null) {
jSONObject.put("$wifi", j.booleanValue());
}
Boolean i = h.this.f.i();
if (i != null) {
jSONObject.put("$bluetooth_enabled", i);
}
String c = h.this.f.c();
if (c != null) {
jSONObject.put("$bluetooth_version", c);
}
return jSONObject;
}
private JSONObject b(C0073a c0073a) throws JSONException {
JSONObject jSONObject = new JSONObject();
JSONObject d = c0073a.d();
JSONObject a = a();
a.put("token", c0073a.a());
if (d != null) {
Iterator<String> keys = d.keys();
while (keys.hasNext()) {
String next = keys.next();
a.put(next, d.get(next));
}
}
jSONObject.put("event", c0073a.c());
jSONObject.put("properties", a);
jSONObject.put("$mp_metadata", c0073a.e());
return jSONObject;
}
private void c(MPDbAdapter mPDbAdapter, String str) {
RemoteService g = a.this.g();
a aVar = a.this;
Context context = aVar.b;
aVar.c.o();
if (!g.b(context, null)) {
a.this.h("Not flushing data to Mixpanel because the device is not connected to the internet.");
return;
}
d(mPDbAdapter, str, MPDbAdapter.Table.EVENTS, a.this.c.f());
d(mPDbAdapter, str, MPDbAdapter.Table.PEOPLE, a.this.c.p());
d(mPDbAdapter, str, MPDbAdapter.Table.GROUPS, a.this.c.j());
}
private void d(com.mixpanel.android.mpmetrics.MPDbAdapter r17, java.lang.String r18, com.mixpanel.android.mpmetrics.MPDbAdapter.Table r19, java.lang.String r20) {
throw new UnsupportedOperationException("Method not decompiled: com.mixpanel.android.mpmetrics.a.h.HandlerC0074a.d(com.mixpanel.android.mpmetrics.MPDbAdapter, java.lang.String, com.mixpanel.android.mpmetrics.MPDbAdapter$Table, java.lang.String):void");
}
@Override
public void handleMessage(Message message) {
String a;
int i;
String str;
String str2;
JSONObject b;
if (this.a == null) {
a aVar = a.this;
MPDbAdapter j = aVar.j(aVar.b);
this.a = j;
j.l(System.currentTimeMillis() - a.this.c.b(), MPDbAdapter.Table.EVENTS);
this.a.l(System.currentTimeMillis() - a.this.c.b(), MPDbAdapter.Table.PEOPLE);
}
try {
int i2 = message.what;
if (i2 == 0) {
e eVar = (e) message.obj;
MPDbAdapter.Table table = eVar.c() ? MPDbAdapter.Table.ANONYMOUS_PEOPLE : MPDbAdapter.Table.PEOPLE;
a.this.h("Queuing people record for sending later");
a.this.h(" " + eVar.toString());
str = eVar.a();
i = this.a.j(eVar.b(), str, table);
if (eVar.c()) {
i = 0;
}
} else if (i2 == 3) {
b bVar = (b) message.obj;
a.this.h("Queuing group record for sending later");
a.this.h(" " + bVar.toString());
str = bVar.a();
i = this.a.j(bVar.b(), str, MPDbAdapter.Table.GROUPS);
} else if (i2 == 1) {
C0073a c0073a = (C0073a) message.obj;
try {
b = b(c0073a);
a.this.h("Queuing event for sending later");
a aVar2 = a.this;
StringBuilder sb2 = new StringBuilder();
sb2.append(" ");
sb2.append(!(b instanceof JSONObject) ? b.toString() : JSONObjectInstrumentation.toString(b));
aVar2.h(sb2.toString());
str2 = c0073a.a();
} catch (JSONException e) {
e = e;
str2 = null;
}
try {
i = this.a.j(b, str2, MPDbAdapter.Table.EVENTS);
} catch (JSONException e2) {
e = e2;
qg.c.d("MixpanelAPI.Messages", "Exception tracking event " + c0073a.c(), e);
i = -3;
str = str2;
if (i < a.this.c.a()) {
}
a.this.h("Flushing queue due to bulk upload limit (" + i + ") for project " + str);
h.this.h();
c(this.a, str);
return;
}
str = str2;
} else if (i2 == 4) {
f fVar = (f) message.obj;
String b2 = fVar.b();
str = fVar.a();
i = this.a.r(str, b2);
} else {
if (i2 == 7) {
a = ((c) message.obj).a();
this.a.k(MPDbAdapter.Table.ANONYMOUS_PEOPLE, a);
} else {
if (i2 == 8) {
g gVar = (g) message.obj;
qg.c.a("MixpanelAPI.Messages", this.a.s(gVar.b(), gVar.a()) + " stored events were updated with new properties.");
} else if (i2 == 2) {
a.this.h("Flushing queue due to scheduled or forced flush");
h.this.h();
a = (String) message.obj;
c(this.a, a);
} else if (i2 == 6) {
a = ((c) message.obj).a();
this.a.k(MPDbAdapter.Table.EVENTS, a);
this.a.k(MPDbAdapter.Table.PEOPLE, a);
this.a.k(MPDbAdapter.Table.GROUPS, a);
this.a.k(MPDbAdapter.Table.ANONYMOUS_PEOPLE, a);
} else if (i2 == 5) {
qg.c.k("MixpanelAPI.Messages", "Worker received a hard kill. Dumping all events and force-killing. Thread id " + Thread.currentThread().getId());
synchronized (h.this.a) {
this.a.n();
h.this.b = null;
Looper.myLooper().quit();
}
} else if (i2 == 9) {
qg.b.a((File) message.obj);
} else {
qg.c.c("MixpanelAPI.Messages", "Unexpected message received by Mixpanel worker: " + message);
}
i = -3;
str = null;
}
i = -3;
str = a;
}
if ((i < a.this.c.a() || i == -2) && this.d <= 0 && str != null) {
a.this.h("Flushing queue due to bulk upload limit (" + i + ") for project " + str);
h.this.h();
c(this.a, str);
return;
}
if (i <= 0 || hasMessages(2, str)) {
return;
}
a.this.h("Queue depth " + i + " - Adding flush in " + this.b);
if (this.b >= 0) {
Message obtain = Message.obtain();
obtain.what = 2;
obtain.obj = str;
obtain.arg1 = 1;
sendMessageDelayed(obtain, this.b);
}
} catch (RuntimeException e3) {
qg.c.d("MixpanelAPI.Messages", "Worker threw an unhandled exception", e3);
synchronized (h.this.a) {
h.this.b = null;
try {
Looper.myLooper().quit();
qg.c.d("MixpanelAPI.Messages", "Mixpanel will not process any more analytics messages", e3);
} catch (Exception e4) {
qg.c.d("MixpanelAPI.Messages", "Could not halt looper", e4);
}
}
}
}
}
public h() {
}
public void h() {
long currentTimeMillis = System.currentTimeMillis();
long j = this.c;
long j2 = 1 + j;
long j3 = this.e;
if (j3 > 0) {
long j4 = ((currentTimeMillis - j3) + (this.d * j)) / j2;
this.d = j4;
a.this.h("Average send frequency approximately " + (j4 / 1000) + " seconds.");
}
this.e = currentTimeMillis;
this.c = j2;
}
protected Handler f() {
HandlerThread handlerThread = new HandlerThread("com.mixpanel.android.AnalyticsWorker", 10);
handlerThread.start();
return new HandlerC0074a(handlerThread.getLooper());
}
public void g(Message message) {
synchronized (this.a) {
try {
Handler handler = this.b;
if (handler == null) {
a.this.h("Dead mixpanel worker dropping a message: " + message.what);
} else {
handler.sendMessage(message);
}
} catch (Throwable th) {
throw th;
}
}
}
}
a(Context context, pg.a aVar) {
this.b = context;
this.c = aVar;
g().c();
}
public static a f(Context context, pg.a aVar) {
a aVar2;
Map<Context, a> map = d;
synchronized (map) {
try {
Context applicationContext = context.getApplicationContext();
if (map.containsKey(applicationContext)) {
aVar2 = map.get(applicationContext);
} else {
aVar2 = new a(applicationContext, aVar);
map.put(applicationContext, aVar2);
}
} catch (Throwable th) {
throw th;
}
}
return aVar2;
}
public void h(String str) {
qg.c.i("MixpanelAPI.Messages", str + " (Thread " + Thread.currentThread().getId() + ")");
}
public void i(String str, Throwable th) {
qg.c.j("MixpanelAPI.Messages", str + " (Thread " + Thread.currentThread().getId() + ")", th);
}
protected h c() {
return new h();
}
public void d(c cVar) {
Message obtain = Message.obtain();
obtain.what = 6;
obtain.obj = cVar;
this.a.g(obtain);
}
public void e(C0073a c0073a) {
Message obtain = Message.obtain();
obtain.what = 1;
obtain.obj = c0073a;
this.a.g(obtain);
}
protected RemoteService g() {
return new com.mixpanel.android.util.a();
}
protected MPDbAdapter j(Context context) {
return MPDbAdapter.q(context, this.c);
}
public void k(e eVar) {
Message obtain = Message.obtain();
obtain.what = 0;
obtain.obj = eVar;
this.a.g(obtain);
}
public void l(c cVar) {
Message obtain = Message.obtain();
obtain.what = 2;
obtain.obj = cVar.a();
obtain.arg1 = 0;
this.a.g(obtain);
}
public void m(f fVar) {
Message obtain = Message.obtain();
obtain.what = 4;
obtain.obj = fVar;
this.a.g(obtain);
}
public void n(File file) {
Message obtain = Message.obtain();
obtain.what = 9;
obtain.obj = file;
this.a.g(obtain);
}
}