Compare commits
4 Commits
powerbell-
...
powerbell-
| Author | SHA1 | Date | |
|---|---|---|---|
| 02c135fd8c | |||
| 2f42334f19 | |||
| 10348d2c8d | |||
| 21cdc219c8 |
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Mon Dec 29 21:40:10 HKT 2025
|
||||
stageCount=42
|
||||
#Tue Dec 30 18:46:42 HKT 2025
|
||||
stageCount=44
|
||||
libraryProject=
|
||||
baseVersion=15.14
|
||||
publishVersion=15.14.41
|
||||
publishVersion=15.14.43
|
||||
buildCount=0
|
||||
baseBetaVersion=15.14.42
|
||||
baseBetaVersion=15.14.44
|
||||
|
||||
@@ -36,9 +36,10 @@ public class ControlCenterServiceReceiver extends BroadcastReceiver {
|
||||
private static final int BROADCAST_PRIORITY = IntentFilter.SYSTEM_HIGH_PRIORITY - 10;
|
||||
private static final int BATTERY_LEVEL_MIN = 0;
|
||||
private static final int BATTERY_LEVEL_MAX = 100;
|
||||
private static final int INVALID_BATTERY = -1; // 无效电量标识
|
||||
|
||||
// ====================== 静态状态标记(volatile保证多线程可见性) ======================
|
||||
private static volatile int sLastBatteryLevel = -1; // 上次电量(多线程可见)
|
||||
private static volatile int sLastBatteryLevel = INVALID_BATTERY; // 上次电量(多线程可见)
|
||||
private static volatile boolean sIsCharging = false; // 上次充电状态(多线程可见)
|
||||
|
||||
// ====================== 成员变量区(弱引用防泄漏,按功能分层) ======================
|
||||
@@ -113,7 +114,8 @@ public class ControlCenterServiceReceiver extends BroadcastReceiver {
|
||||
}
|
||||
|
||||
// 在插拔充电线时,执行贴心服务
|
||||
if(currentCharging != sIsCharging) {
|
||||
if(currentCharging != sIsCharging && sLastBatteryLevel != INVALID_BATTERY) {
|
||||
//App.notifyMessage(TAG, String.format("sLastBatteryLevel %d", sLastBatteryLevel));
|
||||
if(currentCharging) {
|
||||
ThoughtfulService.startServiceWithType(service, ThoughtfulService.ServiceType.CHARGE_STATE);
|
||||
} else {
|
||||
|
||||
@@ -131,7 +131,7 @@ public class ThoughtfulService extends Service {
|
||||
|
||||
if (latestConfig.isEnableChargeReminder()) {
|
||||
int nChargeReminderValue = latestConfig.getChargeReminderValue();
|
||||
String szRemind = String.format("额定充电提醒已启用,额定值为百分之%d。", nChargeReminderValue);
|
||||
String szRemind = String.format("限量充电提醒已启用,限量值为百分之%d。", nChargeReminderValue);
|
||||
szRemind = szRemind + szRemind + szRemind;
|
||||
TTSPlayService.startPlayTTS(this, szRemind);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user