fix: Steam starts on ROMs that refuse the Android ID read (#1421)

On a Redmi K70 (Android 14), tapping Steam drops straight back to the
main screen. The session thread dies while writing the guest network
link:

```
java.lang.IllegalArgumentException: Illegal char: - at offset 8
at android.provider.Settings$Secure.getStringForUser(Settings.java:6486)
at com.droiddeck.launcher.runtime.LinuxNetworkLinkComponent.describe(LinuxNetworkLinkComponent.kt:281)
```

The guest MAC is seeded from `ANDROID_ID`. That ROM throws from the
read, which had no guard. A failed read now uses the same fallback seed
as a missing ID. Devices that can read it keep the MAC they have now.

- `SeededMacTest`: stable MAC from an ID, and a read that throws the
ROM's exception falls back instead of crashing.
- REDMAGIC NP06J: the guest MAC is the same before and after the change
(`16:4e:5b:53:e9:ef`).

## Credits
Reported by lc666 on Discord.
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-10-23 16:08:53 -04:00
commit 92ef850999
2 files changed
+31 -7

No files matched your search

@@ -301,15 +301,18 @@ class LinuxNetworkLinkComponent(
}
}
private fun seededMac(): String {
val id = Settings.Secure.getString(appContext.contentResolver, Settings.Secure.ANDROID_ID) ?: "bannerlator"
val bytes = java.security.MessageDigest.getInstance("SHA-1").digest(id.toByteArray())
val b0 = (bytes[0].toInt() and 0xfc) or 0x02
return listOf(b0, bytes[1].toInt(), bytes[2].toInt(), bytes[3].toInt(), bytes[4].toInt(), bytes[5].toInt())
.joinToString(":") { "%02x".format(it and 0xff) }
}
private fun seededMac(): String =
seededMac { Settings.Secure.getString(appContext.contentResolver, Settings.Secure.ANDROID_ID) }
companion object {
internal fun seededMac(readId: () -> String?): String {
val id = runCatching(readId).getOrNull() ?: "bannerlator"
val bytes = java.security.MessageDigest.getInstance("SHA-1").digest(id.toByteArray())
val b0 = (bytes[0].toInt() and 0xfc) or 0x02
return listOf(b0, bytes[1].toInt(), bytes[2].toInt(), bytes[3].toInt(), bytes[4].toInt(), bytes[5].toInt())
.joinToString(":") { "%02x".format(it and 0xff) }
}
private const val TAG = "LinuxNetworkLink"
private const val LINK_FILE = "etc/droiddeck-net"
private const val LINK_INDEX = 2