Skip to content

Commit aa3db92

Browse files
committed
docs: clarify run-as requires debug build for MAC injection
Address PR review comment: run-as only works on debuggable builds. Add prerequisite note directing users to install the debug/nightly APK. Remove the alternative adb settings method which also requires elevated privileges.
1 parent bc5a12b commit aa3db92

File tree

2 files changed

+26
-28
lines changed

2 files changed

+26
-28
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,13 @@ Until then, you must xposed. I used to provide a non-xposed method too, where th
7575

7676
#### Setup for OxygenOS/ColorOS 16 (Non-rooted)
7777

78-
For multi-device audio switching to work properly on non-rooted OxygenOS 16, you need to inject your phone's Bluetooth MAC address into the app's settings. This is a one-time setup:
78+
For multi-device audio switching to work properly on non-rooted OxygenOS 16, you need to inject your phone's Bluetooth MAC address into the app's settings. This is a one-time setup.
79+
80+
> [!IMPORTANT]
81+
> The `run-as` command only works with **debug builds** (e.g., the nightly APK from CI). If you installed a release build, reinstall with the debug APK first.
7982
8083
1. **Get your phone's Bluetooth MAC address:**
8184
- Go to Settings → About → Device Details → Bluetooth Address
82-
- Or use: `adb shell settings get secure bluetooth_address` (requires running once with a recently-root device or use the Settings method)
8385

8486
2. **Inject the MAC address via adb:**
8587
```bash

android/app/src/main/java/me/kavishdevar/librepods/services/AirPodsService.kt

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2547,35 +2547,31 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
25472547

25482548
try {
25492549
while (socket.isConnected) {
2550-
socket.let { it ->
2551-
val buffer = ByteArray(1024)
2552-
val bytesRead = it.inputStream.read(buffer)
2553-
var data: ByteArray
2554-
if (bytesRead > 0) {
2555-
data = buffer.copyOfRange(0, bytesRead)
2556-
sendBroadcast(Intent(AirPodsNotifications.AIRPODS_DATA).apply {
2557-
putExtra("data", buffer.copyOfRange(0, bytesRead))
2558-
})
2559-
val bytes = buffer.copyOfRange(0, bytesRead)
2560-
val formattedHex = bytes.joinToString(" ") { "%02X".format(it) }
2561-
// CrossDevice.sendReceivedPacket(bytes)
2562-
updateNotificationContent(
2563-
true,
2564-
sharedPreferences.getString("name", device.name),
2565-
batteryNotification.getBattery()
2566-
)
2567-
2568-
aacpManager.receivePacket(data)
2550+
val buffer = ByteArray(1024)
2551+
val bytesRead = socket.inputStream.read(buffer)
2552+
if (bytesRead > 0) {
2553+
val data = buffer.copyOfRange(0, bytesRead)
2554+
sendBroadcast(Intent(AirPodsNotifications.AIRPODS_DATA).apply {
2555+
putExtra("data", buffer.copyOfRange(0, bytesRead))
2556+
})
2557+
val bytes = buffer.copyOfRange(0, bytesRead)
2558+
val formattedHex = bytes.joinToString(" ") { "%02X".format(it) }
2559+
// CrossDevice.sendReceivedPacket(bytes)
2560+
updateNotificationContent(
2561+
true,
2562+
sharedPreferences.getString("name", device.name),
2563+
batteryNotification.getBattery()
2564+
)
25692565

2570-
if (!isHeadTrackingData(data)) {
2571-
Log.d("AirPodsData", "Data received: $formattedHex")
2572-
logPacket(data, "AirPods")
2573-
}
2566+
aacpManager.receivePacket(data)
25742567

2575-
} else if (bytesRead == -1) {
2576-
Log.d("AirPods Service", "Socket closed (bytesRead = -1)")
2577-
break
2568+
if (!isHeadTrackingData(data)) {
2569+
Log.d("AirPodsData", "Data received: $formattedHex")
2570+
logPacket(data, "AirPods")
25782571
}
2572+
} else if (bytesRead == -1) {
2573+
Log.d("AirPods Service", "Socket closed (bytesRead = -1)")
2574+
break
25792575
}
25802576
}
25812577
Log.d("AirPods Service", "Socket closed")

0 commit comments

Comments
 (0)