50 · 术语与类职责速查卡

两页纸:①术语表 ②本仓源文件 + settingslib 七姐妹一句话职责表。 关联:51-广播清单42-踩坑

A. 术语表

协议层

术语含义锚点
BR/EDR经典蓝牙(79×1MHz 信道),车机连手机走这个10 §1
BLE低功耗蓝牙(40 信道,间距2MHz),钥匙/传感器/信标[10] §1
ACL链路层基础管道,profile 跑其上;ACTION_ACL_CONNECTED 与 profile 无关[10] §4
SDP经典蓝牙服务发现协议(BLE 侧=GATT/ATT)[10] §3
UUID128bit 服务标识;16bit 短码展开 0000XXXX-0000-1000-8000-00805F9B34FB[10] §3
CoDClass of Device,24bit 类型码,major class 分 PHONE/AUDIO_VIDEO/…[10] §2
bond配对/绑定,交换并持久化密钥;BOND_NONE=10/BONDING=11/BONDED=1211 §1
SSPSecure Simple Pairing,四模式:Just Works/Numeric Comparison/Passkey Entry/OOB[11] §2
Link KeyBR/EDR 128bit P-256 鉴权钥,落盘 bt_config.conf[11] §1
LTK/IRKLE 长期钥/身份解析钥,SMP 分发[11] §5
CTKDCross-Transport Key Derivation,BR→LE 方向从 Link Key 派生 LTK[11] §5
EIRExtended Inquiry Result,扫描期广播包(含 UUID/Name),CarPlay 识别靠它12 §3
HFPHands-Free Profile,车机=HF 免提,手机=AG[12] §1.1
A2DP音频,车机=Sink 放音乐,手机=Source[12] §1.2
PBAP电话本同步,详情页唯一独立开关[12] §1.3
CarPlayApple 私有协议(非蓝牙 profile),蓝牙只 EIR UUID 识别,数据走 WiFi[12] §3

Android 框架层

术语含义锚点
BluetoothAdapter/Device公开 API,binder 到 com.android.bluetooth(IBluetooth) + system_server(IBluetoothManager)20 §1
BondStateMachineBluetooth App 进程配对状态机,发所有 BOND_xxx 广播;BONDED 前等 SDP[20] §2
Mainline 模块Bluetooth 自 Android 13 起 optional Mainline 模块,包名 com.android.bluetooth[20] §1.1
btsnoopHCI 层抓包日志,/data/misc/bluetooth/logs/,Wireshark 看[20] §5
isAutoConnectableLocalBluetoothProfile 接口方法,框架层判断用,settingslib connect 链不调21 §3
disableAutoConnect写 Settings.Secure bluetooth_close_autoconnect,CarPlay 配对时阻止自动连;f3dif 失效[12] §5.2

本仓 / flavor

术语含义锚点
flavor编译期 sourceSet:dcd→dcddif(骁龙8295) / xcd_cn_a14→xcddif(玄戒A14) / xcd_cn_a17→f3dif(玄戒A17主线) / xcd_global_a17→f3dif+global22 §1
MICAR-PORTING小米定制标记;f3dif 0 个(纯AOSP),仅 dcddif/xcddif 有[21] §8
DevicePairStageEvent三元组(isBusy/isConnected/mBondState)非枚举,边沿检测器32 §4
DOUBLE_BLUETOOTH_DEVICE_LIMIT双蓝牙上限=2,口径=已连 HFP/A2DP 数[32] §1
taskAffinity 顶替三对话框共用 car.settings.bluetooth+singleTask 互相顶替,CarPlay 弹窗需150ms延迟02 §3

