fix: return@try 语法错误 — 改用 if(started) 包裹 STOP 逻辑
This commit is contained in:
@@ -68,8 +68,8 @@ class AirDisplayService : Service() {
|
||||
}
|
||||
ACTION_STOP -> {
|
||||
Log.w(TAG, " 收到 STOP (started=$started)")
|
||||
if (!started) return@try START_NOT_STICKY
|
||||
started = false // 立即标记,防止重复 STOP
|
||||
if (started) {
|
||||
started = false
|
||||
scope.launch {
|
||||
Log.w(TAG, " manager.stop()...")
|
||||
manager.stop()
|
||||
@@ -81,6 +81,7 @@ class AirDisplayService : Service() {
|
||||
stopSelf()
|
||||
}
|
||||
}
|
||||
}
|
||||
START_NOT_STICKY
|
||||
} catch (e: Exception) {
|
||||
Log.wtf(TAG, "FATAL in onStartCommand", e)
|
||||
|
||||
Reference in New Issue
Block a user