Skip to content

Commit 1076218

Browse files
committed
android: add A16's new bluetooth identifier for log collection
just why...
1 parent 55cb69f commit 1076218

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

android/app/src/main/java/me/kavishdevar/librepods/utils/LogCollector.kt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,20 @@ class LogCollector(private val context: Context) {
5353
}
5454
}
5555

56+
private suspend fun getBluetoothUID(): String? {
57+
val pkgs = listOf("com.android.bluetooth", "com.google.android.bluetooth")
58+
for (pkg in pkgs) {
59+
val uid = executeRootCommand(
60+
"dumpsys package $pkg | grep -m 1 \"uid=\" | sed -E 's/.*uid=([0-9]+).*/\\1/'"
61+
).trim()
62+
if (uid.isNotEmpty()) return uid
63+
}
64+
return null
65+
}
66+
5667
private suspend fun getPackageUIDs(): Pair<String?, String?> {
5768
return withContext(Dispatchers.IO) {
58-
val btUid = executeRootCommand("dumpsys package com.android.bluetooth | grep -m 1 \"uid=\" | sed -E 's/.*uid=([0-9]+).*/\\1/'")
59-
.trim()
60-
.takeIf { it.isNotEmpty() }
61-
69+
val btUid = getBluetoothUID()
6270
val appUid = executeRootCommand("dumpsys package me.kavishdevar.librepods | grep -m 1 \"uid=\" | sed -E 's/.*uid=([0-9]+).*/\\1/'")
6371
.trim()
6472
.takeIf { it.isNotEmpty() }

0 commit comments

Comments
 (0)