|
|
@ -366,6 +366,8 @@ public class AppMaster {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
mService.logger.info(content);
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject jsonObject = new JSONObject(content);
|
|
|
|
JSONObject jsonObject = new JSONObject(content);
|
|
|
|
int isUpgrade = jsonObject.optInt("isUpgrade", 0);
|
|
|
|
int isUpgrade = jsonObject.optInt("isUpgrade", 0);
|
|
|
|
String url = jsonObject.optString("url", null);
|
|
|
|
String url = jsonObject.optString("url", null);
|
|
|
@ -425,6 +427,7 @@ public class AppMaster {
|
|
|
|
SysApi.reboot(mService.getApplicationContext());
|
|
|
|
SysApi.reboot(mService.getApplicationContext());
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_UPLOAD_LOGS)) {
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_UPLOAD_LOGS)) {
|
|
|
|
String url = jsonObject.optString("url", null);
|
|
|
|
String url = jsonObject.optString("url", null);
|
|
|
|
|
|
|
|
mService.logger.warning("Recv Upload Log" + url);
|
|
|
|
int noSpecData = jsonObject.optInt("noSpecData", 0);
|
|
|
|
int noSpecData = jsonObject.optInt("noSpecData", 0);
|
|
|
|
uploadLogs(url, noSpecData == 0);
|
|
|
|
uploadLogs(url, noSpecData == 0);
|
|
|
|
uploadMasterLogs(url);
|
|
|
|
uploadMasterLogs(url);
|
|
|
@ -448,6 +451,8 @@ public class AppMaster {
|
|
|
|
String path = jsonObject.optString("path", null);
|
|
|
|
String path = jsonObject.optString("path", null);
|
|
|
|
String fileName = jsonObject.optString("fileName", null);
|
|
|
|
String fileName = jsonObject.optString("fileName", null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mService.logger.warning("Recv Update Config: " + path + " " + fileName);
|
|
|
|
|
|
|
|
|
|
|
|
if (jsonConfigs != null) {
|
|
|
|
if (jsonConfigs != null) {
|
|
|
|
|
|
|
|
|
|
|
|
for (int idx = 0; idx < jsonConfigs.length(); idx++) {
|
|
|
|
for (int idx = 0; idx < jsonConfigs.length(); idx++) {
|
|
|
@ -467,8 +472,10 @@ public class AppMaster {
|
|
|
|
} catch (Exception ex) {
|
|
|
|
} catch (Exception ex) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_PUSH_FILE)) {
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_PUSH_FILE)) {
|
|
|
|
|
|
|
|
|
|
|
|
String path = jsonObject.optString("path", null);
|
|
|
|
String path = jsonObject.optString("path", null);
|
|
|
|
String content = jsonObject.optString("content", null);
|
|
|
|
String content = jsonObject.optString("content", null);
|
|
|
|
|
|
|
|
mService.logger.warning("Recv Push File: " + path);
|
|
|
|
|
|
|
|
|
|
|
|
File file = new File(path);
|
|
|
|
File file = new File(path);
|
|
|
|
File parentPath = file.getParentFile();
|
|
|
|
File parentPath = file.getParentFile();
|
|
|
@ -480,7 +487,6 @@ public class AppMaster {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
data = Base64.decode(content, Base64.DEFAULT);
|
|
|
|
data = Base64.decode(content, Base64.DEFAULT);
|
|
|
|
} catch (Exception ex) {
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (data != null) {
|
|
|
|
if (data != null) {
|
|
|
@ -502,6 +508,7 @@ public class AppMaster {
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_HOT_SPOT)) {
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_HOT_SPOT)) {
|
|
|
|
int enable = jsonObject.optInt("enable", 1);
|
|
|
|
int enable = jsonObject.optInt("enable", 1);
|
|
|
|
String name = jsonObject.optString("name", "XYMP");
|
|
|
|
String name = jsonObject.optString("name", "XYMP");
|
|
|
|
|
|
|
|
mService.logger.warning("Recv EN HotSpot: " + name + "=" + enable);
|
|
|
|
if (enable != 0) {
|
|
|
|
if (enable != 0) {
|
|
|
|
SysApi.openHotSpot(mService.getApplicationContext());
|
|
|
|
SysApi.openHotSpot(mService.getApplicationContext());
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -509,14 +516,18 @@ public class AppMaster {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_ENABLE_GPS)) {
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_ENABLE_GPS)) {
|
|
|
|
int enable = jsonObject.optInt("enable", 1);
|
|
|
|
int enable = jsonObject.optInt("enable", 1);
|
|
|
|
|
|
|
|
mService.logger.warning("Recv EN GPS: " + enable);
|
|
|
|
SysApi.enableGps(mService.getApplicationContext(), (enable != 0));
|
|
|
|
SysApi.enableGps(mService.getApplicationContext(), (enable != 0));
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_ENABLE_OTG)) {
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_ENABLE_OTG)) {
|
|
|
|
int enable = jsonObject.optInt("enable", 1);
|
|
|
|
int enable = jsonObject.optInt("enable", 1);
|
|
|
|
|
|
|
|
mService.logger.warning("Recv EN OTG: " + enable);
|
|
|
|
SysApi.setOtgState((enable != 0));
|
|
|
|
SysApi.setOtgState((enable != 0));
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_PULL_FILE)) {
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_PULL_FILE)) {
|
|
|
|
pullFiles(jsonObject);
|
|
|
|
pullFiles(jsonObject);
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_DELETE_FILE)) {
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_DELETE_FILE)) {
|
|
|
|
|
|
|
|
|
|
|
|
String path = jsonObject.optString("path", null);
|
|
|
|
String path = jsonObject.optString("path", null);
|
|
|
|
|
|
|
|
mService.logger.warning("Recv Del File: " + path);
|
|
|
|
deleteFile(path);
|
|
|
|
deleteFile(path);
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_IMPORT_PUB_KEY)) {
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_IMPORT_PUB_KEY)) {
|
|
|
|
|
|
|
|
|
|
|
@ -524,6 +535,7 @@ public class AppMaster {
|
|
|
|
String url = jsonObject.optString("url", null);
|
|
|
|
String url = jsonObject.optString("url", null);
|
|
|
|
String fileName = jsonObject.optString("fileName", null);
|
|
|
|
String fileName = jsonObject.optString("fileName", null);
|
|
|
|
String md5 = jsonObject.optString("md5", null);
|
|
|
|
String md5 = jsonObject.optString("md5", null);
|
|
|
|
|
|
|
|
mService.logger.warning("Recv Update OTA: " + url + " " + fileName);
|
|
|
|
if (!TextUtils.isEmpty(url)) {
|
|
|
|
if (!TextUtils.isEmpty(url)) {
|
|
|
|
upgradeOta(cid, cmd, url, fileName, md5);
|
|
|
|
upgradeOta(cid, cmd, url, fileName, md5);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -589,6 +601,7 @@ public class AppMaster {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String url = jsonObject.optString("url", null);
|
|
|
|
String url = jsonObject.optString("url", null);
|
|
|
|
|
|
|
|
mService.logger.warning("Recv Pull File: " + url);
|
|
|
|
if (url != null && !paths.isEmpty()) {
|
|
|
|
if (url != null && !paths.isEmpty()) {
|
|
|
|
uploadFiles(url, paths);
|
|
|
|
uploadFiles(url, paths);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -704,6 +717,8 @@ public class AppMaster {
|
|
|
|
mService.logger.info("Upgrade APP: " + url);
|
|
|
|
mService.logger.info("Upgrade APP: " + url);
|
|
|
|
|
|
|
|
|
|
|
|
SysApi.installApk(context, apkPath, context.getPackageName(), true);
|
|
|
|
SysApi.installApk(context, apkPath, context.getPackageName(), true);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
mService.logger.warning("Failed to Download:" + url);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -728,6 +743,8 @@ public class AppMaster {
|
|
|
|
mService.logger.info("Upgrade OTA: " + url);
|
|
|
|
mService.logger.info("Upgrade OTA: " + url);
|
|
|
|
|
|
|
|
|
|
|
|
SysApi.installOTA(context, context.getPackageName(), otaPath);
|
|
|
|
SysApi.installOTA(context, context.getPackageName(), otaPath);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
mService.logger.warning("Failed to Download:" + url);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|