手机管家 v6.0.0版本的 MD5 值为:bf0bca2cb03f766137fe9ecf7383a634
以下内容为反编译后的 bic.java 源代码,内容仅作参考
package tcs;
import android.content.Context;
import android.util.SparseArray;
import com.tencent.kingkong.database.SQLiteDatabase;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public final class bic implements bib {
private static bic eOm = null;
private boolean akA;
private Context cwA;
private bhz eOn;
private SparseArray<bia> cwq = new SparseArray<>(5);
private List<bhu> aIt = new ArrayList(5);
private int g = 0;
private boolean cwv = true;
public static synchronized bic dh(Context context) {
bic bicVar;
synchronized (bic.class) {
if (eOm == null) {
eOm = new bic(context, true);
bgu.m(" create uphandler up:true", new Object[0]);
}
bicVar = eOm;
}
return bicVar;
}
public static synchronized bic s(Context context, boolean z) {
bic bicVar;
synchronized (bic.class) {
if (eOm == null) {
eOm = new bic(context, z);
bgu.m(" create uphandler up: %b", Boolean.valueOf(z));
}
if (eOm.a() != z) {
eOm.D(z);
bgu.m(" change uphandler up: %b", Boolean.valueOf(z));
}
bicVar = eOm;
}
return bicVar;
}
private bic(Context context, boolean z) {
this.cwA = null;
this.akA = true;
Context applicationContext = context != null ? context.getApplicationContext() : null;
if (applicationContext != null) {
this.cwA = applicationContext;
} else {
this.cwA = context;
}
this.akA = z;
this.eOn = bhz.dg(this.cwA);
}
@Override
public final synchronized boolean a(int i, bia biaVar) {
boolean z;
if (biaVar == null) {
z = false;
} else {
this.cwq.append(i, biaVar);
z = true;
}
return z;
}
@Override
public final synchronized boolean a(bhu bhuVar) {
boolean z;
if (bhuVar == null) {
z = false;
} else {
if (!this.aIt.contains(bhuVar)) {
this.aIt.add(bhuVar);
}
z = true;
}
return z;
}
private synchronized int c() {
return this.g;
}
private synchronized void a(int i) {
this.g = i;
}
@Override
public final void a(bhv bhvVar) {
byte[] bArr;
bfu Ij;
if (!a() || !b()) {
if (bhvVar.c() == 2) {
bgu.m(" Not UpProc real event sync 2 DB done false", new Object[0]);
bhvVar.D(false);
}
if (bhvVar.b != 0) {
bgu.m(" Not UpProc not req: %d", Integer.valueOf(bhvVar.c()));
return;
}
bgu.m(" NotUpProc com req start ", new Object[0]);
}
if (!bgv.aj(this.cwA)) {
bgu.h(" doUpload network is disabled!", new Object[0]);
if (bhvVar.c() == 2) {
bhvVar.D(false);
return;
}
return;
}
a(com.tencent.beacon.a.h.cX(this.cwA));
if (bhvVar == null) {
bgu.i(" upData == null ", new Object[0]);
return;
}
int c = bhvVar.c();
long j = 0;
long j2 = 0;
boolean z = false;
int i = -1;
String dZ = bhvVar.dZ();
if (dZ == null || SQLiteDatabase.KeyEmpty.equals(dZ.trim())) {
bgu.i(" url error", new Object[0]);
if (bhvVar.c() == 2) {
bhvVar.D(false);
}
b(c, -1, 0L, 0L, false, "url error");
return;
}
byte[] b = b(bhvVar);
String db = bhvVar.db();
if (db != null) {
dZ = dZ + "?rid=" + db;
}
bgu.m(" start upload cmd: %d url:%s datas:%s", Integer.valueOf(c), dZ, bhvVar.getClass().toString());
if (b == null) {
bgu.h(" sendData is null", new Object[0]);
b(c, -1, 0L, 0L, false, "sData error");
return;
}
bhz Ml = Ml();
if (Ml == null) {
bgu.i(" reqH error", new Object[0]);
b(c, -1, 0L, 0L, false, "reqH error");
return;
}
try {
bhy bhyVar = new bhy();
byte[] a = Ml.a(dZ, b, bhyVar, bhvVar);
if (a == null) {
bArr = (c != 100 || "http://strategy.beacon.qq.com/analytics/upload?mType=beacon".equals(dZ)) ? a : Ml.a("http://strategy.beacon.qq.com/analytics/upload?mType=beacon", b, bhyVar, bhvVar);
a(c() + 1);
} else {
a(0);
bArr = a;
}
j = bhyVar.pd();
j2 = bhyVar.qg();
bgf V = V(bArr);
if (V != null) {
i = V.b;
z = V.cvc == 0;
bgu.g("response.cmd:%d response.result:%d", Integer.valueOf(V.b), Byte.valueOf(V.cvc));
}
if (bhvVar != null && V != null) {
com.tencent.beacon.a.e KY = com.tencent.beacon.a.e.KY();
if (KY != null) {
if (V.Rc != null) {
KY.bi(V.Rc.trim());
}
KY.a(V.afY - new Date().getTime());
bgu.m(" fix ip:%s tmgap: %d", KY.ir(), Long.valueOf(KY.lV()));
}
if ((V.b == 101 || V.b == 103 || V.b == 105) && (Ij = bfs.cK(this.cwA).Ij()) != null) {
if (Ij.Jn() != V.cvp) {
Ij.f(V.cvp);
}
if (Ij.Jl() != V.cvh) {
Ij.b(V.cvh);
}
if (Ij.vK() == null || (V.cog != null && !Ij.vK().equals(V.cog))) {
Ij.bi(V.cog);
}
}
byte[] bArr2 = V.agT;
if (bArr2 != null) {
byte[] b2 = bfy.b(bArr2, V.cvp, V.cvh, V.agv);
SparseArray<bia> Mm = Mm();
if (Mm != null && Mm.size() > 0) {
int c2 = bhvVar.c();
int i2 = V.b;
if (V.cvc == 0 && c2 > 0 && c2 <= 5) {
try {
if (SQLiteDatabase.KeyEmpty.equals(com.tencent.beacon.a.a.f(this.cwA, "QIMEI_DENGTA", SQLiteDatabase.KeyEmpty)) && !bfu.Je().oV()) {
bfs.Ig().a(new bhx(this.cwA));
com.tencent.beacon.a.a.k(this.cwA, "GEN_QIMEI", bfy.ir());
}
} catch (Exception e) {
}
}
if (i2 != 0) {
switch (c2) {
case 4:
if (i2 != 105) {
bgu.h(" UNMATCH req: %d , rep: %d", Integer.valueOf(c2), Integer.valueOf(i2));
break;
}
a(Mm, i2, b2);
break;
case 100:
if (i2 != 101) {
bgu.h(" UNMATCH req: %d , rep: %d", Integer.valueOf(c2), Integer.valueOf(i2));
break;
}
a(Mm, i2, b2);
break;
case 102:
if (i2 != 103) {
bgu.h(" UNMATCH req: %d , rep: %d", Integer.valueOf(c2), Integer.valueOf(i2));
break;
}
a(Mm, i2, b2);
break;
default:
bgu.h(" unknown req: %d ", Integer.valueOf(c2));
break;
}
} else {
bgu.m(" response no datas ", new Object[0]);
}
} else {
bgu.m(" no handler! ", new Object[0]);
}
} else {
bgu.m(" no response! ", new Object[0]);
}
}
b(c, i, j, j2, z, null);
bhvVar.D(z);
} catch (Throwable th) {
th = th;
bhvVar.D(z);
throw th;
}
}
private static byte[] b(bhv bhvVar) {
if (bhvVar != null) {
try {
bge LC = bhvVar.LC();
if (LC != null) {
bgu.g(" RequestPackage info appkey:%s sdkid:%s appVersion:%s cmd: %d", LC.OT, LC.Rc, LC.Rb, Integer.valueOf(LC.f));
bhr bhrVar = new bhr();
bhrVar.a(1);
bhrVar.bi("test");
bhrVar.a("test");
bhrVar.B("detail", LC);
return com.tencent.beacon.a.g.g(2, bhrVar.a());
}
} catch (Throwable th) {
bgu.i(" parseSendDatas error", new Object[0]);
th.printStackTrace();
bhvVar.b();
}
}
return null;
}
private static bgf V(byte[] bArr) {
if (bArr != null) {
try {
byte[] h = com.tencent.beacon.a.g.h(2, bArr);
bhr bhrVar = new bhr();
bhrVar.aO(h);
bgf bgfVar = new bgf();
bgu.g(" covert to ResponsePackage ", new Object[0]);
return (bgf) bhrVar.C("detail", bgfVar);
} catch (Throwable th) {
th.printStackTrace();
}
}
return null;
}
private void b(int i, int i2, long j, long j2, boolean z, String str) {
bhu[] Mk = Mk();
if (Mk != null) {
for (bhu bhuVar : Mk) {
bhuVar.a(i, i2, j, j2, z, str);
}
}
}
private synchronized bhu[] Mk() {
return (this.aIt == null || this.aIt.size() <= 0) ? null : (bhu[]) this.aIt.toArray(new bhu[0]);
}
private synchronized bhz Ml() {
return this.eOn;
}
private synchronized SparseArray<bia> Mm() {
SparseArray<bia> sparseArray;
if (this.cwq == null || this.cwq.size() <= 0) {
sparseArray = null;
} else {
new bgw();
sparseArray = bgw.a(this.cwq);
}
return sparseArray;
}
private boolean a(SparseArray<bia> sparseArray, int i, byte[] bArr) {
if (sparseArray == null || bArr == null) {
return true;
}
switch (i) {
case 103:
try {
bgu.f(" process CMD_RESPONSE_GEN_QIMEI", new Object[0]);
bho bhoVar = new bho(bArr);
bgi bgiVar = new bgi();
bgiVar.a(bhoVar);
if (bgiVar.a != null) {
bfy.dd(this.cwA).a(bgiVar.a);
com.tencent.beacon.a.a.k(this.cwA, "QIMEI_DENGTA", bgiVar.a);
}
bgu.m(" Qimei:%s imei:%s imsi:%s aid:%s mac:%s ", bgiVar.a, bgiVar.OT, bgiVar.Rc, bgiVar.Ri, bgiVar.Rb);
} catch (Throwable th) {
th.printStackTrace();
}
return true;
default:
bia biaVar = sparseArray.get(i);
if (biaVar == null) {
bgu.h(" no handler key:%d", Integer.valueOf(i));
return false;
}
try {
bgu.g(" key:%d handler: %s", Integer.valueOf(i), biaVar.getClass().toString());
biaVar.a(i, bArr, true);
return true;
} catch (Throwable th2) {
th2.printStackTrace();
bgu.i(" handle error key:%d", Integer.valueOf(i));
return false;
}
}
}
public final synchronized boolean a() {
return this.akA;
}
private synchronized void D(boolean z) {
this.akA = z;
}
public final synchronized boolean b() {
return bgv.ai(this.cwA) ? true : this.cwv;
}
}