修复TTS语音服务在应用重启时,会播放的问题,TTS语音服务设定在充电状态与放电状态切换时播放。
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Tue Dec 30 18:16:29 HKT 2025
|
||||
#Tue Dec 30 10:40:14 GMT 2025
|
||||
stageCount=43
|
||||
libraryProject=
|
||||
baseVersion=15.14
|
||||
publishVersion=15.14.42
|
||||
buildCount=0
|
||||
buildCount=4
|
||||
baseBetaVersion=15.14.43
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user