增加日志

serial
Matthew 1 year ago
parent 9a4433239a
commit 065d667fea

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

Loading…
Cancel
Save