百草园 v7.5版本的 MD5 值为:17f49811374a404d232d5b2cc35bf30f
以下内容为反编译后的 VersionManager.java 源代码,内容仅作参考
package com.baidu.cyberplayer.utils;
import android.os.Handler;
import android.os.HandlerThread;
import com.bumptech.glide.load.Key;
import java.io.IOException;
import java.net.URLEncoder;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import org.json.JSONObject;
public class VersionManager {
public static final int RET_ERROR_AKSK = 2;
public static final int RET_ERROR_NETWORK = 1;
public static final int RET_ERROR_NOTFOUND = 3;
public static final int RET_SUCCESS = 0;
private static VersionManager a;
private String f406a = "http://cybertran.baidu.com/mediasdk/video?method=sdkupdate";
public enum CPU_TYPE {
UNKNOWN,
ARMV5_NORMAL,
ARMV5_VFP,
ARMV6_NORMAL,
ARMV6_VFP,
ARMV7_VFP,
ARMV7_VFPV3,
ARMV7_NEON,
X86_NORMAL
}
public interface RequestCpuTypeAndFeatureCallback {
void onComplete(CPU_TYPE cpu_type, int i);
}
public interface RequestDownloadUrlForCurrentVersionCallback {
void onComplete(String str, int i);
}
public class a {
private CPU_TYPE f416a = null;
private String f418a = null;
private String b = null;
private int a = 0;
public a() {
}
}
public a a(int i, CPU_TYPE cpu_type, String str, String str2) {
int i2;
a aVar = new a();
long currentTimeMillis = System.currentTimeMillis();
String str3 = this.f406a + "&ak=" + str + "&time=" + currentTimeMillis + "&sign=" + C0125l.m516a(URLEncoder.encode(currentTimeMillis + "req_videotran" + str2.substring(0, 16))) + "&platform=android";
if (cpu_type != null) {
str3 = str3 + "&getso=1&version=" + "baidu_product_1_9_1_1".replace(".", "_") + "&cputype=" + a(cpu_type);
}
String str4 = null;
HttpPost httpPost = new HttpPost(str3);
try {
httpPost.setEntity(new StringEntity(C0125l.m515a(), "utf8"));
BasicHttpParams basicHttpParams = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(basicHttpParams, i);
HttpConnectionParams.setSoTimeout(basicHttpParams, i);
HttpResponse execute = new DefaultHttpClient(basicHttpParams).execute(httpPost);
if (execute.getStatusLine().getStatusCode() == 200) {
str4 = EntityUtils.toString(execute.getEntity(), Key.STRING_CHARSET_NAME);
}
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e2) {
e2.printStackTrace();
} catch (Exception e3) {
e3.printStackTrace();
}
if (str4 != null) {
i2 = 3;
try {
JSONObject jSONObject = new JSONObject(str4);
String optString = jSONObject.optString("errno");
if (cpu_type == null) {
if (!optString.equals("200") && !optString.equals("404")) {
}
aVar.f416a = b(jSONObject.optString("cputype"));
aVar.a = 0;
} else if (optString.equals("200")) {
aVar.b = jSONObject.optString("geturl");
aVar.a = 0;
} else if (optString.equals("403")) {
aVar.a = 2;
} else {
aVar.a = 3;
}
} catch (JSONException e4) {
e4.printStackTrace();
}
return aVar;
}
i2 = 1;
aVar.a = i2;
return aVar;
}
private static String a(CPU_TYPE cpu_type) {
return cpu_type == CPU_TYPE.ARMV5_NORMAL ? "armv5_none" : cpu_type == CPU_TYPE.ARMV5_VFP ? "armv5_vfp" : cpu_type == CPU_TYPE.ARMV6_NORMAL ? "armv6_none" : cpu_type == CPU_TYPE.ARMV6_VFP ? "armv6_vfp" : cpu_type == CPU_TYPE.ARMV7_VFP ? "armv7_vfp" : cpu_type == CPU_TYPE.ARMV7_VFPV3 ? "armv7_vfpv3" : cpu_type == CPU_TYPE.ARMV7_NEON ? "armv7_neon" : cpu_type == CPU_TYPE.X86_NORMAL ? "intel_none" : "unknown";
}
public static CPU_TYPE b(String str) {
return str == null ? CPU_TYPE.UNKNOWN : str.equals("armv5_none") ? CPU_TYPE.ARMV5_NORMAL : str.equals("armv5_vfp") ? CPU_TYPE.ARMV5_VFP : str.equals("armv6_none") ? CPU_TYPE.ARMV6_NORMAL : str.equals("armv6_vfp") ? CPU_TYPE.ARMV6_VFP : str.equals("armv7_vfp") ? CPU_TYPE.ARMV7_VFP : str.equals("armv7_vfpv3") ? CPU_TYPE.ARMV7_VFPV3 : str.equals("armv7_neon") ? CPU_TYPE.ARMV7_NEON : str.equals("intel_none") ? CPU_TYPE.X86_NORMAL : CPU_TYPE.UNKNOWN;
}
public static VersionManager getInstance() {
if (a == null) {
a = new VersionManager();
}
return a;
}
public void getCurrentSystemCpuTypeAndFeature(final int i, final String str, final String str2, final RequestCpuTypeAndFeatureCallback requestCpuTypeAndFeatureCallback) {
final HandlerThread handlerThread = new HandlerThread("getCurrentSystemCpuTypeAndFeature");
handlerThread.start();
new Handler(handlerThread.getLooper()).post(new Runnable() {
@Override
public void run() {
a a2 = VersionManager.this.a(i, null, str, str2);
if (a2.a != 0) {
a2.f416a = VersionManager.b(C0125l.b());
a2.a = 0;
}
requestCpuTypeAndFeatureCallback.onComplete(a2.f416a, a2.a);
handlerThread.quit();
}
});
}
public String getCurrentVersion() {
return "baidu_product_1_9_1_1";
}
public void getDownloadUrlForCurrentVersion(final int i, final CPU_TYPE cpu_type, final String str, final String str2, final RequestDownloadUrlForCurrentVersionCallback requestDownloadUrlForCurrentVersionCallback) {
final HandlerThread handlerThread = new HandlerThread("getDownUrlForCurrentVersion");
handlerThread.start();
new Handler(handlerThread.getLooper()).post(new Runnable() {
@Override
public void run() {
a a2 = VersionManager.this.a(i, cpu_type, str, str2);
requestDownloadUrlForCurrentVersionCallback.onComplete(a2.b, a2.a);
handlerThread.quit();
}
});
}
}