Skip to content

android: support Xiaomi rootless devices - #663

Open
ousamabenyounes wants to merge 2 commits into
librepods-org:mainfrom
ousamabenyounes:fix/issue-658-xiaomi-rootless
Open

android: support Xiaomi rootless devices#663
ousamabenyounes wants to merge 2 commits into
librepods-org:mainfrom
ousamabenyounes:fix/issue-658-xiaomi-rootless

Conversation

@ousamabenyounes

@ousamabenyounes ousamabenyounes commented Jul 7, 2026

Copy link
Copy Markdown

Summary

  • Add Xiaomi, POCO, and Redmi to the Android 16+ rootless support allowlist.
  • Extract rootless support checks into a pure predicate covered by unit tests.
  • Document the HyperOS 3 case in android/README.md, including that rootless support there is not confirmed yet (see XIaomi 15 Pro Unable to connect to AirPods over L2CAP #393).

Issues

Fix #658

Scope note

isSupported() is only consumed by OnboardingScreen to pick between the "Not supported" page and the permissions page. It does not gate AirPodsService.connectToSocket(), so this PR changes onboarding UX only, not runtime Bluetooth behaviour. bypassDeviceCheck() already let any device through.

Test verification (RED -> GREEN)

RED before implementation:

e: RootlessSupportTest.kt:28:20 Unresolved reference 'isRootlessSupported'.
e: RootlessSupportTest.kt:28:40 Unresolved reference 'ANDROID_16_SDK'.

GREEN with fix:

> Task :app:testFossDebugUnitTest
BUILD SUCCESSFUL

Revert proof:

RootlessSupportTest > android16XiaomiFamilyDevicesAreSupported FAILED
java.lang.AssertionError at RootlessSupportTest.kt:28
5 tests completed, 1 failed

Final checks:

./gradlew testFossDebugUnitTest --tests me.kavishdevar.librepods.utils.RootlessSupportTest
BUILD SUCCESSFUL   (5 tests, 0 failures)

./gradlew assembleFossDebug
BUILD SUCCESSFUL

The README commit is docs-only; the build and unit tests were re-run on it with no regression against main.

@debarkak

Copy link
Copy Markdown

@ousamabenyounes won't it conflict with the existing Xiaomi HyperOS bluetooth manager that also has limited-control of the airpods?

@ousamabenyounes
ousamabenyounes force-pushed the fix/issue-658-xiaomi-rootless branch from 0595e15 to 761cf8e Compare August 16, 2026 17:31
The rootless allowlist in RootlessSupport.kt now also matches Xiaomi/POCO/Redmi
on Android 16, but android/README.md still enumerated only the ColorOS/OxygenOS,
realme UI and Pixel cases. Document the HyperOS 3 case explicitly, and say that
rootless support there is not confirmed yet: librepods-org#393 reports the private L2CAP
channel still timing out on Android 16 / HyperOS 3 without root.
@ousamabenyounes

Copy link
Copy Markdown
Author

Thanks for looking @debarkak — good question, I dug into it.

Short answer: this PR does not alter runtime Bluetooth behaviour, so it adds no new code-level conflict; whether HyperOS's own manager contends for the AirPods link is a separate, still-unverified question.

isSupported() is consumed in exactly one place — OnboardingScreen.kt — to choose between the "Not supported" onboarding page and the permissions page. It never reaches AirPodsService.connectToSocket(), which always attempts the private AAP L2CAP channel (PSM 4097) regardless of the allowlist. There is also no vendor-Bluetooth arbitration anywhere in the app (no com.xiaomi.bluetooth handling). And since bypassDeviceCheck() already lets any device through today, a Xiaomi user reaching that runtime state is nothing new — this PR only changes whether they have to tap "bypass" first.

That said, your instinct is right about the underlying risk, and I don't want the PR to over-claim. There is concrete counter-evidence for rootless HyperOS: #393 reports a Xiaomi 17 on Android 16 / HyperOS 3, locked bootloader, no root, no Xposed, where the AirPods are detected but socket.connect() still times out after ~5 s. #413 / #335 / #476 are the older MediaTek/HyperOS 2 variants of the same failure.

So in 3b67e52 I've synced android/README.md, which enumerates the rootless-supported OS list and had drifted from the allowlist. It now documents the HyperOS 3 case explicitly and states that rootless support there is not confirmed yet, pointing at #393. If L2CAP fails, users are told they still need root + Xposed — and the app already surfaces the failure at runtime through the existing "couldn't connect to AirPods using L2CAP" notification.

@kavishdevar — your call on scope: this allowlist entry is what #658 asked for and mirrors how the OPPO/realme family was added, but I'm happy to drop the Xiaomi/POCO/Redmi entry and keep only the isRootlessSupported() extraction + tests if you'd rather wait for a confirmed successful HyperOS 3 session first. Just say the word.

Validation for 3b67e52: docs-only change, so no new tests. Local replay of ci-android.yml — baseline on main: assembleFossDebug OK; final on this branch: assembleFossDebug OK and testFossDebugUnitTest 5/5 green, no regression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Request: Add Xiaomi POCO F6 Pro (Android 16 / Build BP2A)

2 participants