Skip to content

ADB: Keep Self-ADB UTF-8 compatible with Android 4.1–4.3 - #1210

Merged
o-jcardenass merged 1 commit into
andreknieriem:mainfrom
emotionbug:pr/legacy-self-adb-charset
Oct 30, 2026
Merged

o-jcardenass merged 1 commit into
andreknieriem:mainfrom
emotionbug:pr/legacy-self-adb-charset

Conversation

@emotionbug

Copy link
Copy Markdown
Contributor

StandardCharsets was added in API 19, while the GitHub APK supports API 16. Referencing it from AdbProtocol can fail during class initialization on Android 4.1–4.3, before Self-ADB gets a chance to connect.

Use one cached Charset.forName("UTF-8") value for protocol payloads, public keys, stream writes and command-output decoding. UTF-8 bytes and the ADB wire protocol remain unchanged; there is no fallback to the device's default encoding and no change to listener setup or authorization.

@emotionbug
emotionbug force-pushed the pr/legacy-self-adb-charset branch from 76797a0 to de54ffd Compare October 28, 2026 09:57
@emotionbug emotionbug changed the title Use legacy-compatible UTF-8 throughout Self-ADB ADB: Keep Self-ADB UTF-8 compatible with Android 4.1–4.3 Oct 28, 2026
Remove the Self-ADB client's dependency on StandardCharsets, which is
unavailable before API 19 and can fail AdbProtocol initialization on the
GitHub build's supported API 16-18 devices. Cache
Charset.forName("UTF-8") in the existing protocol class instead of
adding another transport helper or resolving the charset for each
operation.

Use the shared charset for the connection banner, OPEN destinations, RSA
public-key payloads, string stream writes and command-output decoding.
Keep the UTF-8 bytes, NUL termination, payload lengths and checksum
semantics unchanged across Android versions; the device's default
encoding is not a wire-format fallback.

Document the encoding invariant beside the shared value. Listener setup,
debugging authorization and connection lifecycle remain unchanged.
@emotionbug
emotionbug force-pushed the pr/legacy-self-adb-charset branch from 20268b2 to d77e1fc Compare October 28, 2026 16:12
@o-jcardenass o-jcardenass added the in review the code is complete, and assigned reviewers are actively evaluating it for quality and feedback label Oct 30, 2026
@o-jcardenass
o-jcardenass merged commit 52df274 into andreknieriem:main Oct 30, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in review the code is complete, and assigned reviewers are actively evaluating it for quality and feedback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants