夏天YY v1.0版本的 MD5 值为:04df6daece98ad4aaa5f0e7a450865f8
以下内容为反编译后的 gf.java 源代码,内容仅作参考
package c.t.m.g;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import com.tencent.map.geolocation.util.DateUtils;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
public class gf {
public Context a;
public a b;
private gk e;
private String f110c = "CheckUpdate";
private boolean d = true;
private boolean f = false;
public gf(Context context) {
this.a = context;
this.e = new gk(context);
this.b = new a(gd.a(context).c());
}
public void a(boolean z) {
this.d = z;
this.b.sendEmptyMessageDelayed(10006, 1000L);
}
public void b(boolean z) {
if (!z) {
boolean b = b();
gd a2 = gd.a(this.a);
a2.a("MCUS", "t:" + b + ",i:" + z);
if (!b) {
if (gn.a) {
String str = this.f110c;
gn.b(str, "runCheck t:" + b + ",i:" + z);
return;
}
return;
}
}
if (gn.a) {
gn.a(this.f110c, "begin to sendrequest download desc");
}
String b2 = gy.b(this.a, "SP_TMLSDK_MODULE_INFO", "default");
gd a3 = gd.a(this.a);
a3.a("MCUS", "load desc," + b2);
List<gl> a4 = gy.a(b2);
if (gn.a) {
String str2 = this.f110c;
gn.a(str2, "local comp infos = " + b2);
}
if (a4 == null || a4.isEmpty()) {
return;
}
List<gl> a5 = a(a4);
if (gn.a) {
gn.a(this.f110c, " sendrequest download desc result");
}
gy.a(this.a, "SP_last_check_TMLSDK_update_time", Long.valueOf(System.currentTimeMillis()));
if (a5 == null) {
return;
}
this.e.a(a5, a4);
}
class a extends Handler {
public a(Looper looper) {
super(looper);
}
@Override
public void handleMessage(Message message) {
try {
a(message);
} catch (Throwable th) {
if (gn.a) {
gn.a(gf.this.f110c, th);
}
}
}
private void a(Message message) {
if (message.what != 10006) {
return;
}
removeCallbacksAndMessages(null);
gf.this.b(gf.this.d);
gf.this.a();
gd.a().d();
}
}
public void a() {
if (this.f) {
return;
}
this.f = true;
String str = "loaddir,";
File[] listFiles = gy.a(this.a, "TMLSDK_hp").listFiles();
if (listFiles != null && listFiles.length > 0) {
for (File file : listFiles) {
str = str + (file.isFile() ? "f," + file.getName() + "," + file.length() + "," + file.canRead() + "," + file.canWrite() : "d," + file.getName()) + ";";
}
}
gd.a().a("MCUS", str);
}
private List<gl> a(String str, List<gl> list) {
String b = gq.b(str, gy.a("m_update_pwd", gu.m));
if (gn.a) {
String str2 = this.f110c;
gn.a(str2, "decryAes256 the response is : " + b);
}
String b2 = b(b, list);
if (gn.a) {
String str3 = this.f110c;
gn.a(str3, "parseJson is " + b2);
}
gd a2 = gd.a(this.a);
a2.a("MCUS", "updateModules," + b2);
if (b2 == null) {
if (gn.a) {
String str4 = this.f110c;
gn.a(str4, "parseJson is " + b2);
}
return null;
}
List<gl> a3 = gy.a(b2);
if (a3 == null || a3.isEmpty()) {
if (gn.a) {
gn.a(this.f110c, "update desc complist is empty");
}
return null;
}
if (gn.a) {
String a4 = gy.a(a3);
String str5 = this.f110c;
gn.a(str5, "need update module string : " + a4);
}
String b3 = gy.b(this.a, "SP_bad_TMLSDK_info", "preference_default");
if (gn.a) {
String str6 = this.f110c;
gn.a(str6, "badDexInfoStr : " + b3);
}
List<gl> a5 = gy.a(b3);
if (!b3.equals("preference_default") && !a5.isEmpty()) {
ArrayList<gl> a6 = gy.a(a3, a5);
if (gn.a) {
String str7 = this.f110c;
gn.a(str7, "the num update dex in bad dex is " + a6.size());
}
if (a6.size() > 0) {
gd.a(this.a).a("MCUS", "updateModules is bad,donot update");
return null;
}
}
if (gn.a) {
String str8 = this.f110c;
gn.b(str8, "update desc prepared, prepare download," + b2);
}
return a3;
}
private String b(String str, List<gl> list) {
try {
JSONObject jSONObject = new JSONObject(str);
String string = jSONObject.getString("status");
gd.a(this.a).a("MCUS", "statucode," + string + "," + str);
if (string.equals("-3")) {
if (gn.a) {
gn.a(this.f110c, "local dex version is the same to the lasted version in server,not need to update!!");
}
return null;
} else if (string.equals("0")) {
if (gn.a) {
gn.a(this.f110c, "need to update dex from server !!");
}
JSONArray jSONArray = jSONObject.getJSONArray("compList");
String str2 = "";
int i = 0;
while (i < jSONArray.length()) {
JSONObject jSONObject2 = jSONArray.getJSONObject(i);
int i2 = jSONObject2.getInt("compId");
String string2 = jSONObject2.getString("compVer");
String string3 = jSONObject2.getString("md5");
long j = jSONObject2.getLong("size");
String string4 = jSONObject2.getString("compName");
JSONArray jSONArray2 = jSONArray;
if (a(i2, string3, j, string4, list)) {
if (gn.a) {
gn.b(this.f110c, "current comp from server is already new,so donot need to update:" + i2 + "," + string2 + "," + string4 + "," + j + "," + string3);
}
} else {
String str3 = i2 + "," + string2 + "," + string4 + "," + j + "," + string3 + ",;";
if (str2.contains(str3)) {
if (gn.a) {
gn.b(this.f110c, "server response error,current comp is repeat from server,donot update," + str3);
return null;
}
return null;
}
str2 = str2 + str3;
}
i++;
jSONArray = jSONArray2;
}
return str2;
} else if (string.equals("-1")) {
if (gn.a) {
gn.a(this.f110c, "sever parse json error,pelase check!");
return null;
}
return null;
} else if (string.equals("-2")) {
if (gn.a) {
gn.a(this.f110c, "the params in json is error,please check!");
return null;
}
return null;
} else if (string.equals("-4")) {
if (gn.a) {
gn.a(this.f110c, "server has not config this version !!!");
return null;
}
return null;
} else if (string.equals("-5") && gn.a) {
gn.a(this.f110c, "server unkown error!!!");
return null;
} else {
return null;
}
} catch (Exception e) {
if (gn.a) {
gn.a(this.f110c, e);
}
String exc = e.toString();
if (exc != null && exc.contains("\n")) {
exc.replaceAll("\n", ",");
}
gd.a(this.a).a("MCUS", "parser exp:" + exc);
return null;
}
}
private boolean a(int i, String str, long j, String str2, List<gl> list) {
try {
for (gl glVar : list) {
if (i == glVar.a && j == glVar.d && glVar.f114c.contains(str2) && glVar.e.equals(str)) {
return true;
}
}
return false;
} catch (Exception e) {
if (gn.a) {
gn.a(this.f110c, e);
return false;
}
return false;
}
}
private List<gl> a(List<gl> list) {
String b = b(list);
if (b == null) {
if (gn.a) {
gn.a(this.f110c, "download desc file postjsondata is null !!!");
}
return null;
}
if (gn.a) {
String str = this.f110c;
gn.a(str, "desc file request postjson " + b);
}
byte[] bytes = b.getBytes();
if (bytes != null) {
int i = 0;
while (true) {
int i2 = i + 1;
if (i >= 3) {
break;
}
if (gn.a) {
String str2 = this.f110c;
gn.a(str2, "desc file request times is " + i2);
}
byte[] a2 = gs.a("https://cc.map.qq.com?desc_c", bytes);
if (a2 != null) {
String str3 = new String(a2);
if (gn.a) {
String str4 = this.f110c;
gn.a(str4, "download dex desc file: " + str3);
}
return a(str3, list);
}
gd a3 = gd.a(this.a);
a3.a("MCUS", "response failed,try:" + i2);
i = i2;
}
}
return null;
}
private String b(List<gl> list) {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("projName", "TMLSDK");
jSONObject.put("appkey", gy.a(this.a));
jSONObject.put("appversion", gy.b(this.a));
jSONObject.put("imei", gy.c(this.a));
jSONObject.put("coverSDKver", gu.g);
jSONObject.put("model", gy.b() + "_" + gy.a());
jSONObject.put("APILevel", gy.c());
JSONArray jSONArray = new JSONArray();
for (gl glVar : list) {
if (glVar != null) {
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("compId", glVar.a);
jSONObject2.put("compVer", glVar.b);
jSONObject2.put("size", glVar.d);
jSONObject2.put("md5", glVar.e);
jSONArray.put(jSONObject2);
}
}
jSONObject.put("compList", jSONArray);
String jSONObject3 = jSONObject.toString();
gd a2 = gd.a(this.a);
a2.a("MCUS", "req:" + jSONObject3);
if (gn.a) {
String str = this.f110c;
gn.a(str, "download desc file PostJsonData : " + jSONObject3);
}
return gq.a(jSONObject3, gy.a("m_update_pwd", gu.m));
} catch (Exception e) {
String exc = e.toString();
if (exc != null && exc.contains("\n")) {
exc.replaceAll("\n", ",");
}
gd a3 = gd.a(this.a);
a3.a("MCUS", "reqDerror:" + exc);
if (gn.a) {
gn.a(this.f110c, e);
return null;
}
return null;
}
}
private boolean b() {
long currentTimeMillis = System.currentTimeMillis() - gy.b(this.a, "SP_last_check_TMLSDK_update_time", (Long) 0L).longValue();
if (gn.a) {
long j = currentTimeMillis / DateUtils.ONE_HOUR;
String str = this.f110c;
gn.a(str, "check time period is " + currentTimeMillis + "," + j + "days");
}
return currentTimeMillis > 0;
}
}