修复服务启动逻辑
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Fri Dec 19 10:59:14 GMT 2025
|
||||
#Fri Dec 19 12:39:12 GMT 2025
|
||||
stageCount=10
|
||||
libraryProject=
|
||||
baseVersion=15.14
|
||||
publishVersion=15.14.9
|
||||
buildCount=44
|
||||
buildCount=46
|
||||
baseBetaVersion=15.14.10
|
||||
|
||||
@@ -49,8 +49,8 @@ public class ControlCenterService extends Service {
|
||||
private AppConfigBean mCurrentConfigBean;
|
||||
private NotificationMessage mForegroundNotifyMsg;
|
||||
// 服务状态标记(volatile保证多线程可见性)
|
||||
private static volatile boolean isServiceRunning;
|
||||
private static volatile boolean mIsDestroyed;
|
||||
private static volatile boolean isServiceRunning = false;
|
||||
private static volatile boolean mIsDestroyed = true;
|
||||
|
||||
// ================================== 服务生命周期方法(按执行顺序排列:onCreate→onStartCommand→onBind→onDestroy)=================================
|
||||
@Override
|
||||
@@ -110,14 +110,14 @@ public class ControlCenterService extends Service {
|
||||
* 服务核心运行逻辑,在onCreate/onStartCommand复用
|
||||
* 避免重复初始化,保证前台服务优先启动
|
||||
*/
|
||||
private void runCoreServiceLogic() {
|
||||
private synchronized void runCoreServiceLogic() {
|
||||
LogUtils.d(TAG, "runCoreServiceLogic: 执行核心逻辑");
|
||||
loadLatestServiceControlConfig();
|
||||
|
||||
boolean serviceEnabled = mServiceControlBean != null && mServiceControlBean.isEnableService();
|
||||
LogUtils.d(TAG, "runCoreServiceLogic: 服务启用=" + serviceEnabled + " | 已运行=" + isServiceRunning + " | 已销毁=" + mIsDestroyed);
|
||||
|
||||
if (serviceEnabled && !isServiceRunning && !mIsDestroyed) {
|
||||
if (serviceEnabled && !isServiceRunning) {
|
||||
isServiceRunning = true;
|
||||
mIsDestroyed = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user