音质助手
9.5.1 · GitHub
More about this app
Bluetooth codec fix for Xiaomi HyperOS: restores each earphone's chosen codec and bitrate after A2DP reconnects using Shizuku plus accessibility UI automation.
音质助手 · Bluetooth Codec Auto-Fix
免 Root 的安卓应用:蓝牙耳机每次重连后,自动恢复你选定的编码器与码率
Root-free Android app that restores your chosen Bluetooth codec & bitrate on every earphone reconnect
功能 · 工作原理 · 下载 · CLI · English
中文
有些耳机明明支持 LHDC/LDAC,却每次重连都掉回 AAC——手动切回去麻烦又容易忘。音质助手会在耳机连上的几秒内自动把编码器和码率恢复成你选定的组合,息屏可用,全程免 Root。
功能
- 重连自动修复:A2DP 连接建立后数秒内自动写入你选定的编码器与码率;修复失败自动重试,建连初期的编码器回退也会被自动纠正
- 实时状态面板:当前编码器、采样率、位深、码率档位实时可见,不用再去开发者选项里翻
- 完整编码器与码率档位:SBC / AAC / aptX 系列 / LDAC(990/660/330/自适应)/ LHDC 全系(最高 900kbps/自适应),与系统设置一致
- 每耳机预设:不同耳机各自记忆编码器与码率,连接后各修各的;自动识别耳机能力,不支持的组合自动跳过
- 无需无障碍服务:日常修复走系统接口直写;无障碍 UI 流程仅作为可选兜底,默认关闭
- 免 Root:无需解锁 Bootloader;可选配合 Shizuku 实现新耳机自动接入与自适应码率探测
- CLI:adb 一条命令查询状态、触发修复,方便集成到自动化脚本
工作原理
耳机重连
↓
系统唤醒(CompanionDeviceManager 在场回调,进程未运行也会被拉起)
↓
按该耳机的预设写入编码器偏好(系统接口直写)
↓
读回校验,不符自动重写(码率回落等场景)
↓
连接后短窗口内持续看守,编码器被改偏则自动纠正
API 修复始终失败时,可开启「无障碍 UI 兜底」:由无障碍服务自动操作系统设置页完成切换(默认关闭)。
系统要求
- Android 8.0+
- 主要在小米 HyperOS 3 上开发与实测;其他 ROM / 机型不保证可用,欢迎反馈
- 可选:Shizuku 运行中——用于新耳机自动接入与自适应码率探测;不运行也不影响修复本身
下载与使用
- 从 Releases 下载 APK 安装(或自行编译)
- 打开 app,选择协议与码率,打开「连接后自动切换」
- 连接耳机——之后每次重连都会自动恢复
- 推荐(非必需):启动 Shizuku 并授权,新耳机首次连接会自动完成接入
CLI
adb shell content call --uri content://com.lhdcprobe.cli --method <命令> [--arg <参数>]
| 命令 | 说明 |
|---|---|
live |
实时状态快照(编码器/采样率/位深/码率) |
devices |
已连接 A2DP 设备 |
fix |
立即按当前配置修复 |
auto on / auto off |
自动修复开关 |
status / write / watch / optional / log / cdm |
状态 / 写入 / 连接监听 / 可选编解码器 / 日志 / 关联 |
宿主侧封装脚本见 scripts/lhdc.sh。
编译
./gradlew :app:assembleDebug
需要 JDK 17+ 与 Android SDK(compileSdk=36);Shizuku API jar 已内置在 app/app/libs/。
许可证
鸣谢
- RikkaApps/Shizuku
- 所有反馈问题的用户
English
Some earphones silently fall back to AAC on every reconnect even though they support LHDC or LDAC. This app restores your chosen codec and bitrate within seconds of the earphone connecting — screen-off friendly, no root required.
Features
- Auto-fix on reconnect: writes your selected codec & bitrate right after A2DP connects; failed writes are retried, and early-codec fallbacks are corrected automatically
- Live status panel: current codec, sample rate, bit depth and bitrate tier at a glance
- Full codec & bitrate coverage: SBC / AAC / aptX family / LDAC (990/660/330/adaptive) / LHDC family (up to 900 kbps/adaptive), matching the system settings UI
- Per-earphone presets: each earphone remembers its own codec & bitrate; unsupported combinations are skipped automatically
- No accessibility service required: daily fixes go through direct system API writes; the accessibility-based UI flow is an optional fallback, off by default
- No root: optionally pairs with Shizuku for automatic onboarding of new earphones and adaptive-bitrate probing
- CLI: query status or trigger fixes with a single adb command
How it works
Earphone connects
↓
Woken by the system (CompanionDeviceManager presence callback)
↓
Codec preference written via system API (per-earphone preset)
↓
Read-back verification with automatic retry
↓
Short guard window corrects any post-connect fallback
If the API path keeps failing, an optional accessibility-based fallback (off by default) can drive the system settings page instead.
Requirements
- Android 8.0+
- Developed and tested mainly on Xiaomi HyperOS 3; other ROMs are not guaranteed — feedback is welcome
- Optional: Shizuku running for new-earphone onboarding and adaptive-bitrate probing
Download
Grab the APK from Releases, pick a codec and bitrate, enable auto-switch — done. See the Chinese section above for the full CLI and build instructions.
License
How Shizuku is used
Can restore saved Bluetooth codec and playback quality via Settings automation and test codec settings via Bluetooth codec controls through Shizuku using shell commands like `am start` and `input tap`
This is an AI-assisted analysis of Shizuku-related usages in the app's public source code. It is best effort, so it may not catch every single usage.
How this app uses Shizuku
This app uses Shizuku to reapply each earphone's saved Bluetooth audio choice after reconnecting, plus test screens for checking codec behavior.
- Restore saved codec: after a remembered headset reconnects, the app opens system settings and reselects the saved codec option using
am startandinput tapshell commands through Shizuku, locating rows with on screen text checks. - Restore playback quality: together with the codec, it reselects the saved playback quality such as high bitrate using the same settings search plus
input tap,input textandinput swipeautomation through Shizuku. - Finish automation tidily: after a successful switch it can leave Settings with back key presses and resume music playback, and check whether Settings is in front using
input keyeventanddumpsys windowthrough Shizuku. - Test codec directly: diagnostics screens can read the current codec status and apply a high quality codec preference such as high sample rate and bit depth using Bluetooth codec controls through Shizuku.
- Link new earphones: for a new headset without a system association, the app can silently create the companion association using the
cmd companiondevice associateshell command through Shizuku. - Check live bitrate: the status view can estimate the current adaptive bitrate by reading recent system logs with the
logcatshell command through Shizuku.
Android APIs or commands used
BluetoothA2dp.getCodecStatus
BluetoothA2dp.setCodecConfigPreferenceBluetoothA2dp.isOptionalCodecsEnabledBluetoothA2dp.setOptionalCodecsEnabledBluetoothA2dp.enableOptionalCodecsBluetoothA2dp.disableOptionalCodecsCompanionDeviceManager.getMyAssociationsCompanionDeviceManager.startObservingDevicePresenceam startam force-stopinput tapinput textinput swipeinput keyeventdumpsys windowuiautomator dumpcmd companiondevice associatelogcat
Notable details
The diagnostics screens first try the Bluetooth codec read and write directly and only retry through Shizuku if that fails. The automatic Settings tap flow and log based bitrate check need Shizuku to run; the core auto fix write itself does not depend on the extra UI fallback switch.
Changelog
What's new for version 9.5.1
v9.5.1
中文
- 重连自动修复重做:A2DP 连接建立后直接写入选定的编码器与码率,读回校验 + 自动重试,连接后短窗口内防回退;息屏可用,通常 2~3 秒完成
- 无需无障碍服务:通过系统 CompanionDeviceManager 在场回调唤醒;新耳机经 Shizuku 自动完成接入(无障碍 UI 流程保留为可选兜底,默认关闭)
- 实时状态面板:编码器、采样率、位深、码率档位实时显示;LHDC/LDAC 全档位码率支持(含自适应探测)
- 新耳机普适接入:能力预检 + 对象级匹配,不支持的编码器自动跳过;修复偶发"隔天回退 AAC"的问题
- CLI:
adb shell content call --uri content://com.lhdcprobe.cli --method live等命令可直接查询与操作 - 界面精修:主界面只留日常操作,进阶能力收进「高级功能」二级页
适用:Android 8.0+;主要在小米 HyperOS 3 上实测,其他 ROM 不保证。
English
- Reworked auto-fix: selected codec & bitrate written right after A2DP connects, with read-back verification, retry and a post-connect guard window; usually done in 2–3 s, works with the screen off
- No accessibility service needed: woken via CompanionDeviceManager presence callbacks; new earphones onboard themselves through Shizuku (accessibility UI flow kept as an opt-in fallback, off by default)
- Live status panel: codec, sample rate, bit depth and bitrate tier in real time; full LHDC/LDAC bitrate tier support including adaptive probing
- Universal new-earphone onboarding: capability pre-check with object-level matching; fixes the occasional "back to AAC the next day" regression
- CLI: query and control via
adb shell content call --uri content://com.lhdcprobe.cli
Requires Android 8.0+. Developed and tested mainly on Xiaomi HyperOS 3; other ROMs are not guaranteed.
Permissions
11 permissions requested