Update v1.2.2版本的 MD5 值为:87ab33f0c8bd4c1dd345062aa2794e73
以下内容为反编译后的 InstallHBO.java 源代码,内容仅作参考
package com.luxcine.luxcine_ota;
import android.content.SharedPreferences;
import android.os.SystemProperties;
import android.util.Log;
import android.util.Xml;
import com.luxcine.luxcine_ota.utils.Data;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.xmlpull.v1.XmlPullParser;
public class InstallHBO {
private static final String BASE_URL_UPDATE_HK = "http://www.chasecolor.com:8080/otaupdate/xml/";
private static final String FILE_NAME = "/data/data/com.luxcine.luxcine_ota/hbo.apk";
private static final String FILE_PATH = "/data/data/com.luxcine.luxcine_ota/";
private static final String TAG = "InstallHBO";
private static SharedPreferences.Editor editor;
private static SharedPreferences sp;
private int hbo_download = 0;
private List<Data> list;
private String usid;
private static String downloadUrl = null;
private static String hboUrl = null;
public void versionComparison() {
SharedPreferences sharedPreferences = MyApplication.getContext().getSharedPreferences("luxicne_ota", 0);
sp = sharedPreferences;
editor = sharedPreferences.edit();
this.usid = SystemProperties.get("ro.serialno", "marconi");
hboUrl = "http://www.chasecolor.com:8080/otaupdate/xml/update/hbo.xml";
Log.e(TAG, "download: ----usid:" + this.usid + ",hboUrl:" + hboUrl);
getVersion();
}
public void getVersion() {
Thread thread = new Thread() {
@Override
public void run() {
String path = InstallHBO.hboUrl;
try {
URL url = new URL(path);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setConnectTimeout(5000);
conn.setReadTimeout(5000);
if (conn.getResponseCode() == 200) {
InputStream is = conn.getInputStream();
InstallHBO.this.parseXmlInfo(is);
}
} catch (Exception e) {
e.printStackTrace();
Log.e(InstallHBO.TAG, "run: ---------e:" + e.toString());
}
}
};
thread.start();
}
public void parseXmlInfo(InputStream is) {
XmlPullParser xParser = Xml.newPullParser();
try {
xParser.setInput(is, "utf-8");
Data data = null;
for (int eventType = xParser.getEventType(); eventType != 1; eventType = xParser.next()) {
switch (eventType) {
case 2:
if (!"update".equals(xParser.getName())) {
if (!"version".equals(xParser.getName())) {
if ("sn".equals(xParser.getName())) {
String sn = xParser.nextText();
data.setSn(sn);
Log.e(TAG, "parseXmlInfo: -------------" + sn);
break;
} else {
break;
}
} else {
data = new Data();
break;
}
} else {
this.list = new ArrayList();
break;
}
case 3:
if ("version".equals(xParser.getName())) {
this.list.add(data);
break;
} else {
break;
}
}
}
if (this.list.size() <= 0) {
return;
}
for (int i = 0; i < this.list.size(); i++) {
if (this.list.get(i).getSn().equals(this.usid)) {
Log.e(TAG, "parseXmlInfo: -----------需要升级HBO的SN号:" + this.usid);
editor.putString("sn", this.usid);
editor.commit();
}
}
} catch (Exception e) {
e.printStackTrace();
Log.e(TAG, "parseXmlInfo: -----------e:" + e.toString());
}
}
}