B. 本仓源文件职责表(settingsPage/micarConnectionSettings/.../bluetooth/

类/文件职责关键行号
MiBluetoothUtils.kt蓝牙工具门面:扫描/配对/过滤/广播;getLocalBtManagerisDeviceClassTypeSupportpairgetLocalBtManager:73, isDeviceClassTypeSupport:141-170, pair:242-262, RADIO_DEVICE_ADDRESS_PREFIX:37
MiBluetoothPairingController.kt单一配对意图翻译器:variant→弹框类型→确认API;onPair/onCancelgetDialogType:94-114, onPair:244-281, onCancel:283(旧版仅cancelBondProcess,2956未修复)
MiBluetoothPairingRequest.ktBroadcastReceiver:ACTION_PAIRING_REQUEST 入口,三层过滤(类型/手柄/双蓝牙)双蓝牙:85, disableAutoConnect:106, 手柄直通:62-65
view/MiBluetoothPairingDialogActivity.kt配对弹窗 Activity,receiver 监听 bondStatemReceiver, dismiss(无mDismissed,2956未修复)
view/MiBluetoothPairingDialogFragment.kt配对弹窗 UI;自动 accept(isRequestPairAsClient)自动onPair:179-182
MiBluetoothPickerDialogActivity/Fragment.kt双蓝牙冲替 PickerdisplayBluetoothDevicePicker:45/53, dismiss接力:169
MiCarplayConnectTypeChooseDialogActivity/Fragment.ktCarPlay 配对后选蓝牙vs CarPlay选CarPlay deeplink:137
DevicePairStageEvent.java三元组状态值(边沿检测):7-9
BluetoothScanManager.kt扫描闸门单例(AtomicBoolean+ReadWriteLock+WeakReference)triggerScan:94, setCanExecuteScan:60
BluetoothDeviceService.ktIntentService,断开后更新 last device 给音乐 App:15
ConnectionUtils.kt互联能力判断(包名)+CarPlay UUID+disableAutoConnect+last deviceCARPLAY_128UUID:30-31, disableAutoConnect:88-95, recordLastConnectedDevice:143-167
ConnectionConstants.kt常量:DOUBLE_BLUETOOTH_DEVICE_LIMIT=2(:19)、LAST_BONDED_BLUETOOTH_DEVICE(:34)、BLUETOOTH_CLOSE_AUTO_CONNECT(ConnectionUtils:32)
MiBluetoothExt.ktperformConnect:16/performDisConnect:32/performUnpair:55/isPairingAsClient:68
MiBluetoothCollinear.kt唯一按 flavor 分:dcddif独立 + xcddif/f3dif共用
view/BluetoothSettingsActivity.kt蓝牙页入口;resetScanFlag:44;ACTION_CLOSE_ACTIVITY:26
view/BluetoothMainEntrySettingsFragment.java蓝牙主页 Fragment(BluetoothCallback);UI先行registerCallback:onStart:217
controller/BluetoothSwitchController.kt蓝牙开关,UI先行+防抖;mUIBluetoothSwitchStateresetScanFlag:209
controller/BluetoothUnbondedDevicesPrefController.java可用设备列表;持续扫描循环;DevicePairStageEvent消费triggerScan:128/171/419, 双蓝牙:524
controller/BluetoothBondedDevicesPrefController.java已配对列表;连接/断开/详情页入口handlePreferClick:167, showDisConnectConfirmDialog:221-244, connectDevice:246-301, 双蓝牙:295
controller/BluetoothOperationsController.java详情页 connect/disconnect/unpair 编排Connect:148, DisConnect:160, Unpair:179, 双蓝牙:132
controller/BluetoothDeviceProfilesPreferenceController.java详情页 profile 开关(钉死PBAP单引用)mPbapClientProfile:41, isShow:68
view/MiCarBluetoothDeviceDetailFragment.java设备详情页;MisComplexSdk监听getCachedDevice, onCreate:73-79

C. settingslib 七姐妹(base/settingsLibAndroid/src/{flavor}/.../bluetooth/

职责三 flavor 要点
LocalBluetoothManager单例,聚合四件套getInstance f3dif双参:60-62
LocalBluetoothAdapter包装 BluetoothAdapter,startScanning
BluetoothEventManager广播总线,action→Handler 路由 + mCallbacks广播数 dcddif18/xcddif29/f3dif20
CachedBluetoothDeviceManager设备缓存表 findDevice/addDevice
CachedBluetoothDevice设备聚合体(bond+profile+名称);connect/onBondingStateChanged/onUuidChangedonBondingStateChanged dcddif:839/xcddif:1050/f3dif双参:1147;黑名单仅 dcddif/xcddif
LocalBluetoothProfileManagerprofile 注册,updateLocalProfiles
BluetoothCallbackUI 接入接口方法数 dcddif10/xcddif15/f3dif11

改 settingslib 必须三栏对照(见 21 §8);f3dif 是纯 AOSP,MICAR 定制全回归