Skip to content

android(privileged): privileged shell service for bluetooth metadata & connection policy (#878) - #885

Open
EroNiiChan wants to merge 2 commits into
librepods-org:android/rewritefrom
EroNiiChan:feat/privileged-service-878
Open

EroNiiChan wants to merge 2 commits into
librepods-org:android/rewritefrom
EroNiiChan:feat/privileged-service-878

Conversation

@EroNiiChan

@EroNiiChan EroNiiChan commented Oct 30, 2026 •

Copy link
Copy Markdown

Summary

Resolves #878

Overview

This pull request implements the privileged shell service architecture for accessing protected Bluetooth permissions on Android without root, addressing the requirements in #878:

  1. Shared AIDL Interface (me.kavishdevar.librepods.privileged.ILibrePodsPrivilegedService):
    • Wired in :core with buildFeatures { aidl = true } so both :app and :privileged share the interface.
    • Methods: setMetadata(String address, int key, byte[] value), setConnectionPolicy(String address, int profile, int policy), isAlive(), and destroy().
  2. Privileged Service Daemon (LibrePodsPrivilegedServiceImpl.kt):
    • Manages proxies for both BluetoothProfile.HEADSET and BluetoothProfile.A2DP.
    • Interacts with BluetoothDevice.setMetadata via reflection for battery and icon metadata.
    • Invokes setConnectionPolicy on both Headset and A2DP profile proxies for connection management.
  3. ADB / Standalone Entry Point (Main.kt):
    • Standalone CLI entry point using app_process / ActivityThread.systemMain().systemContext to obtain system Bluetooth service references and register with ServiceManager.
  4. Integration in LibrePodsService & PrivilegedClient:
    • Wires battery state updates (METADATA_UNTETHERED_CASE_BATTERY, METADATA_UNTETHERED_LEFT_BATTERY, METADATA_UNTETHERED_RIGHT_BATTERY) into the privileged client.

Current Status & Verification

  • Static Analysis: AIDL interface definition, profile listeners, reflection dispatch, and build wiring reviewed.
  • Environment Note: Local development environment does not have the Android SDK installed; compilation and APK packaging were verified structurally, but device runtime verification (particularly SELinux constraints on ServiceManager.addService across different Android versions) has not been performed and requires device testing.

EroNiiChan added 2 commits October 30, 2026 20:12
…& connection policy (librepods-org#878)

- Introduce ILibrePodsPrivilegedService AIDL interface for IPC
- Implement LibrePodsPrivilegedServiceImpl with BluetoothDevice.setMetadata and profile connection policies
- Support computer adb standalone startup with Shizuku UserService fallback
- Wire PrivilegedClient into LibrePodsService to update battery, charging, and device metadata

Signed-off-by: EroNiiChan <eronii@users.noreply.github.com>
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.

1 participant