太平测试 v1.17版本的 MD5 值为:0036a4d1bada4a8e01d451b732cf0c91
以下内容为反编译后的 b.java 源代码,内容仅作参考
package com.iflytek.collector.light.proxy;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Base64;
import com.iflytek.cloud.SpeechConstant;
import com.iflytek.collector.light.proxy.d;
import java.io.BufferedOutputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import org.json.JSONObject;
public class b implements Runnable {
protected Context a;
private d.a b = new d.a() {
@Override
public void a(d dVar, byte[] bArr) {
if (bArr != null) {
try {
b.this.a(new JSONObject(new String(bArr, "utf-8")));
} catch (Exception e) {
a(e);
}
}
}
@Override
public void a(Exception exc) {
e.b("Collector", "update dex error:" + exc);
}
};
private boolean c;
public b(Context context, boolean z) {
this.a = context;
this.c = z;
}
private void a() {
try {
SystemClock.sleep(10000L);
if (b() && h.a(this.a)) {
d dVar = new d();
dVar.b(20000);
dVar.a(1);
JSONObject jSONObject = new JSONObject();
jSONObject.put(SpeechConstant.APPID, DeviceInfoProxy.getProxy(this.a).getAppId());
jSONObject.put("ver", DeviceInfoProxy.getProxy(this.a).b());
dVar.a("https://logconf.iflytek.com/hotupdate", null, jSONObject.toString().getBytes("utf-8"));
dVar.b(this.b);
}
} catch (Exception e) {
e.c("Collector", "exception occur while update dex");
}
}
public static void a(Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (IOException e) {
}
}
}
public void a(JSONObject jSONObject) {
if ("yes".equalsIgnoreCase(jSONObject.optString("update"))) {
String optString = jSONObject.optString("dex");
if (!TextUtils.isEmpty(optString)) {
a(Base64.decode(optString, 0));
}
} else {
e.a("Collector", "no need to update");
}
SharedPreferences.Editor edit = h.b(this.a).edit();
edit.putLong("last_check_time", System.currentTimeMillis());
edit.apply();
}
private void a(byte[] bArr) {
FileOutputStream fileOutputStream;
FileOutputStream fileOutputStream2;
FileOutputStream fileOutputStream3 = null;
DeviceInfoProxy proxy = DeviceInfoProxy.getProxy(this.a);
proxy.d();
File file = new File(proxy.c());
File parentFile = file.getParentFile();
if (!parentFile.exists()) {
parentFile.mkdirs();
}
try {
fileOutputStream = new FileOutputStream(file);
try {
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream);
try {
bufferedOutputStream.write(bArr);
a(bufferedOutputStream);
a(fileOutputStream);
} catch (IOException e) {
e = e;
fileOutputStream3 = fileOutputStream;
fileOutputStream2 = bufferedOutputStream;
try {
e.printStackTrace();
a(fileOutputStream2);
a(fileOutputStream3);
} catch (Throwable th) {
th = th;
fileOutputStream = fileOutputStream3;
fileOutputStream3 = fileOutputStream2;
a(fileOutputStream3);
a(fileOutputStream);
throw th;
}
} catch (Throwable th2) {
th = th2;
fileOutputStream3 = bufferedOutputStream;
a(fileOutputStream3);
a(fileOutputStream);
throw th;
}
} catch (IOException e2) {
e = e2;
fileOutputStream2 = null;
fileOutputStream3 = fileOutputStream;
} catch (Throwable th3) {
th = th3;
}
} catch (IOException e3) {
e = e3;
fileOutputStream2 = null;
} catch (Throwable th4) {
th = th4;
fileOutputStream = null;
}
}
private boolean b() {
SharedPreferences b;
if (this.c || (b = h.b(this.a)) == null) {
return true;
}
return System.currentTimeMillis() - b.getLong("last_check_time", 0L) > 604800000;
}
@Override
public void run() {
a();
}
}