Conversation
1. Root cause: deviceType2Icon map lacked the "audio-avrcp-target"
entry introduced by BlueZ 5.85, causing AVRCP-capable bluetooth
audio devices to show bluetooth_other instead of bluetooth_pheadset
2. Fix: add {"audio-avrcp-target", "pheadset"} to the map, and change
QMap::operator[] to .value(key, "other") so unmapped icon strings
fall back to "other" instead of an empty string
3. Impact: bluetooth audio devices with AVRCP profile now display the
correct headset icon; all other device types unaffected
Log: Fixed bluetooth audio device icon showing as unknown when device supports AVRCP profile
Influence:
1. Test bluetooth headset/speaker with AVRCP profile shows correct icon
2. Test common bluetooth devices (keyboard, mouse, phone) show correct icons
3. Verify unmapped device types fall back to default icon
fix: 补充蓝牙音频设备 audio-avrcp-target 图标映射
1. 根因:deviceType2Icon 映射表缺少 BlueZ 5.85 引入的
"audio-avrcp-target" 条目,导致支持 AVRCP 配置文件的蓝牙音频
设备显示 bluetooth_other 而非 bluetooth_pheadset
2. 方案:在映射表中添加 {"audio-avrcp-target", "pheadset"} 条目,
并将 QMap::operator[] 改为 .value(key, "other"),使未映射的
图标字符串回退到 "other" 而非空字符串
3. 影响:支持 AVRCP 配置文件的蓝牙音频设备现在显示正确的耳机
图标,其他设备类型不受影响
Log: 修复支持 AVRCP 配置文件的蓝牙音频设备图标显示为未知的问题
Influence:
1. 测试支持 AVRCP 配置文件的蓝牙耳机/音箱显示正确图标
2. 测试常见蓝牙设备(键盘、鼠标、手机)图标显示无回归
3. 验证未映射设备类型回退到默认图标
PMS: BUG-324977
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mhduiy The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe PR updates Bluetooth device icon resolution to correctly render AVRCP-capable audio devices as headsets while preserving existing mappings and making unknown BlueZ types resolve explicitly to the generic Flow diagram for Bluetooth device icon resolutionflowchart TD
A[BlueZ device type] --> B{deviceType2Icon lookup}
B -->|audio-avrcp-target| C[pheadset icon]
B -->|known device type| D[Mapped icon]
B -->|unmapped device type| E[other icon]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
TAG Bot New tag: 2.0.41 |
Root Cause Analysis
The
deviceType2Iconstatic map inplugins/dde-dock/bluetooth/componments/device.cppwas missing theaudio-avrcp-targeticon string introduced by BlueZ 5.85. When a bluetooth audio device supports the AVRCP profile, BlueZ sets its Icon property toaudio-avrcp-target, which fails the map lookup. TheQMap::operator[]returns an emptyQStringfor unmatched keys, causing the rendering logic inbluetoothadapteritem.cppto fall back tobluetooth_other(unknown icon). A previous fix (BUG-275675) addedaudio-headsetandaudio-headphonesbut omittedaudio-avrcp-target.Fix
Added
{"audio-avrcp-target", "pheadset"}to thedeviceType2Iconmap, and changedQMap::operator[]to.value(deviceType, "other")insetDeviceType()so that any future unmapped icon string falls back to"other"instead of an empty string, providing a more robust default.Change Safety Assessment
Code Safety
setDeviceType(adapter.cpp:55,adapter.cpp:101,adapter.cpp:140) pass BlueZ device type strings and are unaffected by the lookup method change — previously unmatched types returned empty string (falling back tobluetooth_other), now return"other"directly (same visual result)Business Impact Scope
Bluetooth device icon display in the taskbar. AVRCP-capable bluetooth audio devices (headsets, speakers) will now show the correct headset icon instead of the unknown device icon. All other device types (keyboard, mouse, phone, etc.) are unaffected.
Verification Suggestion
Test bluetooth headset/speaker with AVRCP profile shows the correct icon. Verify common bluetooth devices (keyboard, mouse, phone) still show correct icons with no regression.
根因分析
plugins/dde-dock/bluetooth/componments/device.cpp中的deviceType2Icon静态映射表缺少 BlueZ 5.85 引入的audio-avrcp-target图标字符串。当蓝牙音频设备支持 AVRCP 配置文件时,BlueZ 将其 Icon 属性设为audio-avrcp-target,映射查找失败后QMap::operator[]返回空QString,导致bluetoothadapteritem.cpp渲染逻辑回退到bluetooth_other(未知图标)。此前修复(BUG-275675)添加了audio-headset和audio-headphones但遗漏了audio-avrcp-target。修复方案
在
deviceType2Icon映射表中添加{"audio-avrcp-target", "pheadset"}条目,并将setDeviceType()中的QMap::operator[]改为.value(deviceType, "other"),使未来未映射的图标字符串直接回退到"other"而非空字符串,提供更健壮的默认值。改动安全评估
代码安全评估
setDeviceType的 3 个调用方(adapter.cpp:55、adapter.cpp:101、adapter.cpp:140)均传入 BlueZ 设备类型字符串,查找方式变更对其无影响——此前未匹配类型返回空字符串(回退到bluetooth_other),现在直接返回"other"(视觉效果一致)业务影响范围
任务栏蓝牙设备图标显示。支持 AVRCP 配置文件的蓝牙音频设备(耳机、音箱)现在将显示正确的耳机图标而非未知设备图标。其他设备类型(键盘、鼠标、手机等)不受影响。
验证建议
测试支持 AVRCP 配置文件的蓝牙耳机/音箱显示正确图标。验证常见蓝牙设备(键盘、鼠标、手机)图标显示无回归。
Summary by Sourcery
Fix Bluetooth device icon resolution for AVRCP audio devices and unknown device types.
Bug Fixes:
Enhancements: