Skip to content

Debloat your Android TV, install apps, browse and transfer files on it, all from your phone. Just 3 MB, no tracking, no root, no PC.

Remote volume: exact match on the fixed-device list; CHANGELOG wording

jesse-agent-23224cda62b2965
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 43417d0..4025ec2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,7 +12,7 @@ until this file has a section for its version.
## Unreleased
-- **Fixed:** On a Fire TV or another box on HDMI, the Remote's mute and volume keys are grayed out with the reason, instead of doing nothing: the box's volume is fixed there, so use the TV's own remote. [#307](../../pull/307)
+- **Fixed:** On a Fire TV or another HDMI box whose volume is fixed, the Remote's mute and volume keys are grayed out, with a line saying to use the TV's own remote. [#307](../../pull/307)
- **Fixed:** On the Remote, a perfectly still tap on empty space now closes the keyboard. [#300](../../pull/300)
- **Fixed:** Sending or installing a file picked from phone storage no longer drops the TV. [#301](../../pull/301)
- **Fixed:** Apps without a name no longer show a Java class name. [#303](../../pull/303)
diff --git a/adb/src/main/kotlin/app/tellyscope/adb/Remote.kt b/adb/src/main/kotlin/app/tellyscope/adb/Remote.kt
index 53d4a38..6d56a67 100644
--- a/adb/src/main/kotlin/app/tellyscope/adb/Remote.kt
+++ b/adb/src/main/kotlin/app/tellyscope/adb/Remote.kt
@@ -124,7 +124,11 @@ class Remote(private val session: AdbSession, private val keys: KeyHelper? = nul
val devices = Regex("""^\s*Devices:\s*(.+)$""", RegexOption.MULTILINE).find(block)?.groupValues?.get(1).orEmpty()
.split(Regex("""[\s,]+""")).filter { it.isNotEmpty() }
val codes = Regex("""([0-9a-fA-F]+) \(([^)]+)\)""").findAll(block).associate { it.groupValues[2] to it.groupValues[1].toLong(16) }
- return devices.isNotEmpty() && devices.all { d -> codes[d]?.let { c -> c != 0L && fixed.any { (it and c) == c } } == true }
+ // A list names each device exactly; a lone value is the old bitmask, tested bit by bit.
+ val listed = fixed.size > 1
+ return devices.isNotEmpty() && devices.all { d ->
+ codes[d]?.let { c -> c != 0L && fixed.any { if (listed) it == c else (it and c) == c } } == true
+ }
}
/** Volume keys per tap: 1 on a 15-step TV, 3 on 50, 7 on 100. Never under 1. */
diff --git a/adb/src/test/kotlin/app/tellyscope/adb/RemoteTest.kt b/adb/src/test/kotlin/app/tellyscope/adb/RemoteTest.kt
index 7c2144d..8af5fb0 100644
--- a/adb/src/test/kotlin/app/tellyscope/adb/RemoteTest.kt
+++ b/adb/src/test/kotlin/app/tellyscope/adb/RemoteTest.kt
@@ -189,6 +189,9 @@ class RemoteTest {
val mask = dump("hdmi").replace("0x1000,0x800,0x400,0x200000,0x40000,0x40001,0x80000", "0x2c400")
assertTrue(Remote.musicFixed(mask))
assertFalse(Remote.musicFixed(mask.replace("0x2c400", "0x2c000")))
+ // In a list, 0x40001 is its own device, not bit 0x1 (here the code of "earpiece").
+ val earpiece = dump("earpiece").replace("400 (hdmi)", "1 (earpiece)")
+ assertFalse(Remote.musicFixed(earpiece))
}
@Test fun volumeFixedReadsTheAudioDump() = runTest {