调研通 v3.0.3版本的 MD5 值为:fe075d21227d488bdb9f6aa09d3b3f35
以下内容为反编译后的 a.java 源代码,内容仅作参考
package com.iflytek.idata.extension;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Base64;
import com.iflytek.idata.extension.b;
import com.tencent.stat.DeviceInfo;
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 a implements Runnable {
protected Context f6908a;
private b.a f6909b = new b.a() {
@Override
public void a(b bVar, byte[] bArr) {
if (bArr != null) {
try {
a.this.a(new JSONObject(new String(bArr, "utf-8")));
} catch (Exception e2) {
a(e2);
}
}
}
@Override
public void a(Exception exc) {
com.iflytek.idata.extension.a.b.b("Collector", "update error:" + exc);
}
};
private boolean f6910c;
public a(Context context, boolean z) {
this.f6908a = context;
this.f6910c = z;
}
private void a() {
try {
SystemClock.sleep(com.heytap.mcssdk.constant.a.q);
if (b() && com.iflytek.idata.extension.a.a.a(this.f6908a)) {
b bVar = new b();
bVar.b(c.a.f.c.a.f157f);
bVar.a(1);
JSONObject jSONObject = new JSONObject();
jSONObject.put("appid", IFlyCollectorExt.a(this.f6908a).d());
jSONObject.put(DeviceInfo.TAG_VERSION, IFlyCollectorExt.a(this.f6908a).a());
jSONObject.put("impl", 2);
jSONObject.put("pkg", this.f6908a.getPackageName());
bVar.a("https://logconf.iflytek.com/hotupdate", null, jSONObject.toString().getBytes("utf-8"));
bVar.b(this.f6909b);
}
} catch (Throwable unused) {
com.iflytek.idata.extension.a.b.c("Collector", "exception occur while update");
}
}
private static void a(Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (IOException unused) {
}
}
}
public void a(JSONObject jSONObject) {
if ("yes".equalsIgnoreCase(jSONObject.optString("update"))) {
String optString = jSONObject.optString("msg");
if (!TextUtils.isEmpty(optString)) {
a(Base64.decode(optString, 0));
}
} else {
com.iflytek.idata.extension.a.b.a("Collector", "no need to update");
}
SharedPreferences.Editor edit = com.iflytek.idata.extension.a.a.b(this.f6908a).edit();
edit.putLong("last_check_time", System.currentTimeMillis());
edit.apply();
}
private void a(byte[] bArr) {
FileOutputStream fileOutputStream;
IFlyCollectorExt a2 = IFlyCollectorExt.a(this.f6908a);
a2.c();
File file = new File(a2.b(), com.iflytek.idata.extension.a.a.a());
BufferedOutputStream bufferedOutputStream = null;
try {
fileOutputStream = new FileOutputStream(file);
try {
BufferedOutputStream bufferedOutputStream2 = new BufferedOutputStream(fileOutputStream);
try {
bufferedOutputStream2.write(bArr);
a(bufferedOutputStream2);
} catch (Throwable th) {
th = th;
bufferedOutputStream = bufferedOutputStream2;
try {
th.printStackTrace();
a(bufferedOutputStream);
a(fileOutputStream);
} catch (Throwable th2) {
a(bufferedOutputStream);
a(fileOutputStream);
throw th2;
}
}
} catch (Throwable th3) {
th = th3;
}
} catch (Throwable th4) {
th = th4;
fileOutputStream = null;
}
a(fileOutputStream);
}
private boolean b() {
SharedPreferences b2;
if (this.f6910c || (b2 = com.iflytek.idata.extension.a.a.b(this.f6908a)) == null) {
return true;
}
return System.currentTimeMillis() - b2.getLong("last_check_time", 0L) > com.google.android.gcm.b.f4081a;
}
@Override
public void run() {
a();
}
}