Commit Graph

70 Commits

Author SHA1 Message Date
yjj38 d2d95ada82 refactor(app): 优化代码结构和可读性
- 格式化代码,调整缩进和空格
- 添加方法注释,解释主要功能
- 修改变量命名,提高可读性
- 删除冗余代码和不必要的注释
2025-07-11 15:29:27 +08:00
yjj38 c3467add0e refactor(device): 重构 ArmCloudApiClient 类
- 格式化代码,提高可读性
- 优化 JSON 构建和解析逻辑
- 统一异常处理方式
- 简化部分代码结构,提高维护性
2025-07-11 10:59:48 +08:00
yjj38 237f07f968 fix(app): 修改设备加载任务执行周期
- 将 LoadDeviceWorker 的执行周期从 30秒改为 30 分钟- 优化了后台任务的执行频率,减少不必要的资源消耗
2025-07-10 18:01:39 +08:00
yjj38 7b93852e89 refactor(app): 修改设备加载工作器的执行周期
- 将 LoadDeviceWorker 的执行周期从30 分钟改为 30 秒
- 删除了 .idea/misc.xml 文件中的 XML 声明
2025-07-10 17:29:40 +08:00
yjj38 14648729aa Merge branch 'Retention' of http://47.108.156.251:3000/yjj/agent-bigo into Retention 2025-07-10 17:13:55 +08:00
yjj38 d7774c2ac6 feat(app): 优化应用初始化和权限请求逻辑
- 重构了 MainActivity 中的 onCreate 方法,优化了应用初始化流程
- 添加了请求存储权限的独立方法 requestStoragePermission
- 实现了只在工作不存在时调度周期性工作的逻辑 schedulePeriodicWorkIfNotExists
- 优化了按钮点击事件的处理,提高了代码可读性和健壮性
- 新增了部署配置文件 deployment.xml,用于腾讯云服务器配置
2025-07-10 17:13:42 +08:00
Administrator ebe5f7df78 packageName空判断 2025-07-10 17:10:53 +08:00
Administrator 076240c559 Merge remote-tracking branch 'origin/Retention' into Retention 2025-07-10 16:34:33 +08:00
yjj38 9acc35fa7b refactor(app): 限制 scriptResultQueue 的容量
- 将 scriptResultQueue 的容量从无限制改为 1
- 此修改旨在防止队列无限增长可能导致的内存问题
2025-07-10 15:02:21 +08:00
yjj38 faa865cb34 build: 添加 ProGuard 规则以保留必要类和方法
- 保留 ArmCloudApiClient 及其公共方法和构造函数
-保留 PropertyItem 内部类及其字段、构造函数和 toJson 方法- 保留枚举类及其 values 和 valueOf 方法
- 保留使用 @SerializedName 注解的字段- 可选地保留注解信息
2025-07-10 14:30:13 +08:00
yjj38 64449de581 chore: 删除 ProGuard 配置文件
删除了 app/proguard-rules.pro 文件,该文件为空且不包含任何有用的配置信息。这个文件的存在可能是由于历史原因或开发过程中的临时需要,但目前项目中已不再需要它。
2025-07-10 14:07:21 +08:00
Administrator 67ac7b8d94 2025-07-10 14:07:11 +08:00
yjj38 175db8f49b refactor(device): 重构设备列表查询接口并优化日志输出- 重写 getDeviceCodes 方法,改为 getInstanceListInfo,优化参数设计
- 移除未使用的 getDeviceInfo 方法
- 在关键步骤添加调试日志输出,便于问题排查
- 更新网络配置,添加新的服务器 IP
2025-07-10 11:41:50 +08:00
yjj38 247db8b28e refactor(MainActivity): 移除获取 AndroidId 的硬编码方法
- 删除了 `getAndroidId` 方法,该方法返回一个硬编码的字符串。
2025-07-09 21:18:16 +08:00
yjj38 4e06a78ac7 refactor(MainActivity): 移除获取 AndroidId 的硬编码方法
- 删除了 `getAndroidId` 方法,该方法返回一个硬编码的字符串。
2025-07-09 21:17:04 +08:00
yjj38 84db43d571 feat(proxy): 新增国家代码切换功能并引入OkHttp依赖
- 新增 `CountryCode` 类,用于管理和切换国家代码(目前支持US和RU)。
- 在 `LoadDeviceWorker` 和 `MainActivity` 中引入 `CountryCode` 以实现国家切换。
- `MainActivity` 中的 `startProxyVpn` 方法现在使用 `CountryCode.switchCountry()` 来获取当前国家代码。
- `ClashUtil` 中引入 `okhttp3.logging.HttpLoggingInterceptor`。
- 在 `app/build.gradle` 中添加 `okhttp` 和 `logging-interceptor` 依赖。
- 修改了 `MainActivity` 中 `startProxyVpn` 失败时的日志记录标签。
2025-07-09 21:15:17 +08:00
yjj38 d35aa11cdd refactor(proxy): 添加按端口切换代理功能并优化日志记录
- 新增 `getProxyPort` 方法,用于从 `ip.port.json` 文件中读取代理端口。
- 新增 `switchProxyWithPort` 方法,用于根据国家和端口号调用服务器接口切换代理。
- `switchProxyGroup` 方法中的网络请求改为同步执行,并增加了对响应体是否为空的判断。
- 优化了 OkHttpClient 实例的创建,使用共享的 `sharedClient` 并添加了连接和读取超时以及日志拦截器。
- `LoadDeviceWorker` 中 `startProxyVpn` 方法的日志标签从 `TAG` 改为 `MainActivity`。
2025-07-09 21:06:41 +08:00
yjj38 2b60f10351 refactor(proxy): 切换代理逻辑调整
- 将 `ClashUtil.switchProxyGroup` 调用替换为 `ClashUtil.switchProxyWithPort(CountryCode.switchCountry())`
- 移除了 `MainActivity` 中的 `executeSingleLogic` 方法,相关逻辑已在 `LoadDeviceWorker` 中处理
- 在 `LoadDeviceWorker` 和 `MainActivity` 的 `startProxyVpn` 方法中,使用 `TAG` 记录日志,并更新了代理切换逻辑。
2025-07-09 21:04:28 +08:00
yjj38 20eaac8e12 Refactor: 更新实例属性时获取更多设备码
将 `client.getDeviceCodes` 方法中获取设备码的数量从 1 调整为 100,以便在更新实例属性时有更多可用的设备码。
2025-07-09 20:50:32 +08:00
yjj38 c1cdbfeffc refactor(device): 重构设备信息修改和ARM云API客户端逻辑
- `ArmCloudApiClient`:移除构造函数中的 `baseUrl`、`accessKey` 和 `secretKey` 参数,将这些值硬编码到类中。
- `ChangeDeviceInfoUtil`:
    - `changeDeviceInfo` 方法:移除 `padCodes` 参数,改为在方法内部通过 `armClient.getDeviceCodes` 获取。
- `LoadDeviceWorker`:
    - `executeSingleLogic` 方法:在调用 `ChangeDeviceInfoUtil.changeDeviceInfo` 时传递 `MainActivity.armClient`。
- `MainActivity`:
    - 新增 `armClient` 静态成员变量,并在 `onCreate` 中初始化 `ArmCloudApiClient` 实例。
    - 修改 `modifyDeviceInfoButton` 的点击事件,在调用 `ChangeDeviceInfoUtil.changeDeviceInfo` 时传递 `armClient`。
    - `executeSingleLogic` 方法:在调用 `ChangeDeviceInfoUtil.changeDeviceInfo` 时传递 `armClient`。
    - 移除了 `getAndroidId(Context context)` 方法中未使用的代码。
    - 简化了 `onCreate` 方法中的按钮初始化逻辑,引入了 `setupButton` 辅助方法。
    - 引入了 `logInfo`, `logError`, `logWarn`, `showToast` 等辅助方法以简化日志记录和UI提示。
    - 移除了未使用的 `instance` 静态成员变量和 `getInstance()` 方法。
    - 移除了 `executeLogic` 方法和相关的 `isRunning`、`taskLock` 成员变量,相关逻辑已移至 `LoadDeviceWorker`。
    - 调整了 `onDestroy` 方法的逻辑。
2025-07-09 20:27:48 +08:00
yjj38 f0339e7251 feat(ArmCloudApiClient): 新增设备列表查询功能并优化属性更新接口
- 新增 `getDeviceCodes` 方法,用于分页查询ARM设备列表并提取 `deviceCode`。该方法支持多种筛选条件,如实例分配状态、物理机状态、服务器编码等。
- 优化 `updateInstanceProperties` 方法:
    - 增加对 `padCodes` 参数重复项的校验。
    - 将 `padCodes` 的类型从 `JSONArray` 更改为 `new JSONArray(Arrays.asList(padCodes))`,以正确处理数组。
    - 完善了错误处理逻辑,对JSON构建、签名计算、接口返回错误码和响应解析失败等情况进行了更详细的日志记录和异常抛出。
    - 在接口请求成功后,增加了对响应体中 `code` 字段的校验,确保接口调用成功。
    - 将 `baseUrl` 设置为常量。
2025-07-09 19:38:31 +08:00
yjj38 6b507223b3 refactor(device): 重构设备信息修改逻辑并集成ArmCloud API
- 将设备信息修改的硬编码字符串替换为常量。
- `changeDeviceInfo` 方法现在接收 `ArmCloudApiClient` 和 `padCodes` 作为参数。
- 优化了Bigo和AF设备信息的处理逻辑,当对应的 `bigoDeviceObject` 或 `afDeviceObject` 为空时,会跳过相关设置并记录警告。
- 对于AF设备信息的系统属性修改,现在使用 `ArmCloudApiClient` 的 `updateInstanceProperties` 方法进行更新,替代了原有的 `ShellUtils.execRootCmd` 调用。
- 新增 `addProperty` 辅助方法,用于向 `List<PropertyItem>` 中添加非空属性。
- 新增 `execRootCmdIfNotEmpty` 辅助方法,用于执行非空的Shell命令并记录结果。
- 移除了直接通过 `ShellUtils.execRootCmd` 修改系统属性的代码,例如 `setprop ro.product.brand` 等。
- 确保在发生错误时抛出原始异常类型,而不是统一包装成 `RuntimeException`。
2025-07-09 18:36:26 +08:00
yjj38 2a7132d7b0 refactor(retention): 重构项目并添加新功能
- 更新包名从 com.example.studyapp 到 com.example.retention
- 添加 ArmCloudApiClient 类实现设备属性更新功能
- 更新所有相关类和文件以适应新的包名
2025-07-09 17:04:18 +08:00
yjj38 7cf941af6e feat(release): 新增签名配置并更新构建类型
- 新增 release 签名配置,使用 agent_retention.jks 密钥库
- 更新 release 构建类型,启用签名配置和代码混淆
- 移除旧的密钥库文件 (agentkey.jks, new-release-key.jks, your-release-key.jks)
- 更新 .idea/misc.xml 文件
2025-07-04 11:17:03 +08:00
yjj38 c999ee6f69 refactor(proxy): 移除代理检查国家功能并优化 VPN 启动逻辑
- 删除了 ClashUtil 类中的 checkCountryIsUS 方法,移除了检查国家是否为美国的功能
- 修改了 LoadDeviceWorker 类中的 startProxyVpn 方法,去除了返回值,简化了逻辑- 优化了 executeSingleLogic 方法的流程,移除了与代理检查国家相关的代码
2025-07-03 17:25:34 +08:00
yjj38 0ac201e93b refactor(main): 重构主函数并添加日志记录功能
- 新增 log 和 error 函数用于日志记录
- 重新封装 HTTP 请求和 API 处理逻辑
- 主函数增加错误处理和任务完成检查
- 添加定时器实现循环执行
2025-07-03 16:32:34 +08:00
yjj38 431267228f JDK升级到21,优化ClashUtil的代理切换和网络检查逻辑
- 项目的JDK版本从17升级到21。
- ClashUtil的`switchProxyGroup`方法改为同步执行,并增加了对HTTP响应状态码的检查。
- 新增`checkCountryIsUS`方法,用于通过ipinfo.io判断当前IP是否在美国,并在VPN启动后调用此方法进行验证。
- `LoadDeviceWorker`中的`startProxyVpn`方法现在会根据`checkCountryIsUS`的结果来决定是否继续执行后续操作。
- AutoJs脚本 (`main.js`) 更新,使用Promise和async/await来处理并行的HTTP请求,并分别调用ipv4.geojs.io的接口获取国家代码和详细地理位置信息。
2025-07-03 13:17:14 +08:00
Administrator 619e39cdc6 打包配置 2025-06-28 14:50:24 +08:00
Administrator d8dd6e740a 添加取消定时任务的方法 2025-06-26 18:18:37 +08:00
Administrator 203fccea87 下载安装 2025-06-26 16:51:31 +08:00
Administrator e619d85361 2025-06-26 14:02:58 +08:00
Administrator 6fa7c334ea 2025-06-25 19:06:03 +08:00
Administrator 951f6697e8 2025-06-25 19:02:51 +08:00
Administrator 4642f6e459 . 2025-06-25 18:09:58 +08:00
Administrator d21136edf5 . 2025-06-25 15:21:03 +08:00
Administrator a6c58716ec . 2025-06-25 13:59:07 +08:00
Administrator 33c53e8239 . 2025-06-25 10:57:15 +08:00
Administrator 1652482e79 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.
2025-06-25 10:56:53 +08:00
yjj38 cd09538426 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.
2025-06-21 16:13:55 +08:00
yjj38 ee67543b0a `refactor(TaskUtil): add taskId support, improved file/directory handling, and introduce compression/unzip utilities` 2025-06-21 14:39:57 +08:00
yjj38 7ce7a3d72e refactor(ShellUtils, TaskUtil): enhance shell execution and streamline file management
- Improved `ShellUtils` with enhanced logging, thread-management, and safety checks for shell command execution.
- Streamlined `TaskUtil`'s file operations with safer and more robust shell commands for deletion, copying, and compression.
- Replaced Java I/O-based file management in `TaskUtil` with shell-based operations for better performance and security.
- Added new helper methods like `delFileSh`, `copyFolderSh`, and `clearUpFileInDst` in `TaskUtil`.
2025-06-20 16:37:36 +08:00
yjj38 30985a0fa0 refactor(app): 重构应用主界面和功能代码
- 更新 activity_main.xml 布局,优化界面结构
- 重构 AutoJsUtil 类,提高代码可读性和维护性
- 改进 ChangeDeviceInfoUtil 类,增强设备信息修改功能
- 更新 build.gradle 配置,提升项目构建兼容性
2025-06-19 22:12:21 +08:00
yjj38 222a2002f9 Add `TaskUtil` for device and file operations; update `MainActivity` for Android ID handling and permissions
Introduced new `TaskUtil` utility class for device info upload, file compression, and remote operations. Updated `MainActivity` to dynamically fetch and utilize Android ID, added Android 13+ permission handling for `FOREGROUND_SERVICE`. Included Mockito dependencies for unit testing, implemented `TaskUtilTest` for API interaction validation. Adjusted `ChangeDeviceInfoUtil` initialization and fetched properties dynamically. Updated `minSdk` and network security configuration.
2025-06-18 14:31:11 +08:00
yjj38 984328b7eb Add release key, metadata, AF parameters, and APK for release configuration
Integrated the release keystore file, generated necessary metadata (`output-metadata.json`), and included detailed AF parameter configurations (`AF设备参数.txt`). Added the release APK and baseline profile files for optimized app deployment.
2025-06-16 16:38:13 +08:00
yjj38 2c9ca8ec44 Refactor `AutoJsUtil` and `MainActivity` to improve script execution and synchronization
Enhanced script execution flow with dedicated `broadcastLock` and `taskLock` for better synchronization. Improved logging, broadcast receiver management, and error handling in `AutoJsUtil`. Removed unused methods and redundant synchronization. Added counter for script runs and optimized lifecycle management for stability.
2025-06-13 19:02:53 +08:00
yjj38 c8650a2fac Enhance `ChangeDeviceInfoUtil` with `TextUtils` for null/empty checks and update deployment target configuration 2025-06-13 14:26:30 +08:00
yjj38 dc2fdd615e Refactor `AutoJsUtil` and `MainActivity` for enhanced script handling and synchronization
Introduced synchronized locking for script execution flow in `MainActivity` and added a robust broadcast receiver registration process in `AutoJsUtil`. Enhanced logging, error handling, and script management utilities. Updated `AutoJsUtil` with better file validation and context-aware lifecycle methods for improved stability and clarity.
2025-06-12 22:55:55 +08:00
yjj38 b6e312cf9e Enhance `ChangeDeviceInfoUtil` and `HttpUtil` for dynamic property updates and robust utilities
Refactored `ChangeDeviceInfoUtil` to dynamically fetch and apply device properties from JSON inputs. Added flexible handling of runtime values, improved error handling, and introduced `HttpUtil` methods for URL placeholders and retrieving the local IP address. Updated `MainActivity` and scripts for streamlined execution flow and better integration.
2025-06-12 11:31:46 +08:00
yjj38 657bb2c2c1 Dynamically fetch and apply device properties from API responses
Implemented dynamic retrieval of device properties from external APIs, parsing JSON responses, and replacing statically hardcoded values. Enhanced flexibility for device information management. Added error handling for JSON parsing and root access validation.
2025-06-10 19:54:32 +08:00
yjj38 c746633baf Dynamically fetch and apply device properties from API responses
Implemented dynamic retrieval of device properties from external APIs, parsing JSON responses, and replacing statically hardcoded values. Enhanced flexibility for device information management. Added error handling for JSON parsing and root access validation.
2025-06-10 11:45:44 +08:00