fix: 临时禁用蓝牙扫描排查耗电(enabled=false)
添加蓝牙扫描总开关,默认关闭。确认耗电改善后可重新开启。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -60,11 +60,18 @@ class BluetoothScanManager @Inject constructor(
|
|||||||
/** 当前网络类型(由外部更新) */
|
/** 当前网络类型(由外部更新) */
|
||||||
var currentNetworkType: String = ""
|
var currentNetworkType: String = ""
|
||||||
|
|
||||||
|
/** 蓝牙扫描总开关(设为 false 可完全禁用,排查耗电时使用) */
|
||||||
|
var enabled = false
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动蓝牙扫描(常规模式)
|
* 启动蓝牙扫描(常规模式)
|
||||||
* 调用前确保蓝牙可用
|
* 调用前确保蓝牙可用
|
||||||
*/
|
*/
|
||||||
fun start() {
|
fun start() {
|
||||||
|
if (!enabled) {
|
||||||
|
Timber.d("蓝牙扫描: 已禁用,忽略 start()")
|
||||||
|
return
|
||||||
|
}
|
||||||
if (state != State.STOPPED) {
|
if (state != State.STOPPED) {
|
||||||
Timber.d("蓝牙扫描: 已在运行,忽略 start()")
|
Timber.d("蓝牙扫描: 已在运行,忽略 start()")
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user