feat(debug): 扩展 DebugActivity 系统控制功能

新增进程管理、默认桌面设置、通知渠道、快捷方式及多种系统配置接口
This commit is contained in:
2026-08-28 17:09:25 +08:00
parent 314c053e56
commit b381678756
25 changed files with 2776 additions and 521 deletions

View File

@@ -1570,7 +1570,15 @@ public class Utils {
public static int getBattery(Context context) {
try {
BatteryManager batteryManager = (BatteryManager) context.getSystemService(Context.BATTERY_SERVICE);
return batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY);
if (batteryManager == null) {
return 0;
}
int capacity = batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY);
// -1 表示设备无法获取电量(无电池或底层未上报),归一到 0 避免下游误判
if (capacity < 0 || capacity > 100) {
return 0;
}
return capacity;
} catch (Exception e) {
Log.e("getBattery", "getBattery" + e.getMessage());
}