Skip to content
thetriuPublic

About

OpenXia — a fully offline Android app for Xiaomi/Redmi earbuds (Redmi Buds 6 Play). No account, no INTERNET permission, no third-party SDKs. Kotlin + Jetpack Compose, MIT.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

OpenXia

A free, open-source, fully offline Android app for controlling Xiaomi/Redmi earbuds — developed against the Redmi Buds 6 Play.

No account. No network. No ads. No telemetry. No INTERNET permission.

Download the latest APK · MIT licensed · Kotlin + Jetpack Compose

Why this exists

The earbuds' own features — EQ presets, tap gestures, low-latency mode, find-my-earbuds, the battery readout — are just short commands sent over a Classic Bluetooth (RFCOMM/SPP) socket that the phone already holds once the buds are paired. There is no server in the loop, nothing to compute in the cloud, and nothing that needs an account. It is a few kilobytes of protocol.

The official app, by contrast, is a signed-in, network-connected application with a large companion SDK stack behind it — a lot of machinery for changing the EQ curve of earbuds you already own and already have bonded to your phone.

So OpenXia speaks the wire protocol directly. Pair the buds in system settings, open the app, and the features work with the phone in airplane mode, permanently. The manifest requests no INTERNET permission at all, so "it cannot phone home" is enforced by Android itself rather than promised in a privacy policy.

Top features

Feature What it is
Fully offline No INTERNET permission is requested, so the app is not technically capable of a network connection.
No accounts or SDKs No sign-in, no analytics, no crash reporting, no advertising, no Play Services.
Battery readout Left / right / case levels and charging state, decoded exactly like the official app's own parser.
EQ presets The sound-effect modes the buds actually report (device-config type 0x0007).
Tap gestures Bind every gesture the device reports, per bud — single/double/triple tap, long press, slide (type 0x0002).
Low latency The game-mode toggle (type 0x002F).
Find my earbuds Ring left, right, or both (type 0x0009).
Honest by construction Only byte sequences that were observed on the wire from the official app are ever sent; features without a capture are simply not rendered.
No hardware identifiers on screen Never shows the buds' Bluetooth address, the USB vid/pid, or the raw attribute dump.
Material 3 UI Dark mode, dynamic colour on Android 12+, edge-to-edge, adaptive (themed) launcher icon.
A real log tab The live RCSP session, one row per line, with Copy — so you can see what the app is doing.

How this was built — AI disclosure

This app was written by an AI agent — a large language model coding assistant working under human direction — not typed out by hand. The division of labour was:

  • The human chose the project, supplied and re-paired the hardware, took every HCI snoop of the official app, ran the app on the real earbuds after each stage, and decided what shipped.
  • The AI read the captures, wrote the protocol module and app, and wrote the tests.

Two rules kept that honest, and both are enforced in the code:

  1. Nothing ships that was not seen on the wire. A feature may only exist once its exact bytes have appeared in a capture of the official app. The Feature enum carries that flag and a test asserts no unverified feature has crept in; there is no "probably right" payload.
  2. Hardware is the gate. Compiling is not evidence. Every stage was confirmed on the real earbuds before the next one started, and the auth cipher below is pinned to vectors captured from a live pairing.

No code was copied from Xiaomi's app; the protocol implementation is written from the written analysis in docs/, and the interoperability constants it needs are reproduced as data.

Supported hardware

This app has been built against, and verified on, exactly one device: the Redmi Buds 6 Play (vid 0x2717, pid 0x509b). Nothing in it has ever been run against another model, so no broader support is claimed.

Three layers have very different amounts of model-specificity:

Layer Scope
Transport Xiaomi-specific. SDP is asked for the Miui SPP UUIDs fd2d then fd0d, with an explicit RFCOMM channel 6 as a last resort. fd2d/fd0d are Xiaomi-wide, so another Xiaomi earbud would probably resolve; the channel-6 fallback is this model's channel, taken from a live capture.
Auth Xiaomi-family-wide. E() is a pure function of the 16-byte challenge with fixed tables — a shared secret, not a per-unit key. That is why no setup is needed, and it is why sibling models using the same RCSP auth would likely also authenticate. Round 1 is self-checking, so a device whose secret differs fails the handshake and no config write is ever sent.
Features Mostly model-specific. The config type ids (0x0002, 0x0007, 0x0009, 0x002F) come from the official app's shared SDK, but the value sets are hardcoded from what this model reported: the EQ preset list is [0, 6, 5, 1, 7] and the gesture action menu is {1, 2, 3, 4, 5, 8}. Gesture rows adapt (the kinds are parsed from the device's own reply, and unknown kinds are skipped in threes); nothing else does. There is no ANC tab because this model has no ANC — a model that has it would get no ANC support.

The app never checks the connected device's identity and never asks it what it supports, so there is no capability negotiation to fall back on.

What that means in practice:

  • Another Xiaomi RCSP earbud — probably connects and authenticates, then each feature is a coin flip. It may offer EQ presets the device does not accept and hide ones it does, and the action menu will be missing options.
  • Anything else — SDP fails, the channel-6 fallback fails or lands on a channel nothing speaks RCSP on, and auth times out. You get an error in the Log tab; no crash, and no write.

The one risk that cannot be ruled out from the evidence is a device that authenticates but interprets a config type differently. The types are shared RCSP constants so that seems unlikely, and the worst case is probably an ignored or clamped byte — but there is no capture to prove it, so treat other models as untested rather than supported.

Status

Stage State
1. Protocol module (RCSP framing + auth cipher, unit-tested) ✅ done
2. RFCOMM connection + auth handshake on real hardware ✅ wire-validated PASS
3. GetTargetInfo end-to-end ✅ name/vidpid and battery live (0x07 decoded)
4. Feature commands ✅ EQ (0x0007), find-device (0x0009), gestures (0x0002), low latency (0x002F) done
5. UI + polish ✅ Material 3 theme (dark mode + dynamic colour), adaptive launcher icon, real vector tab icons, per-line log with copy + auto-scroll, no hardware identifiers. Auto-reconnect not included.

There is no noise-cancellation UI: the Redmi Buds 6 Play has no ANC and the official app renders no such page for it, so a Noise tab would have been a fake control. (Earlier traces did show the official app reading noise-reduction config types 0x000B/0x000C at startup; it never offered a control.)

UI

The app is a single Scaffold with a header and a bottom navigation bar:

Tab Contents
Device connect/auth card first, then battery (Left/Right/Case), find device (Left/Right/Both), and the paired-device picker (device names only) under a "Paired devices" header
Sound EQ presets (device-config type 0x0007)
Gestures tap/press actions per bud (device-config type 0x0002) — one row per gesture the device reports, with Left and Right pickers
Settings low latency toggle (device-config type 0x002F)
Log the live RCSP session log as one row per line, with Copy

Privacy of what is shown

The Device tab deliberately shows no identifiers of your own hardware: not the earbuds' Bluetooth address, not the USB vid/pid, and not the raw attribute dump that GetTargetInfo returns. The picker lists device names, and the header subtitle repeats the selected name.

The vid/pid and attribute bytes are still parsed and logged on the Log tab, because that tab is a diagnostic view of what actually went over the wire. Those values are product-level (the same for every Redmi Buds 6 Play) rather than unique to your unit; the only per-unit value, the Bluetooth address, is not displayed anywhere. deviceTabShowsNoHardwareIdentifiers in MainActivityLayoutTest.kt pins this.

Features are only ever driven by bytes seen on the wire from the official app. When the earbuds are not connected, a control tab shows a plain "Not connected" card rather than a disabled switch that looks like a fake control. Feature in UiModel.kt names the wire command behind each feature and whether it is capture-verified; AppTabTest enforces that a verified feature never rides an uncaptured opcode and that no unverified feature has crept in. Each tab body is exactly one LazyColumn (never a scrollable inside another) — see the regression test in MainActivityLayoutTest.kt.

Appearance:

  • Theme — ui/theme/Theme.kt wraps the UI in a Material 3 colour scheme that follows the system dark-mode setting, and picks up the wallpaper palette on Android 12+ (dynamicColor). The matching XML themes (values/, values-night/) supply the window background so there is no flash between the window and the first Compose frame, and the activity calls enableEdgeToEdge().
  • Icons — the launcher icon is an adaptive icon (mipmap-anydpi-v26/, with a <monochrome> layer for themed icons) plus a legacy mipmap/ fallback for API 24–25, which have no adaptive-icon support. The tab icons are hand-written vectors in res/drawable/ic_tab_*.xml. Because hand-written path data fails silently (a bad path only throws at inflate time, and out-of-viewport points just clip), IconResourcesTest inflates every icon and validates the path commands and coordinates.
  • No backup — allowBackup="false" plus explicit empty backup_rules.xml/data_extraction_rules.xml: the app stores nothing worth preserving and never talks to the network.

