From 065d667feae7035b1b3f7c7133ee46959b5da564 Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 29 May 2024 14:21:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xypower/mpmaster/AppMaster.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/mpmaster/src/main/java/com/xypower/mpmaster/AppMaster.java b/mpmaster/src/main/java/com/xypower/mpmaster/AppMaster.java index 2d71c275..087dfe5d 100644 --- a/mpmaster/src/main/java/com/xypower/mpmaster/AppMaster.java +++ b/mpmaster/src/main/java/com/xypower/mpmaster/AppMaster.java @@ -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); } }