Layout

protocol/   pure-JVM Kotlin module: RCSP framing + auth cipher
            (no Android deps, tests run without a device)
app/        Android app, Jetpack Compose
docs/       the reverse-engineering write-up the implementation is based on,
            plus the capture tooling (docs/tools/)

The protocol module is intentionally free of Android dependencies so the protocol logic and its test suite run on a plain JVM.

Building

./gradlew test            # protocol + app unit tests (the gate is in there)
./gradlew assembleDebug
./gradlew assembleRelease # signed only if keystore.properties exists

local.properties must point at your SDK (sdk.dir=/path/to/android-sdk), or set ANDROID_HOME.

Release builds are signed from a keystore.properties file in the project root. Without it assembleRelease still builds, but produces an unsigned APK:

storeFile=keystore/openxia-release.keystore
storePassword=…
keyAlias=openxia
keyPassword=…

Validation status

Stage 2 (RFCOMM + mutual handshake) is wire-validated PASS against a live capture. Stage 3 (GetTargetInfo → name, vid/pid, battery) is live-verified. Stage 4: EQ, find-device, gestures and low latency are implemented and byte-pinned to the 2026-10-15 captures (every encoded payload is asserted equal to the captured frame in DeviceConfigTest, GesturesTest and LowLatencyTest).

Stage 5 (UI): theme, icons, log behaviour and empty/disabled states are covered by unit tests. The device-side checks are: the launcher icon appears (and picks up themed icons on Android 13+), the app follows the system light/dark setting, and the Log tab opens at the newest line.

103 unit tests green (20 protocol + 83 app). The protocol tests include the hard auth-cipher gate below; the app tests include simulated-device handshakes, device-config encoding pinned to captured frames, and Compose layout regressions. None of them can prove a shared secret — only a real capture can.

The device-config sub-protocol

Most settings (EQ, find-device, gestures, noise control, …) do not have per-feature opcodes. They ride on three opcodes with a 2-byte config type inside the payload:

Opcode Name Payload
0xF2 SET_DEVICE_CONFIG [len][type:2 BE][value] (len = 2 + value.size)
0xF3 GET_DEVICE_CONFIG one or more [type:2 BE]
0xF4 REPORT_DEVICE_CONFIG device push: [sn][len][type:2 BE][value]

Replies are [status][sn] followed by ([len][type:2][value])*. Config types seen so far: 0x0002 gestures, 0x0007 sound effect, 0x0009 find device, 0x000A/0x000B/0x000C noise control, 0x0028 time, 0x002F low latency, 0x0037 adaptive sound. Full evidence: docs/feature-capture-findings.md.

The auth cipher test gate

protocol/src/test/kotlin/dev/xiabuds/protocol/AuthCipherTest.kt contains two vectors captured from a real device during a live HCI snoop of a fresh pairing between the official app and the earbuds:

E(67c6697351ff4aec29cdbaab2fbe346) = 12953ffa34f0b875cd3b6850b974856c
E(0c69eaea3a760b4c2e2234e9a5e4595c) = a9b389a0be9dcd42d768435f8553c7bf

A port that does not reproduce both byte-for-byte is wrong. These are treated as a hard gate: they must pass before any Bluetooth I/O work begins.

Protocol notes

Transport

Classic Bluetooth SPP/RFCOMM for the control channel, service UUID 00001101-0000-1000-8000-00805f9b34fb. BLE GATT UUIDs 0000AF00/AF05/AF06 exist for discovery/advertisement only; commands do not go over GATT.

Framing

FE DC BA <flags:1> <opCode:1> <paramLen:2 BIG-ENDIAN> <payload> EF

No checksum field. flags: bit7 = command/response, bit6 = hasResponse, bits0-2 = targetApp.

Opcode verification status

Only opcodes marked Verification.LIVE_CAPTURE in protocol/src/main/kotlin/dev/xiabuds/protocol/RcspOpcodes.kt have been confirmed against a real capture. Everything else is STATIC_ONLY — inferred from static analysis and not to be shipped without a live capture confirming its exact payload shape. There is a unit test that enforces this flagging.

License

MIT — see LICENSE.

About

OpenXia — a fully offline Android app for Xiaomi/Redmi earbuds (Redmi Buds 6 Play). No account, no INTERNET permission, no third-party SDKs. Kotlin + Jetpack Compose, MIT.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages