Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

265 Commits

Repository files navigation

binder

Go ReferenceGo Report CardCILicense: CC0-1.0Go VersionAsk AI

Call Android system services from pure Go. Provides ~14,000 type-safe Go methods across 1,500+ Android interfaces — ActivityManager, PowerManager, SurfaceFlinger, PackageManager, audio, camera and sensor HALs, and more — by speaking the Binder IPC wire protocol directly via /dev/binder ioctl syscalls. No Java, no NDK, no cgo required.

Includes a complete AIDL compiler that parses Android Interface Definition Language files and generates the Go proxies, a version-aware runtime that adapts transaction codes across Android API levels, and a CLI tool (bindercli) for interactive service discovery and invocation.

What can it do?

  • Query system services — battery level, GPS location, thermal status, running processes, installed packages
  • Control hardware — connect to WiFi, toggle flashlight, manage Bluetooth, configure audio
  • Interact with any binder service — ActivityManager, PowerManager, SurfaceFlinger, camera/sensor HALs, and more
  • No Java, no cgo — pure Go, cross-compiles to a static binary, runs on Android or any Linux with /dev/binder
  • CLI tool includedbindercli for interactive service discovery, method invocation, and debugging

Quick start

Go librarygo get github.com/AndroidGoLab/binder — live GPS location via binder IPC:

package main
import (
"context""fmt""math""os""time""github.com/AndroidGoLab/binder/android/location"
androidos "github.com/AndroidGoLab/binder/android/os""github.com/AndroidGoLab/binder/binder""github.com/AndroidGoLab/binder/binder/versionaware""github.com/AndroidGoLab/binder/kernelbinder""github.com/AndroidGoLab/binder/servicemanager"
)
// gpsListener receives location callbacks from the LocationManager.typegpsListenerstruct{ fixChchan location.Location }
func (l*gpsListener) OnLocationChanged(_ context.Context, locs []location.Location, _ androidos.IRemoteCallback) error {
for_, loc:=rangelocs { select { casel.fixCh<-loc: default: } }
returnnil
}
func (l*gpsListener) OnProviderEnabledChanged(_ context.Context, _string, _bool) error { returnnil }
func (l*gpsListener) OnFlushComplete(_ context.Context, _int32) error { returnnil }
funcmain() {
ctx:=context.Background()
drv, _:=kernelbinder.Open(ctx, binder.WithMapSize(128*1024))
deferdrv.Close(ctx)
transport, _:=versionaware.NewTransport(ctx, drv, 0)
sm:=servicemanager.New(transport)
lm, _:=location.GetLocationManager(ctx, sm)
impl:=&gpsListener{fixCh: make(chan location.Location, 1)}
listener:=location.NewLocationListenerStub(impl)
request:= location.LocationRequest{
Provider: location.GpsProvider, IntervalMillis: 1000,
ExpireAtRealtimeMillis: math.MaxInt64, DurationMillis: math.MaxInt64,
}
pkg:=binder.DefaultCallerIdentity().PackageName_=lm.RegisterLocationListener(ctx, location.GpsProvider, request, listener, pkg, "gps")
deferlm.UnregisterLocationListener(ctx, listener)
select {
caseloc:=<-impl.fixCh:
fmt.Printf("Lat: %.6f Lon: %.6f Alt: %.1f m Accuracy: %.1f m\n",
loc.LatitudeDegrees, loc.LongitudeDegrees, loc.AltitudeMeters, loc.HorizontalAccuracyMeters)
case<-time.After(30*time.Second):
fmt.Fprintln(os.Stderr, "timed out")
}
}

Full runnable example: examples/gps_location/

Or query power state:

power, _:=os.GetPowerManager(ctx, sm)
interactive, _:=power.IsInteractive(ctx)
fmt.Printf("Screen on: %v\n", interactive)

Related Projects

ndk, jni, binder (click to expand)

This project is part of a family of three Go libraries that cover the major Android interface surfaces. Each wraps a different layer of the Android platform:

graph TD
subgraph "Go application"
GO["Go code"]
end
subgraph "Interface libraries"
NDK["<b>ndk</b><br/>C API bindings via cgo"]
JNI["<b>jni</b><br/>Java API bindings via JNI+cgo"]
AIDL["<b>binder</b><br/>Binder IPC, pure Go"]
end
subgraph "Android platform"
CAPI["NDK C libraries<br/>(libcamera2ndk, libaaudio,<br/>libEGL, libvulkan, ...)"]
JAVA["Java SDK<br/>(android.bluetooth,<br/>android.location, ...)"]
BINDER["/dev/binder<br/>kernel driver"]
SYSSVCS["System services<br/>(ActivityManager,<br/>PowerManager, ...)"]
end
GO --> NDK
GO --> JNI
GO --> AIDL
NDK -- "cgo / #include" --> CAPI
JNI -- "cgo / JNIEnv*" --> JAVA
AIDL -- "ioctl syscalls" --> BINDER
BINDER --> SYSSVCS
JAVA -. "internally uses" .-> BINDER
CAPI -. "some use" .-> BINDER
Loading
LibraryInterfaceRequiresBest for
ndkAndroid NDK C APIscgo + NDK toolchainHigh-performance hardware access: camera, audio, sensors, OpenGL/Vulkan, media codecs
jniJava Android SDK via JNIcgo + JNI + JVM/ARTJava-only APIs with no NDK equivalent: Bluetooth, WiFi, NFC, location, telephony, content providers
binder (this project)Binder IPC (system services)pure Go (no cgo)Direct system service calls without Java: works on non-Android Linux with binder, minimal footprint

When to use which

  • Start with ndk when the NDK provides a C API for what you need (camera, audio, sensors, EGL/Vulkan, media codecs). These are the lowest-latency, lowest-overhead bindings since they go straight from Go to the C library via cgo.

  • Use jni when you need a Java Android SDK API that the NDK does not expose. Examples: Bluetooth discovery, WiFi P2P, NFC tag reading, location services, telephony, content providers, notifications. JNI is also the right choice when you need to interact with Java components (Activities, Services, BroadcastReceivers) or when you need the gRPC remote-access layer.

  • Use binder when you want pure-Go access to Android system services without any cgo dependency. This is ideal for lightweight tools, CLI programs, or scenarios where you want to talk to the binder driver from a non-Android Linux system. AIDL covers the same system services that Java SDK wraps (ActivityManager, PowerManager, etc.) but at the wire-protocol level.

  • Combine them when your application needs multiple layers. For example, a streaming app might use ndk for camera capture and audio encoding, jni for Bluetooth controller discovery, and binder for querying battery status from a companion daemon.

How they relate to each other

All three libraries talk to the same Android system services, but through different paths:

  • The NDK C APIs are provided by Google as stable C interfaces to Android platform features. Some (camera, sensors, audio) internally use binder IPC to talk to system services; others (EGL, Vulkan, OpenGL) talk directly to kernel drivers. The ndk library wraps these C APIs via cgo.
  • The Java SDK uses binder IPC internally for system service access (BluetoothManager, LocationManager, etc.), routing calls through the Android Runtime (ART/Dalvik). The jni library calls into these Java APIs via the JNI C interface and cgo.
  • The AIDL binder protocol is the underlying IPC mechanism that system-facing NDK and Java SDK APIs use. The binder library implements this protocol directly in pure Go, bypassing both C and Java layers entirely.

Usage Examples

Get GPS Location

import (
"context""fmt""log""github.com/AndroidGoLab/binder/android/location""github.com/AndroidGoLab/binder/binder""github.com/AndroidGoLab/binder/binder/versionaware""github.com/AndroidGoLab/binder/kernelbinder""github.com/AndroidGoLab/binder/servicemanager"
)
ctx:=context.Background()
driver, err:=kernelbinder.Open(ctx, binder.WithMapSize(128*1024))
iferr!=nil {
log.Fatal(err)
}
deferdriver.Close(ctx)
transport, err:=versionaware.NewTransport(ctx, driver, 0)
iferr!=nil {
log.Fatal(err)
}
sm:=servicemanager.New(transport)
lm, err:=location.GetLocationManager(ctx, sm)
iferr!=nil {
log.Fatal(err)
}
loc, err:=lm.GetLastLocation(ctx, location.FusedProvider, location.LastLocationRequest{}, binder.DefaultCallerIdentity().PackageName)
iferr!=nil {
log.Fatal(err)
}
fmt.Printf("Lat: %f, Lon: %f, Alt: %f\n",
loc.LatitudeDegrees, loc.LongitudeDegrees, loc.AltitudeMeters)
fmt.Printf("Speed: %f m/s, Bearing: %f°\n",
loc.SpeedMetersPerSecond, loc.BearingDegrees)

Check Power State

import (
"context""fmt""log"
genOs "github.com/AndroidGoLab/binder/android/os""github.com/AndroidGoLab/binder/binder""github.com/AndroidGoLab/binder/binder/versionaware""github.com/AndroidGoLab/binder/kernelbinder""github.com/AndroidGoLab/binder/servicemanager"
)
ctx:=context.Background()
driver, err:=kernelbinder.Open(ctx, binder.WithMapSize(128*1024))
iferr!=nil {
log.Fatal(err)
}
deferdriver.Close(ctx)
transport, err:=versionaware.NewTransport(ctx, driver, 0)
iferr!=nil {
log.Fatal(err)
}
sm:=servicemanager.New(transport)
power, err:=genOs.GetPowerManager(ctx, sm)
iferr!=nil {
log.Fatal(err)
}
interactive, _:=power.IsInteractive(ctx)
fmt.Printf("Screen on: %v\n", interactive)
powerSave, _:=power.IsPowerSaveMode(ctx)
fmt.Printf("Power save: %v\n", powerSave)

List Binder Services

sm:=servicemanager.New(transport)
services, err:=sm.ListServices(ctx)
iferr!=nil {
log.Fatal(err)
}
for_, name:=rangeservices {
svc, err:=sm.CheckService(ctx, name)
iferr==nil&&svc!=nil&&svc.IsAlive(ctx) {
fmt.Printf("%-60s alive\n", name)
}
}

Call a System Service (ActivityManager)

import (
"github.com/AndroidGoLab/binder/android/app""github.com/AndroidGoLab/binder/servicemanager"
)
svc, err:=sm.GetService(ctx, servicemanager.ActivityService)
iferr!=nil {
log.Fatal(err)
}
am:=app.NewActivityManagerProxy(svc)
limit, _:=am.GetProcessLimit(ctx)
fmt.Printf("Process limit: %d\n", limit)
monkey, _:=am.IsUserAMonkey(ctx)
fmt.Printf("Is monkey: %v\n", monkey)

Toggle Flashlight

Requires android.permission.CAMERA; see examples/flashlight_torch/ for the full runnable example with permission handling.

import (
"context""github.com/AndroidGoLab/binder/android/hardware""github.com/AndroidGoLab/binder/binder""github.com/AndroidGoLab/binder/parcel""github.com/AndroidGoLab/binder/servicemanager"
)
// torchToken is a minimal TransactionReceiver for SetTorchMode's client binder.typetorchTokenstruct{}
func (t*torchToken) Descriptor() string { return"torch.client" }
func (t*torchToken) OnTransaction(
_ context.Context,
_ binder.TransactionCode,
_*parcel.Parcel,
) (*parcel.Parcel, error) {
returnparcel.New(), nil
}
svc, err:=sm.GetService(ctx, servicemanager.MediaCameraService)
iferr!=nil {
log.Fatal(err)
}
camera:=hardware.NewCameraServiceProxy(svc)
// The camera service requires a non-null client binder token.clientToken:=binder.NewStubBinder(&torchToken{})
clientToken.RegisterWithTransport(ctx, transport)
// Turn torch on for camera "0"iferr:=camera.SetTorchMode(ctx, "0", true, clientToken); err!=nil {
log.Fatal(err)
}
fmt.Println("Torch ON")
// Turn torch off_=camera.SetTorchMode(ctx, "0", false, clientToken)

List All Installed Packages

import (
"github.com/AndroidGoLab/binder/android/content/pm""github.com/AndroidGoLab/binder/servicemanager"
)
svc, err:=sm.GetService(ctx, servicemanager.PackageService)
iferr!=nil {
log.Fatal(err)
}
pkgMgr:=pm.NewPackageManagerProxy(svc)
packages, err:=pkgMgr.GetAllPackages(ctx)
iferr!=nil {
log.Fatal(err)
}
fmt.Printf("Found %d packages:\n", len(packages))
for_, pkg:=rangepackages {
fmt.Println(" ", pkg)
}

Handle Errors Gracefully

import (
"errors"
aidlerrors "github.com/AndroidGoLab/binder/errors""github.com/AndroidGoLab/binder/servicemanager"
)
// Non-blocking service check (returns nil if not found)svc, err:=sm.CheckService(ctx, servicemanager.MediaCameraService)
iferr!=nil {
log.Fatal(err)
}
ifsvc==nil {
fmt.Println("Camera service not available")
return
}
// Typed error inspection_, err=someProxy.SomeMethod(ctx)
varstatus*aidlerrors.StatusErroriferrors.As(err, &status) {
switchstatus.Exception {
caseaidlerrors.ExceptionSecurity:
fmt.Printf("Permission denied: %s\n", status.Message)
caseaidlerrors.ExceptionServiceSpecific:
fmt.Printf("Service error %d: %s\n", status.ServiceSpecificCode, status.Message)
default:
fmt.Printf("AIDL error: %v\n", status)
}
}

Query Battery Level

import (
"github.com/AndroidGoLab/binder/android/hardware/health""github.com/AndroidGoLab/binder/servicemanager"
)
svc, err:=sm.GetService(ctx, servicemanager.ServiceName(health.DescriptorIHealth+"/default"))
iferr!=nil {
log.Fatal(err)
}
h:=health.NewHealthProxy(svc)
capacity, err:=h.GetCapacity(ctx)
iferr!=nil {
log.Fatal(err)
}
fmt.Printf("Battery level: %d%%\n", capacity)
info, err:=h.GetHealthInfo(ctx)
iferr!=nil {
log.Fatal(err)
}
fmt.Printf("Status: %v, Temperature: %.1f °C\n",
info.BatteryStatus, float64(info.BatteryTemperatureTenthsCelsius)/10)
fmt.Printf("Voltage: %d mV, Current: %d µA\n",
info.BatteryVoltageMillivolts, info.BatteryCurrentMicroamps)

Send a Raw Binder Transaction

import (
"github.com/AndroidGoLab/binder/binder""github.com/AndroidGoLab/binder/parcel""github.com/AndroidGoLab/binder/servicemanager"
)
svc, err:=sm.GetService(ctx, servicemanager.ActivityService)
iferr!=nil {
log.Fatal(err)
}
// Build the request parcel.data:=parcel.New()
deferdata.Recycle()
data.WriteInterfaceToken("android.app.IActivityManager")
data.WriteString16("android.permission.INTERNET")
data.WriteInt32(int32(os.Getpid()))
data.WriteInt32(int32(os.Getuid()))
// Resolve the method's transaction code and send.code, err:=svc.ResolveCode(ctx, "android.app.IActivityManager", "checkPermission")
iferr!=nil {
log.Fatal(err)
}
reply, err:=svc.Transact(ctx, code, 0, data)
iferr!=nil {
log.Fatal(err)
}
deferreply.Recycle()
// Read the AIDL status header, then the return value.iferr:=binder.ReadStatus(reply); err!=nil {
log.Fatal(err)
}
result, _:=reply.ReadInt32()
fmt.Printf("checkPermission returned: %d\n", result)

Register a Server-Side Service

import (
"context""github.com/AndroidGoLab/binder/binder""github.com/AndroidGoLab/binder/parcel""github.com/AndroidGoLab/binder/servicemanager"
)
// myService implements binder.TransactionReceiver for a simple ping service.typemyServicestruct{}
func (s*myService) Descriptor() string { return"com.example.IPingService" }
func (s*myService) OnTransaction(
ctx context.Context,
code binder.TransactionCode,
data*parcel.Parcel,
) (*parcel.Parcel, error) {
reply:=parcel.New()
binder.WriteStatus(reply, nil)
reply.WriteString16("pong")
returnreply, nil
}
// Register with ServiceManagererr:=sm.AddService(ctx, servicemanager.ServiceName("my.service"), &myService{}, false, 0)
Using other services

The examples above cover specific subsystems, but the library supports all Android binder services — over 1,500 interfaces. To work with a service not shown above:

  1. Find the service name. Run bindercli service list on the device, or check servicemanager/service_names_gen.go for well-known constants.

  2. Find the generated proxy. Browse the android/ and com/ packages on pkg.go.dev or use grep:

# Find the proxy for a known AIDL interface
grep -r 'DescriptorI.*= "android.hardware.vibrator.IVibrator"' android/
  1. Connect and call methods:
svc, err:=sm.GetService(ctx, servicemanager.ServiceName(
vibrator.DescriptorIVibrator+"/default"))
iferr!=nil {
log.Fatal(err)
}
proxy:=vibrator.NewVibratorProxy(svc)
caps, err:=proxy.GetCapabilities(ctx)
  1. For HAL services (hardware abstraction layers), the service name is the AIDL descriptor plus /default:
svc, err:=sm.GetService(ctx, servicemanager.ServiceName(health.DescriptorIHealth+"/default"))
  1. For services without a generated proxy, use raw transactions (see Send a Raw Binder Transaction above).

More examples: examples/

ExampleQueries
account_managerList accounts on the device via AccountManager.
activity_managerProcess limits, monkey test flag, permission checks
aidl_bridgeExpose a bridge service that forwards calls to another binder service.
aidl_explorerIntrospect methods on binder services.
alarm_auditorAudit pending alarms via AlarmManager.
app_hibernationQuery app hibernation status via the AppHibernationService.
attention_monitorMonitor user presence via PowerManager and display state.
attestation_verifyQuery attestation verification and related security services.
audio_focusQuery current audio focus state via AudioService.
audio_recording_monitorDetect which apps are currently recording audio.
audio_statusAudio device info, volume state
battery_healthCapacity, charge status, current draw
binder_fuzzerSend randomized parcel data to services to test robustness.
binder_latencyMeasure round-trip binder transaction times.
ble_sensor_collectorBLE sensor collector: scan for BLE devices and register a GATT client.
bluetooth_audio_routingManage Bluetooth A2DP audio connections via binder.
bluetooth_inventoryEnumerate paired/bonded Bluetooth devices and query adapter info.
bluetooth_statusQuery Bluetooth adapter status and scan for BLE devices via binder.
camera_captureCamera frame capture using gralloc-allocated buffers.
camera_connectCamera device connection with callback stub
carrier_configQuery carrier configuration: default carrier service package,
charge_monitorMonitor charging status and battery health via the Health HAL.
clipboard_monitorSet and read clipboard text via the Android clipboard binder service.
codec2_encodeCodec2 H.264 encoding via HIDL hwbinder.
compliance_checkerVerify device compliance: encryption, security state, OTA update status.
credential_managerQuery the CredentialManager service for availability.
device_infoDevice properties, build info
device_policyQuery DevicePolicyManager for device administration state.
display_infoDisplay IDs, brightness, night mode
dnd_controllerQuery and display Do Not Disturb (Zen) mode via NotificationManager.
dns_configQuery network configuration via the netd system service.
dream_managerQuery screensaver/daydream state via DreamManager.
dual_simMonitor SIM slots: query active subscription count, slot info,
error_handlingGraceful error handling: service checks, typed errors, permissions
esim_managerQuery eSIM/eUICC profile management: OTA status, supported countries,
factory_resetFactory reset demonstration via DevicePolicyManager.
flashlight_torchToggle flashlight/torch via ICameraService
geofenceQuery location provider availability for geofencing use cases.
getservice_vs_checkserviceBinary getservice_vs_checkservice compares GetService vs CheckService
gnss_diagnosticsQuery GNSS hardware model name, year, and capabilities via LocationManager.
gps_locationLive GPS fix via ILocationListener callback
headless_controllerHeadless device orchestration: query power, display, and process state.
ims_monitorMonitor IMS registration state via ITelephony proxy.
input_injectorInject input events via InputManager's binder interface.
job_scheduler_monitorQuery JobScheduler state from the "jobscheduler" service.
keymint_delete_testBinary keymint_delete_test calls DeleteAllKeys on the KeyMint HAL
keystore_opsQuery Keystore2 service for key entries and counts (read-only).
kiosk_lockdownQuery activity/window manager for kiosk lockdown information.
last_locationRetrieve the last known fused location without registering a listener.
list_packagesList all installed packages via GetAllPackages
list_servicesEnumerate all binder services, ping each
location_benchmarkCompare location providers by querying all providers and their properties.
mdm_agentLightweight MDM agent querying device policies via DevicePolicyManager.
media_session_controlEnumerate active media sessions and query global priority.
media_transcodingQuery media transcoding service status and media metrics session IDs.
memory_pressureRead memory pressure info from ActivityManager.
mock_serviceCreate a mock binder service for testing.
network_monitorCheck network connectivity status via NetworkManagementService.
network_policyQuery network policy settings via the INetworkPolicyManager system service.
notification_listenerQuery notification state via NotificationManager: zen mode, active notifications.
oem_lock_statusQuery OemLockService for bootloader lock state and OEM unlock status.
ota_statusQuery update engine for OTA update status.
package_monitorMonitor installed packages by polling the PackageManager.
package_queryPackage list, installation info
permission_auditAudit permissions for installed apps via the ActivityManager.
permission_boundaryTest which binder calls succeed or fail from the current security context.
permission_checkerCheck permissions for UIDs/PIDs via ActivityManager.
power_profilingMeasure battery current draw over time via the Health HAL.
power_save_autoQuery power save mode status and related settings via PowerManager.
power_statusPower supply state, charging info
process_watchdogList running processes via ActivityManager and check resource usage.
qr_scanner_daemonQR/barcode scanner daemon that captures camera frames for processing.
remote_diagnosticsCollect comprehensive device state for remote diagnostics.
rkp_monitorMonitor remote key provisioning (RKP) and device security state.
rotation_resolverQuery device rotation and display state via WindowManager and DisplayManager.
satellite_checkCheck satellite telephony readiness by querying the telephony service.
screen_controlCheck screen on/off state and display interactivity via PowerManager.
secure_elementQuery OMAPI SecureElementService for available readers.
security_test_apkBinary security_test_apk probes whether an app-sandboxed process can
sensor_gatewayStream live sensor events via the SensorManager event queue callback.
sensor_readerRead sensor data from the SensorManager HAL.
server_serviceRegister a Go service and call it back via binder
server_service_aidlRegister a Go binder service using a generated AIDL stub.
signage_controllerDisplay brightness and power control for digital signage.
sim_statusQuery telephony service for SIM state: radio, ICC card, data state.
sms_monitorQuery SMS service: preferred subscription, IMS SMS support.
softap_manageWiFi hotspot enable/disable, config
softap_tether_offloadTethering offload config, stats
softap_wifi_halWiFi chip info, AP interface state
sound_triggerList sound trigger modules via SoundTriggerMiddlewareService.
statusbar_controlQuery status bar state: navigation bar mode, tracing, last system key.
storage_infoStorage device stats, mount points
suspend_loggerAcquire and release a wake lock via the PowerManager binder service.
system_app_classifierClassify installed packages as system or user apps.
thermal_monitorPoll thermal service for CPU/GPU temperatures, throttling status, and cooling devices.
timelapse_capturePeriodic timelapse camera capture via binder.
transaction_resolverResolve AIDL method names to transaction codes for binder services.
usage_statsQuery app usage statistics via the UsageStatsManager.
usb_trackerQuery USB device state: ports, functions, speed, and HAL versions.
user_managerQuery user profiles from the UserManager service.
vehicle_telematicsCollect GPS, battery, and device diagnostics for vehicle telematics.
version_compatValidate proxy compatibility across API levels.
volume_controlGet and set stream volumes via AudioService.
vpn_monitorCheck VPN status via the IVpnManager system service.
wakelock_auditEnumerate supported wake lock levels via PowerManager.
wifi_scannerScan available WiFi networks via the wificond system service.

bindercli Quick Start

bindercli lets you call any Android system service from the command line — no Go code needed.

Install and deploy:

GOOS=linux GOARCH=arm64 go build -o build/bindercli ./cmd/bindercli/
adb push build/bindercli /data/local/tmp/

Try it:

# List all binder services
adb shell /data/local/tmp/bindercli service list
# Check battery level
adb shell /data/local/tmp/bindercli android.hardware.health.IHealth get-health-info
# Query ActivityManager
adb shell /data/local/tmp/bindercli android.app.IActivityManager get-process-limit
# Get GPS hardware info
adb shell /data/local/tmp/bindercli android.location.ILocationManager get-gnss-hardware-model-name

See the full bindercli reference for all subcommands and more examples.

Packages

PackageDescriptionImport Path
AIDL Pipeline (tools/pkg/)
parsertools/pkg/parserLexer and recursive-descent parser producing an AST from .aidl filesgithub.com/AndroidGoLab/binder/tools/pkg/parser
resolvertools/pkg/resolverImport resolution across search paths with type registry and circular-import detectiongithub.com/AndroidGoLab/binder/tools/pkg/resolver
codegentools/pkg/codegenGo code generator for proxies, parcelables, enums, unions, and constantsgithub.com/AndroidGoLab/binder/tools/pkg/codegen
validatetools/pkg/validateSemantic validation: type resolution, parameter directions, oneway constraintsgithub.com/AndroidGoLab/binder/tools/pkg/validate
Runtime
binderbinderBinder IPC abstractions: IBinder interface, Transact(), status/exception handlinggithub.com/AndroidGoLab/binder/binder
parcelparcelBinder wire format: 4-byte aligned, little-endian serializationgithub.com/AndroidGoLab/binder/parcel
kernelbinderkernelbinderLinux /dev/binder driver: open, mmap, ioctl, protocol negotiationgithub.com/AndroidGoLab/binder/kernelbinder
servicemanagerservicemanagerClient for android.os.IServiceManager: GetService(), ListServices(), etc.github.com/AndroidGoLab/binder/servicemanager
errorserrorsAIDL exception types: ExceptionCode, StatusErrorgithub.com/AndroidGoLab/binder/errors
Testing
testutiltools/pkg/testutilMock binder and reflection-based smoke testing for generated proxiesgithub.com/AndroidGoLab/binder/tools/pkg/testutil

Generated AOSP Packages

385 packages: 1513 interfaces, 2370 parcelables, 957 enums, 133 unions.

aaudio (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
aaudio2500github.com/AndroidGoLab/binder/aaudio
android (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android6100github.com/AndroidGoLab/binder/android
android/accessibilityservice (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/accessibilityservice4300github.com/AndroidGoLab/binder/android/accessibilityservice
android/accounts (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/accounts4200github.com/AndroidGoLab/binder/android/accounts
android/app (24 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/app506110github.com/AndroidGoLab/binder/android/app
android/app/admin62000github.com/AndroidGoLab/binder/android/app/admin
android/app/ambientcontext2200github.com/AndroidGoLab/binder/android/app/ambientcontext
android/app/assist0300github.com/AndroidGoLab/binder/android/app/assist
android/app/backup8400github.com/AndroidGoLab/binder/android/app/backup
android/app/blob3300github.com/AndroidGoLab/binder/android/app/blob
android/app/contentsuggestions3400github.com/AndroidGoLab/binder/android/app/contentsuggestions
android/app/job4500github.com/AndroidGoLab/binder/android/app/job
android/app/ondeviceintelligence9300github.com/AndroidGoLab/binder/android/app/ondeviceintelligence
android/app/people2200github.com/AndroidGoLab/binder/android/app/people
android/app/pinner1100github.com/AndroidGoLab/binder/android/app/pinner
android/app/prediction2500github.com/AndroidGoLab/binder/android/app/prediction
android/app/search2500github.com/AndroidGoLab/binder/android/app/search
android/app/servertransaction0100github.com/AndroidGoLab/binder/android/app/servertransaction
android/app/slice2200github.com/AndroidGoLab/binder/android/app/slice
android/app/smartspace2400github.com/AndroidGoLab/binder/android/app/smartspace
android/app/tare1000github.com/AndroidGoLab/binder/android/app/tare
android/app/time21300github.com/AndroidGoLab/binder/android/app/time
android/app/timedetector1200github.com/AndroidGoLab/binder/android/app/timedetector
android/app/timezonedetector1200github.com/AndroidGoLab/binder/android/app/timezonedetector
android/app/trust3000github.com/AndroidGoLab/binder/android/app/trust
android/app/usage3900github.com/AndroidGoLab/binder/android/app/usage
android/app/wallpapereffectsgeneration2200github.com/AndroidGoLab/binder/android/app/wallpapereffectsgeneration
android/app/wearable1000github.com/AndroidGoLab/binder/android/app/wearable
android/apphibernation (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/apphibernation1100github.com/AndroidGoLab/binder/android/apphibernation
android/appwidget (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/appwidget0100github.com/AndroidGoLab/binder/android/appwidget
android/binderdebug (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/binderdebug/test1000github.com/AndroidGoLab/binder/android/binderdebug/test
android/bluetooth (2 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/bluetooth503210github.com/AndroidGoLab/binder/android/bluetooth
android/bluetooth/le41200github.com/AndroidGoLab/binder/android/bluetooth/le
android/companion (8 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/companion8500github.com/AndroidGoLab/binder/android/companion
android/companion/datatransfer0100github.com/AndroidGoLab/binder/android/companion/datatransfer
android/companion/virtual6200github.com/AndroidGoLab/binder/android/companion/virtual
android/companion/virtual/audio2000github.com/AndroidGoLab/binder/android/companion/virtual/audio
android/companion/virtual/camera1100github.com/AndroidGoLab/binder/android/companion/virtual/camera
android/companion/virtual/sensor1300github.com/AndroidGoLab/binder/android/companion/virtual/sensor
android/companion/virtualcamera2230github.com/AndroidGoLab/binder/android/companion/virtualcamera
android/companion/virtualnative1000github.com/AndroidGoLab/binder/android/companion/virtualnative
android/content (9 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/content122300github.com/AndroidGoLab/binder/android/content
android/content/integrity1100github.com/AndroidGoLab/binder/android/content/integrity
android/content/om1300github.com/AndroidGoLab/binder/android/content/om
android/content/pm275920github.com/AndroidGoLab/binder/android/content/pm
android/content/pm/dex2000github.com/AndroidGoLab/binder/android/content/pm/dex
android/content/pm/permission1100github.com/AndroidGoLab/binder/android/content/pm/permission
android/content/pm/verify/domain1400github.com/AndroidGoLab/binder/android/content/pm/verify/domain
android/content/res1300github.com/AndroidGoLab/binder/android/content/res
android/content/rollback1200github.com/AndroidGoLab/binder/android/content/rollback
android/credentials (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/credentials71400github.com/AndroidGoLab/binder/android/credentials
android/database (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/database1100github.com/AndroidGoLab/binder/android/database
android/debug (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/debug3210github.com/AndroidGoLab/binder/android/debug
android/dvr (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/dvr1000github.com/AndroidGoLab/binder/android/dvr
android/flags (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/flags2100github.com/AndroidGoLab/binder/android/flags
android/frameworks (11 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/frameworks/automotive/display1110github.com/AndroidGoLab/binder/android/frameworks/automotive/display
android/frameworks/automotive/powerpolicy2210github.com/AndroidGoLab/binder/android/frameworks/automotive/powerpolicy
android/frameworks/automotive/powerpolicy/internal_1100github.com/AndroidGoLab/binder/android/frameworks/automotive/powerpolicy/internal_
android/frameworks/automotive/telemetry2200github.com/AndroidGoLab/binder/android/frameworks/automotive/telemetry
android/frameworks/cameraservice/common0330github.com/AndroidGoLab/binder/android/frameworks/cameraservice/common
android/frameworks/cameraservice/device2951github.com/AndroidGoLab/binder/android/frameworks/cameraservice/device
android/frameworks/cameraservice/service2110github.com/AndroidGoLab/binder/android/frameworks/cameraservice/service
android/frameworks/location/altitude1400github.com/AndroidGoLab/binder/android/frameworks/location/altitude
android/frameworks/sensorservice4000github.com/AndroidGoLab/binder/android/frameworks/sensorservice
android/frameworks/stats1322github.com/AndroidGoLab/binder/android/frameworks/stats
android/frameworks/vibrator2101github.com/AndroidGoLab/binder/android/frameworks/vibrator
android/graphics (4 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/graphics0800github.com/AndroidGoLab/binder/android/graphics
android/graphics/bufferstreams3401github.com/AndroidGoLab/binder/android/graphics/bufferstreams
android/graphics/drawable0100github.com/AndroidGoLab/binder/android/graphics/drawable
android/graphics/fonts0100github.com/AndroidGoLab/binder/android/graphics/fonts
android/gui (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/gui124782github.com/AndroidGoLab/binder/android/gui
android/hardware (118 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/hardware9910github.com/AndroidGoLab/binder/android/hardware
android/hardware/audio/common0500github.com/AndroidGoLab/binder/android/hardware/audio/common
android/hardware/audio/core111862github.com/AndroidGoLab/binder/android/hardware/audio/core
android/hardware/audio/core/sounddose2100github.com/AndroidGoLab/binder/android/hardware/audio/core/sounddose
android/hardware/audio/effect2441537github.com/AndroidGoLab/binder/android/hardware/audio/effect
android/hardware/audio/sounddose1000github.com/AndroidGoLab/binder/android/hardware/audio/sounddose
android/hardware/authsecret1000github.com/AndroidGoLab/binder/android/hardware/authsecret
android/hardware/automotive/audiocontrol4320github.com/AndroidGoLab/binder/android/hardware/automotive/audiocontrol
android/hardware/automotive/can1523github.com/AndroidGoLab/binder/android/hardware/automotive/can
android/hardware/automotive/evs71990github.com/AndroidGoLab/binder/android/hardware/automotive/evs
android/hardware/automotive/ivn1320github.com/AndroidGoLab/binder/android/hardware/automotive/ivn
android/hardware/automotive/occupant_awareness2540github.com/AndroidGoLab/binder/android/hardware/automotive/occupant_awareness
android/hardware/automotive/remoteaccess2210github.com/AndroidGoLab/binder/android/hardware/automotive/remoteaccess
android/hardware/automotive/vehicle2311070github.com/AndroidGoLab/binder/android/hardware/automotive/vehicle
android/hardware/biometrics14510github.com/AndroidGoLab/binder/android/hardware/biometrics
android/hardware/biometrics/common1672github.com/AndroidGoLab/binder/android/hardware/biometrics/common
android/hardware/biometrics/face3760github.com/AndroidGoLab/binder/android/hardware/biometrics/face
android/hardware/biometrics/fingerprint3440github.com/AndroidGoLab/binder/android/hardware/biometrics/fingerprint
android/hardware/bluetooth2010github.com/AndroidGoLab/binder/android/hardware/bluetooth
android/hardware/bluetooth/audio3832612github.com/AndroidGoLab/binder/android/hardware/bluetooth/audio
android/hardware/bluetooth/finder1100github.com/AndroidGoLab/binder/android/hardware/bluetooth/finder
android/hardware/bluetooth/lmp_event2130github.com/AndroidGoLab/binder/android/hardware/bluetooth/lmp_event
android/hardware/bluetooth/offload/leaudio2100github.com/AndroidGoLab/binder/android/hardware/bluetooth/offload/leaudio
android/hardware/bluetooth/ranging39120github.com/AndroidGoLab/binder/android/hardware/bluetooth/ranging
android/hardware/boot1010github.com/AndroidGoLab/binder/android/hardware/boot
android/hardware/broadcastradio41151github.com/AndroidGoLab/binder/android/hardware/broadcastradio
android/hardware/camera/common0350github.com/AndroidGoLab/binder/android/hardware/camera/common
android/hardware/camera/device51992github.com/AndroidGoLab/binder/android/hardware/camera/device
android/hardware/camera/metadata00970github.com/AndroidGoLab/binder/android/hardware/camera/metadata
android/hardware/camera/provider2200github.com/AndroidGoLab/binder/android/hardware/camera/provider
android/hardware/camera25100github.com/AndroidGoLab/binder/android/hardware/camera2
android/hardware/camera2/extension151500github.com/AndroidGoLab/binder/android/hardware/camera2/extension
android/hardware/camera2/impl0300github.com/AndroidGoLab/binder/android/hardware/camera2/impl
android/hardware/camera2/params0400github.com/AndroidGoLab/binder/android/hardware/camera2/params
android/hardware/camera2/utils0300github.com/AndroidGoLab/binder/android/hardware/camera2/utils
android/hardware/cas4441github.com/AndroidGoLab/binder/android/hardware/cas
android/hardware/common0300github.com/AndroidGoLab/binder/android/hardware/common
android/hardware/common/fmq0220github.com/AndroidGoLab/binder/android/hardware/common/fmq
android/hardware/confirmationui2020github.com/AndroidGoLab/binder/android/hardware/confirmationui
android/hardware/contexthub2940github.com/AndroidGoLab/binder/android/hardware/contexthub
android/hardware/devicestate2100github.com/AndroidGoLab/binder/android/hardware/devicestate
android/hardware/display51100github.com/AndroidGoLab/binder/android/hardware/display
android/hardware/drm422102github.com/AndroidGoLab/binder/android/hardware/drm
android/hardware/dumpstate1010github.com/AndroidGoLab/binder/android/hardware/dumpstate
android/hardware/face3700github.com/AndroidGoLab/binder/android/hardware/face
android/hardware/fastboot1010github.com/AndroidGoLab/binder/android/hardware/fastboot
android/hardware/fingerprint8500github.com/AndroidGoLab/binder/android/hardware/fingerprint
android/hardware/gatekeeper1200github.com/AndroidGoLab/binder/android/hardware/gatekeeper
android/hardware/gnss2230170github.com/AndroidGoLab/binder/android/hardware/gnss
android/hardware/gnss/measurement_corrections2400github.com/AndroidGoLab/binder/android/hardware/gnss/measurement_corrections
android/hardware/gnss/visibility_control2130github.com/AndroidGoLab/binder/android/hardware/gnss/visibility_control
android/hardware/graphics/allocator1210github.com/AndroidGoLab/binder/android/hardware/graphics/allocator
android/hardware/graphics/common013141github.com/AndroidGoLab/binder/android/hardware/graphics/common
android/hardware/graphics/composer3343141github.com/AndroidGoLab/binder/android/hardware/graphics/composer3
android/hardware/hdmi12300github.com/AndroidGoLab/binder/android/hardware/hdmi
android/hardware/health2460github.com/AndroidGoLab/binder/android/hardware/health
android/hardware/health/storage2010github.com/AndroidGoLab/binder/android/hardware/health/storage
android/hardware/identity4510github.com/AndroidGoLab/binder/android/hardware/identity
android/hardware/input72100github.com/AndroidGoLab/binder/android/hardware/input
android/hardware/input/common04110github.com/AndroidGoLab/binder/android/hardware/input/common
android/hardware/input/processor1000github.com/AndroidGoLab/binder/android/hardware/input/processor
android/hardware/ir1100github.com/AndroidGoLab/binder/android/hardware/ir
android/hardware/iris1000github.com/AndroidGoLab/binder/android/hardware/iris
android/hardware/keymaster0320github.com/AndroidGoLab/binder/android/hardware/keymaster
android/hardware/light1230github.com/AndroidGoLab/binder/android/hardware/light
android/hardware/lights1200github.com/AndroidGoLab/binder/android/hardware/lights
android/hardware/location121200github.com/AndroidGoLab/binder/android/hardware/location
android/hardware/macsec1000github.com/AndroidGoLab/binder/android/hardware/macsec
android/hardware/media/bufferpool24711github.com/AndroidGoLab/binder/android/hardware/media/bufferpool2
android/hardware/media/c2103552github.com/AndroidGoLab/binder/android/hardware/media/c2
android/hardware/memtrack1210github.com/AndroidGoLab/binder/android/hardware/memtrack
android/hardware/net/nlinterceptor1100github.com/AndroidGoLab/binder/android/hardware/net/nlinterceptor
android/hardware/neuralnetworks72683github.com/AndroidGoLab/binder/android/hardware/neuralnetworks
android/hardware/nfc2240github.com/AndroidGoLab/binder/android/hardware/nfc
android/hardware/oemlock1010github.com/AndroidGoLab/binder/android/hardware/oemlock
android/hardware/power2651github.com/AndroidGoLab/binder/android/hardware/power
android/hardware/power/stats1910github.com/AndroidGoLab/binder/android/hardware/power/stats
android/hardware/radio51370github.com/AndroidGoLab/binder/android/hardware/radio
android/hardware/radio/config3410github.com/AndroidGoLab/binder/android/hardware/radio/config
android/hardware/radio/data31864github.com/AndroidGoLab/binder/android/hardware/radio/data
android/hardware/radio/ims34140github.com/AndroidGoLab/binder/android/hardware/radio/ims
android/hardware/radio/ims/media41572github.com/AndroidGoLab/binder/android/hardware/radio/ims/media
android/hardware/radio/messaging31110github.com/AndroidGoLab/binder/android/hardware/radio/messaging
android/hardware/radio/modem3850github.com/AndroidGoLab/binder/android/hardware/radio/modem
android/hardware/radio/network343215github.com/AndroidGoLab/binder/android/hardware/radio/network
android/hardware/radio/sap2060github.com/AndroidGoLab/binder/android/hardware/radio/sap
android/hardware/radio/sim31570github.com/AndroidGoLab/binder/android/hardware/radio/sim
android/hardware/radio/voice31890github.com/AndroidGoLab/binder/android/hardware/radio/voice
android/hardware/rebootescrow1000github.com/AndroidGoLab/binder/android/hardware/rebootescrow
android/hardware/secure_element2100github.com/AndroidGoLab/binder/android/hardware/secure_element
android/hardware/security/authgraph1911github.com/AndroidGoLab/binder/android/hardware/security/authgraph
android/hardware/security/keymint312131github.com/AndroidGoLab/binder/android/hardware/security/keymint
android/hardware/security/secretkeeper1100github.com/AndroidGoLab/binder/android/hardware/security/secretkeeper
android/hardware/security/secureclock1200github.com/AndroidGoLab/binder/android/hardware/security/secureclock
android/hardware/security/see/storage4460github.com/AndroidGoLab/binder/android/hardware/security/see/storage
android/hardware/security/sharedsecret1100github.com/AndroidGoLab/binder/android/hardware/security/sharedsecret
android/hardware/sensors21982github.com/AndroidGoLab/binder/android/hardware/sensors
android/hardware/soundtrigger11210github.com/AndroidGoLab/binder/android/hardware/soundtrigger
android/hardware/soundtrigger33000github.com/AndroidGoLab/binder/android/hardware/soundtrigger3
android/hardware/tests/extension/vibrator1020github.com/AndroidGoLab/binder/android/hardware/tests/extension/vibrator
android/hardware/tetheroffload2320github.com/AndroidGoLab/binder/android/hardware/tetheroffload
android/hardware/thermal3330github.com/AndroidGoLab/binder/android/hardware/thermal
android/hardware/threadnetwork2000github.com/AndroidGoLab/binder/android/hardware/threadnetwork
android/hardware/tv/hdmi/cec2160github.com/AndroidGoLab/binder/android/hardware/tv/hdmi/cec
android/hardware/tv/hdmi/connection2130github.com/AndroidGoLab/binder/android/hardware/tv/hdmi/connection
android/hardware/tv/hdmi/earc2020github.com/AndroidGoLab/binder/android/hardware/tv/hdmi/earc
android/hardware/tv/input2540github.com/AndroidGoLab/binder/android/hardware/tv/input
android/hardware/tv/tuner12609228github.com/AndroidGoLab/binder/android/hardware/tv/tuner
android/hardware/usb69142github.com/AndroidGoLab/binder/android/hardware/usb
android/hardware/usb/gadget2120github.com/AndroidGoLab/binder/android/hardware/usb/gadget
android/hardware/uwb3020github.com/AndroidGoLab/binder/android/hardware/uwb
android/hardware/uwb/fira_android00120github.com/AndroidGoLab/binder/android/hardware/uwb/fira_android
android/hardware/vibrator3341github.com/AndroidGoLab/binder/android/hardware/vibrator
android/hardware/weaver1210github.com/AndroidGoLab/binder/android/hardware/weaver
android/hardware/wifi1292550github.com/AndroidGoLab/binder/android/hardware/wifi
android/hardware/wifi/common0100github.com/AndroidGoLab/binder/android/hardware/wifi/common
android/hardware/wifi/hostapd2780github.com/AndroidGoLab/binder/android/hardware/wifi/hostapd
android/hardware/wifi/supplicant1045650github.com/AndroidGoLab/binder/android/hardware/wifi/supplicant
android/location (2 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/location142000github.com/AndroidGoLab/binder/android/location
android/location/provider5400github.com/AndroidGoLab/binder/android/location/provider
android/media (18 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/media6697292github.com/AndroidGoLab/binder/android/media
android/media/audio1010github.com/AndroidGoLab/binder/android/media/audio
android/media/audio/common041316github.com/AndroidGoLab/binder/android/media/audio/common
android/media/audiopolicy1500github.com/AndroidGoLab/binder/android/media/audiopolicy
android/media/browse0100github.com/AndroidGoLab/binder/android/media/browse
android/media/metrics1600github.com/AndroidGoLab/binder/android/media/metrics
android/media/midi5200github.com/AndroidGoLab/binder/android/media/midi
android/media/musicrecognition5100github.com/AndroidGoLab/binder/android/media/musicrecognition
android/media/permission0100github.com/AndroidGoLab/binder/android/media/permission
android/media/projection4210github.com/AndroidGoLab/binder/android/media/projection
android/media/session11400github.com/AndroidGoLab/binder/android/media/session
android/media/soundtrigger21060github.com/AndroidGoLab/binder/android/media/soundtrigger
android/media/soundtrigger_middleware8300github.com/AndroidGoLab/binder/android/media/soundtrigger_middleware
android/media/tv111700github.com/AndroidGoLab/binder/android/media/tv
android/media/tv/ad7100github.com/AndroidGoLab/binder/android/media/tv/ad
android/media/tv/interactive7200github.com/AndroidGoLab/binder/android/media/tv/interactive
android/media/tv/tuner12000github.com/AndroidGoLab/binder/android/media/tv/tuner
android/media/tv/tunerresourcemanager2900github.com/AndroidGoLab/binder/android/media/tv/tunerresourcemanager
android/net (5 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/net111300github.com/AndroidGoLab/binder/android/net
android/net/vcn3300github.com/AndroidGoLab/binder/android/net/vcn
android/net/wifi/nl8021110600github.com/AndroidGoLab/binder/android/net/wifi/nl80211
android/net/wifi/sharedconnectivity/app0600github.com/AndroidGoLab/binder/android/net/wifi/sharedconnectivity/app
android/net/wifi/sharedconnectivity/service2000github.com/AndroidGoLab/binder/android/net/wifi/sharedconnectivity/service
android/nfc (2 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/nfc12900github.com/AndroidGoLab/binder/android/nfc
android/nfc/cardemulation0300github.com/AndroidGoLab/binder/android/nfc/cardemulation
android/os (7 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/os535451github.com/AndroidGoLab/binder/android/os
android/os/connectivity0400github.com/AndroidGoLab/binder/android/os/connectivity
android/os/health0100github.com/AndroidGoLab/binder/android/os/health
android/os/image1000github.com/AndroidGoLab/binder/android/os/image
android/os/incremental4400github.com/AndroidGoLab/binder/android/os/incremental
android/os/logcat1000github.com/AndroidGoLab/binder/android/os/logcat
android/os/storage4600github.com/AndroidGoLab/binder/android/os/storage
android/permission (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/permission5500github.com/AndroidGoLab/binder/android/permission
android/print (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/print11800github.com/AndroidGoLab/binder/android/print
android/printservice (2 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/printservice2100github.com/AndroidGoLab/binder/android/printservice
android/printservice/recommendation3100github.com/AndroidGoLab/binder/android/printservice/recommendation
android/se (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/se/omapi5000github.com/AndroidGoLab/binder/android/se/omapi
android/security (6 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/security3100github.com/AndroidGoLab/binder/android/security
android/security/attestationverification2300github.com/AndroidGoLab/binder/android/security/attestationverification
android/security/keymaster0100github.com/AndroidGoLab/binder/android/security/keymaster
android/security/keystore1400github.com/AndroidGoLab/binder/android/security/keystore
android/security/keystore/recovery0500github.com/AndroidGoLab/binder/android/security/keystore/recovery
android/security/rkp5110github.com/AndroidGoLab/binder/android/security/rkp
android/service (43 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/service/ambientcontext1200github.com/AndroidGoLab/binder/android/service/ambientcontext
android/service/appprediction1000github.com/AndroidGoLab/binder/android/service/appprediction
android/service/assist/classification2300github.com/AndroidGoLab/binder/android/service/assist/classification
android/service/attention3000github.com/AndroidGoLab/binder/android/service/attention
android/service/autofill91000github.com/AndroidGoLab/binder/android/service/autofill
android/service/autofill/augmented2000github.com/AndroidGoLab/binder/android/service/autofill/augmented
android/service/carrier5200github.com/AndroidGoLab/binder/android/service/carrier
android/service/chooser2100github.com/AndroidGoLab/binder/android/service/chooser
android/service/contentcapture6300github.com/AndroidGoLab/binder/android/service/contentcapture
android/service/contentsuggestions1000github.com/AndroidGoLab/binder/android/service/contentsuggestions
android/service/controls4100github.com/AndroidGoLab/binder/android/service/controls
android/service/controls/actions0100github.com/AndroidGoLab/binder/android/service/controls/actions
android/service/controls/templates0200github.com/AndroidGoLab/binder/android/service/controls/templates
android/service/credentials4500github.com/AndroidGoLab/binder/android/service/credentials
android/service/displayhash1100github.com/AndroidGoLab/binder/android/service/displayhash
android/service/dreams6000github.com/AndroidGoLab/binder/android/service/dreams
android/service/euicc16500github.com/AndroidGoLab/binder/android/service/euicc
android/service/games5400github.com/AndroidGoLab/binder/android/service/games
android/service/media2000github.com/AndroidGoLab/binder/android/service/media
android/service/notification41200github.com/AndroidGoLab/binder/android/service/notification
android/service/oemlock1000github.com/AndroidGoLab/binder/android/service/oemlock
android/service/ondeviceintelligence5000github.com/AndroidGoLab/binder/android/service/ondeviceintelligence
android/service/persistentdata1000github.com/AndroidGoLab/binder/android/service/persistentdata
android/service/quickaccesswallet2700github.com/AndroidGoLab/binder/android/service/quickaccesswallet
android/service/quicksettings2100github.com/AndroidGoLab/binder/android/service/quicksettings
android/service/remotelockscreenvalidation2000github.com/AndroidGoLab/binder/android/service/remotelockscreenvalidation
android/service/resolver2100github.com/AndroidGoLab/binder/android/service/resolver
android/service/resumeonreboot1000github.com/AndroidGoLab/binder/android/service/resumeonreboot
android/service/rotationresolver2100github.com/AndroidGoLab/binder/android/service/rotationresolver
android/service/search1000github.com/AndroidGoLab/binder/android/service/search
android/service/settings/suggestions1100github.com/AndroidGoLab/binder/android/service/settings/suggestions
android/service/smartspace1000github.com/AndroidGoLab/binder/android/service/smartspace
android/service/storage1000github.com/AndroidGoLab/binder/android/service/storage
android/service/textclassifier2000github.com/AndroidGoLab/binder/android/service/textclassifier
android/service/timezone2300github.com/AndroidGoLab/binder/android/service/timezone
android/service/translation2000github.com/AndroidGoLab/binder/android/service/translation
android/service/trust2100github.com/AndroidGoLab/binder/android/service/trust
android/service/voice9900github.com/AndroidGoLab/binder/android/service/voice
android/service/vr4000github.com/AndroidGoLab/binder/android/service/vr
android/service/wallpaper3000github.com/AndroidGoLab/binder/android/service/wallpaper
android/service/wallpapereffectsgeneration1000github.com/AndroidGoLab/binder/android/service/wallpapereffectsgeneration
android/service/watchdog1100github.com/AndroidGoLab/binder/android/service/watchdog
android/service/wearable1000github.com/AndroidGoLab/binder/android/service/wearable
android/speech (2 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/speech6400github.com/AndroidGoLab/binder/android/speech
android/speech/tts5100github.com/AndroidGoLab/binder/android/speech/tts
android/system (4 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/system/keystore23930github.com/AndroidGoLab/binder/android/system/keystore2
android/system/net/netd1100github.com/AndroidGoLab/binder/android/system/net/netd
android/system/suspend5010github.com/AndroidGoLab/binder/android/system/suspend
android/system/suspend/internal_1300github.com/AndroidGoLab/binder/android/system/suspend/internal_
android/telecom (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/telecom02800github.com/AndroidGoLab/binder/android/telecom
android/telephony (14 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/telephony75600github.com/AndroidGoLab/binder/android/telephony
android/telephony/cdma0100github.com/AndroidGoLab/binder/android/telephony/cdma
android/telephony/data41100github.com/AndroidGoLab/binder/android/telephony/data
android/telephony/emergency0100github.com/AndroidGoLab/binder/android/telephony/emergency
android/telephony/euicc0400github.com/AndroidGoLab/binder/android/telephony/euicc
android/telephony/gba1200github.com/AndroidGoLab/binder/android/telephony/gba
android/telephony/ims02900github.com/AndroidGoLab/binder/android/telephony/ims
android/telephony/ims/aidl29000github.com/AndroidGoLab/binder/android/telephony/ims/aidl
android/telephony/ims/feature0200github.com/AndroidGoLab/binder/android/telephony/ims/feature
android/telephony/ims/stub0100github.com/AndroidGoLab/binder/android/telephony/ims/stub
android/telephony/mbms7600github.com/AndroidGoLab/binder/android/telephony/mbms
android/telephony/mbms/vendor3000github.com/AndroidGoLab/binder/android/telephony/mbms/vendor
android/telephony/satellite8700github.com/AndroidGoLab/binder/android/telephony/satellite
android/telephony/satellite/stub5440github.com/AndroidGoLab/binder/android/telephony/satellite/stub
android/tests (2 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/tests/binder1000github.com/AndroidGoLab/binder/android/tests/binder
android/tests/enforcepermission2000github.com/AndroidGoLab/binder/android/tests/enforcepermission
android/text (2 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/text0200github.com/AndroidGoLab/binder/android/text
android/text/style0100github.com/AndroidGoLab/binder/android/text/style
android/tracing (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/tracing1100github.com/AndroidGoLab/binder/android/tracing
android/util (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/util1200github.com/AndroidGoLab/binder/android/util
android/view (9 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/view353810github.com/AndroidGoLab/binder/android/view
android/view/accessibility8800github.com/AndroidGoLab/binder/android/view/accessibility
android/view/autofill4200github.com/AndroidGoLab/binder/android/view/autofill
android/view/contentcapture4500github.com/AndroidGoLab/binder/android/view/contentcapture
android/view/displayhash0200github.com/AndroidGoLab/binder/android/view/displayhash
android/view/inputmethod02600github.com/AndroidGoLab/binder/android/view/inputmethod
android/view/textclassifier01500github.com/AndroidGoLab/binder/android/view/textclassifier
android/view/textservice0500github.com/AndroidGoLab/binder/android/view/textservice
android/view/translation31000github.com/AndroidGoLab/binder/android/view/translation
android/webkit (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/webkit1200github.com/AndroidGoLab/binder/android/webkit
android/widget (2 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/widget0300github.com/AndroidGoLab/binder/android/widget
android/widget/inline0100github.com/AndroidGoLab/binder/android/widget/inline
android/window (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
android/window263800github.com/AndroidGoLab/binder/android/window
bluetooth/constants (2 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
bluetooth/constants0010github.com/AndroidGoLab/binder/bluetooth/constants
bluetooth/constants/aics0030github.com/AndroidGoLab/binder/bluetooth/constants/aics
com/android (61 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
com/android/codegentest0300github.com/AndroidGoLab/binder/com/android/codegentest
com/android/frameworks/coretests/aidl8000github.com/AndroidGoLab/binder/com/android/frameworks/coretests/aidl
com/android/frameworks/perftests/am/util2000github.com/AndroidGoLab/binder/com/android/frameworks/perftests/am/util
com/android/ims1100github.com/AndroidGoLab/binder/com/android/ims
com/android/ims/internal_19000github.com/AndroidGoLab/binder/com/android/ims/internal_
com/android/ims/internal_/uce/common0300github.com/AndroidGoLab/binder/com/android/ims/internal_/uce/common
com/android/ims/internal_/uce/options2400github.com/AndroidGoLab/binder/com/android/ims/internal_/uce/options
com/android/ims/internal_/uce/presence21100github.com/AndroidGoLab/binder/com/android/ims/internal_/uce/presence
com/android/ims/internal_/uce/uceservice2000github.com/AndroidGoLab/binder/com/android/ims/internal_/uce/uceservice
com/android/internal_/app23100github.com/AndroidGoLab/binder/com/android/internal_/app
com/android/internal_/app/procstats1100github.com/AndroidGoLab/binder/com/android/internal_/app/procstats
com/android/internal_/appwidget2000github.com/AndroidGoLab/binder/com/android/internal_/appwidget
com/android/internal_/backup3000github.com/AndroidGoLab/binder/com/android/internal_/backup
com/android/internal_/compat3700github.com/AndroidGoLab/binder/com/android/internal_/compat
com/android/internal_/content0100github.com/AndroidGoLab/binder/com/android/internal_/content
com/android/internal_/graphics/fonts1000github.com/AndroidGoLab/binder/com/android/internal_/graphics/fonts
com/android/internal_/infra1100github.com/AndroidGoLab/binder/com/android/internal_/infra
com/android/internal_/inputmethod15600github.com/AndroidGoLab/binder/com/android/internal_/inputmethod
com/android/internal_/logging0100github.com/AndroidGoLab/binder/com/android/internal_/logging
com/android/internal_/net3300github.com/AndroidGoLab/binder/com/android/internal_/net
com/android/internal_/os5300github.com/AndroidGoLab/binder/com/android/internal_/os
com/android/internal_/policy7000github.com/AndroidGoLab/binder/com/android/internal_/policy
com/android/internal_/statusbar6600github.com/AndroidGoLab/binder/com/android/internal_/statusbar
com/android/internal_/telecom23000github.com/AndroidGoLab/binder/com/android/internal_/telecom
com/android/internal_/telephony29500github.com/AndroidGoLab/binder/com/android/internal_/telephony
com/android/internal_/telephony/euicc24000github.com/AndroidGoLab/binder/com/android/internal_/telephony/euicc
com/android/internal_/textservice6000github.com/AndroidGoLab/binder/com/android/internal_/textservice
com/android/internal_/util0100github.com/AndroidGoLab/binder/com/android/internal_/util
com/android/internal_/view2100github.com/AndroidGoLab/binder/com/android/internal_/view
com/android/internal_/view/inline2000github.com/AndroidGoLab/binder/com/android/internal_/view/inline
com/android/internal_/widget5200github.com/AndroidGoLab/binder/com/android/internal_/widget
com/android/net3000github.com/AndroidGoLab/binder/com/android/net
com/android/onemedia2000github.com/AndroidGoLab/binder/com/android/onemedia
com/android/onemedia/playback1000github.com/AndroidGoLab/binder/com/android/onemedia/playback
com/android/printspooler/renderer2000github.com/AndroidGoLab/binder/com/android/printspooler/renderer
com/android/server/bluetooth12800github.com/AndroidGoLab/binder/com/android/server/bluetooth
com/android/server/inputflinger6310github.com/AndroidGoLab/binder/com/android/server/inputflinger
com/android/server/power/stats0100github.com/AndroidGoLab/binder/com/android/server/power/stats
com/android/smspush/unitTests1000github.com/AndroidGoLab/binder/com/android/smspush/unitTests
com/android/systemui/assist1000github.com/AndroidGoLab/binder/com/android/systemui/assist
com/android/systemui/notetask1000github.com/AndroidGoLab/binder/com/android/systemui/notetask
com/android/systemui/screenshot3000github.com/AndroidGoLab/binder/com/android/systemui/screenshot
com/android/systemui/screenshot/appclips1100github.com/AndroidGoLab/binder/com/android/systemui/screenshot/appclips
com/android/systemui/shared/recents2000github.com/AndroidGoLab/binder/com/android/systemui/shared/recents
com/android/systemui/shared/recents/model0100github.com/AndroidGoLab/binder/com/android/systemui/shared/recents/model
com/android/systemui/shared/system/smartspace2100github.com/AndroidGoLab/binder/com/android/systemui/shared/system/smartspace
com/android/systemui/unfold/progress2000github.com/AndroidGoLab/binder/com/android/systemui/unfold/progress
com/android/systemui/wallet/controller2000github.com/AndroidGoLab/binder/com/android/systemui/wallet/controller
com/android/test/binder2000github.com/AndroidGoLab/binder/com/android/test/binder
com/android/test/viewembed2000github.com/AndroidGoLab/binder/com/android/test/viewembed
com/android/wm/shell/back1000github.com/AndroidGoLab/binder/com/android/wm/shell/back
com/android/wm/shell/bubbles2000github.com/AndroidGoLab/binder/com/android/wm/shell/bubbles
com/android/wm/shell/common/pip2000github.com/AndroidGoLab/binder/com/android/wm/shell/common/pip
com/android/wm/shell/desktopmode2000github.com/AndroidGoLab/binder/com/android/wm/shell/desktopmode
com/android/wm/shell/draganddrop1000github.com/AndroidGoLab/binder/com/android/wm/shell/draganddrop
com/android/wm/shell/onehanded1000github.com/AndroidGoLab/binder/com/android/wm/shell/onehanded
com/android/wm/shell/recents2000github.com/AndroidGoLab/binder/com/android/wm/shell/recents
com/android/wm/shell/splitscreen3000github.com/AndroidGoLab/binder/com/android/wm/shell/splitscreen
com/android/wm/shell/startingsurface2000github.com/AndroidGoLab/binder/com/android/wm/shell/startingsurface
com/android/wm/shell/transition2000github.com/AndroidGoLab/binder/com/android/wm/shell/transition
com/android/wm/shell/util0100github.com/AndroidGoLab/binder/com/android/wm/shell/util
com/example (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
com/example1000github.com/AndroidGoLab/binder/com/example
com/google (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
com/google/android/lint/integration_tests1000github.com/AndroidGoLab/binder/com/google/android/lint/integration_tests
fuzztest (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
fuzztest1000github.com/AndroidGoLab/binder/fuzztest
parcelables (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
parcelables0310github.com/AndroidGoLab/binder/parcelables
src/com (1 packages)
PackageInterfacesParcelablesEnumsUnionsImport Path
src/com/android/commands/uinput0100github.com/AndroidGoLab/binder/src/com/android/commands/uinput

Commands and Tools

Description
tools/cmd/aidl2specAIDL-to-YAML spec compiler: parses AOSP AIDL files and emits spec files
tools/cmd/java2specExtracts service maps and parcelable info from Java sources into specs
tools/cmd/spec2goGenerates Go proxy code (and smoke tests) from YAML spec files
tools/cmd/spec2cliGenerates bindercli command registry from YAML spec files
tools/cmd/spec2readmeRegenerates the package table in this README from spec files

bindercli

bindercli is a unified command-line tool for interacting with Android Binder services and the AIDL compiler. It auto-generates subcommands for every AIDL interface in the project (1,500+ interfaces, 14,000+ methods), so you can call any Android system service method directly from the command line with typed flags.

Build and deploy:

GOOS=linux GOARCH=arm64 go build -o build/bindercli ./cmd/bindercli/
adb push build/bindercli /data/local/tmp/

Core subcommands:

CommandDescription
bindercli service listList all registered binder services with alive/dead status
bindercli service inspect <name>Show a service's handle, descriptor, and alive status
bindercli service methods <name>List all methods with their transaction codes
bindercli service transact <name> <code-or-method> [hex]Send a raw binder transaction (code or method name)
bindercli service resolve <name> <method-or-code>Resolve between method names and transaction codes
bindercli aidl compile [-I path] <files>Compile .aidl files to Go
bindercli aidl parse <file>Dump parsed AIDL AST as JSON
bindercli aidl check <files>Validate AIDL files without generating
bindercli <descriptor> <method> [--flags]Call any AIDL method with typed parameters

Global flags: --format json|text|auto, --binder-device, --map-size.

Examples

Note: Transaction codes are resolved dynamically from the device's framework JARs (/system/framework/*.jar) at runtime. Compiled version tables are used as a fallback when JARs are not readable. The service subcommands and ServiceManager-level lookups work across all versions.

List and inspect services
# List all registered binder services with alive/dead status
bindercli service list
# Inspect a specific service (show handle, descriptor, alive status)
bindercli service inspect SurfaceFlinger
# List methods available on a service with transaction codes
bindercli service methods activity
# Resolve a method name to its transaction code (or vice versa)
bindercli service resolve activity is-user-a-monkey
# Send a raw binder transaction by method name or numeric code
bindercli service transact activity is-user-a-monkey
bindercli service transact SurfaceFlinger 64
Query power and battery state
# Check if screen is on
bindercli android.os.IPowerManager is-interactive
# Example output: {"result":true}# Check power save mode
bindercli android.os.IPowerManager is-power-save-mode
# Example output: {"result":false}# Check if device is in Doze mode
bindercli android.os.IPowerManager is-device-idle-mode
# Example output: {"result":false}# Get battery health info
bindercli android.hardware.health.IHealth get-health-info
Connect to a WiFi AP with SSID "MyNetwork" and PSK "secret123"
# Step 1: Add a new network via the supplicant
bindercli android.hardware.wifi.supplicant.ISupplicantStaIface add-network
# Step 2: Set the SSID (pass as hex-encoded bytes; "MyNetwork" = 4d794e6574776f726b)
bindercli android.hardware.wifi.supplicant.ISupplicantStaNetwork set-ssid \
--ssid 4d794e6574776f726b
# Step 3: Set the WPA passphrase
bindercli android.hardware.wifi.supplicant.ISupplicantStaNetwork set-psk-passphrase \
--psk secret123
# Step 4: Set key management to WPA-PSK (bit 1 = 0x02)
bindercli android.hardware.wifi.supplicant.ISupplicantStaNetwork set-key-mgmt \
--keyMgmtMask 2
# Step 5: Enable the network to trigger connection
bindercli android.hardware.wifi.supplicant.ISupplicantStaNetwork enable \
--noConnect false# Disconnect from current network
bindercli android.hardware.wifi.supplicant.ISupplicantStaIface disconnect
# List saved networks
bindercli android.hardware.wifi.supplicant.ISupplicantStaIface list-networks
Take a picture from the camera
# List available camera devices
bindercli android.hardware.camera.provider.ICameraProvider get-camera-id-list
# Get camera characteristics (resolution, capabilities, etc.)
bindercli android.hardware.camera.device.ICameraDevice get-camera-characteristics
# Toggle flashlight/torch mode
bindercli android.hardware.camera.provider.ICameraProvider set-torch-mode \
--cameraDeviceName "0" --enabled true

Note: Full camera capture requires a callback-driven session flow (open -> configure streams -> capture request -> receive frames). The individual steps are available as commands, but the session orchestration needs a script or the Go API directly.

Record from microphone
# Get active microphones on an input stream
bindercli android.hardware.audio.core.IStreamIn get-active-microphones
# Set microphone field dimension (for directional recording)
bindercli android.hardware.audio.core.IStreamIn set-microphone-field-dimension \
--zoom 1.0
# Set microphone direction# 0=UNSPECIFIED, 1=FRONT, 2=BACK, 3=EXTERNAL
bindercli android.hardware.audio.core.IStreamIn set-microphone-direction \
--direction 1

Note: Actual audio capture requires opening an input stream via IModule.openInputStream() with an audio configuration, then reading PCM data from the returned stream handle. Use the Go API for the full recording flow.

Query battery, power, and thermal status
# Get current thermal status (0=none, 1=light, 2=moderate, ...)
bindercli android.os.IThermalService get-current-thermal-status
# Example output: {"result":0}# Check if device is in power save mode
bindercli android.os.IPowerManager is-power-save-mode
# Example output: {"result":false}# Check if device is interactive (screen on)
bindercli android.os.IPowerManager is-interactive
# Reboot the device
bindercli android.os.IPowerManager reboot \
--confirm false --reason "cli-reboot" --wait true
Query packages and app info
# Check if a package is installed
bindercli android.content.pm.IPackageManager is-package-available \
--packageName com.android.settings --userId 0
# Example output: {"result":true}# Check a permission
bindercli android.content.pm.IPackageManager check-permission \
--permName android.permission.INTERNET \
--pkgName com.android.settings --userId 0
# Get the installer of a package
bindercli android.content.pm.IPackageManager get-installer-package-name \
--packageName com.android.chrome
Display info
# Get display IDs
bindercli android.hardware.display.IDisplayManager get-display-ids \
--includeDisabled false# Example output: {"result":[0]}
Clipboard operations
# Check if clipboard has text
bindercli android.content.IClipboard has-clipboard-text \
--callingPackage com.android.shell \
--attributionTag "" --userId 0 --deviceId 0
# Example output: {"result":false}
Bluetooth operations
# Initialize Bluetooth HCI
bindercli android.hardware.bluetooth.IBluetoothHci initialize \
--callback <callback_service># Send raw HCI command (hex bytes)
bindercli android.hardware.bluetooth.IBluetoothHci send-hci-command \
--command 01030c00
# Close Bluetooth HCI
bindercli android.hardware.bluetooth.IBluetoothHci close
ActivityManager queries
# Check if user is a monkey (automated test)
bindercli android.app.IActivityManager is-user-a-monkey
# Get process memory limit
bindercli android.app.IActivityManager get-process-limit
# Check a permission for a process
bindercli android.app.IActivityManager check-permission \
--permission android.permission.INTERNET --pid 1 --uid 0
# Force stop a package
bindercli android.app.IActivityManager force-stop-package \
--packageName com.example.app --userId 0
# Check if app freezer is supported
bindercli android.app.IActivityManager is-app-freezer-supported
Telephony
# Get active phone type (0=NONE, 1=GSM, 2=CDMA)
bindercli com.android.internal.telephony.ITelephony get-active-phone-type
# Get network country ISO
bindercli com.android.internal.telephony.ITelephony get-network-country-iso-for-phone \
--phoneId 0

Verified Devices

Commands are tested against the following devices. The runtime uses version-aware transaction code resolution (binder/versionaware) that dynamically extracts codes from the device's framework JARs, with compiled tables as a fallback. "SM" = ServiceManager-level lookup, "Proxy" = generated proxy method with version-aware code resolution.

Verification matrix
CommandTypePixel 8a (API 36)Emulator (API 35)
service listSMPASSPASS
service inspectSMPASSPASS
location get-all-providersProxyPASSPASS
location is-provider-enabled-for-userProxyPASSPASS
location get-gnss-hardware-model-nameProxyPASSPASS
location get-gnss-year-of-hardwareProxyPASSPASS
thermal get-current-thermal-statusProxyPASSPASS
power is-power-save-modeProxyPASSPASS
power is-interactiveProxyPASSPASS
pm is-package-availableProxyPASSPASS
display get-display-idsProxyPASSPASS
clipboard has-clipboard-textProxyPASSPASS
am check-permissionProxyPASSPASS
am is-user-a-monkeyProxyFLAKY*PASS
am get-process-limitProxyFLAKY*PASS

* Some IActivityManager methods return empty replies intermittently on the Pixel 8a, likely due to the device's firmware AIDL revision having additional methods beyond the android-16.0.0_r1 snapshot. The transaction code offset may be off by 1-2 for some methods.

Architecture

The project has two major parts: a compiler that turns .aidl files into Go source code, and a runtime that implements the Binder IPC protocol for communicating with Android services.

flowchart TD
AIDL[".aidl files"]
AOSP["AOSP tools/pkg/3rdparty/"]
subgraph COMPILER["Compiler Pipeline"]
direction TB
LEX["Lexer<br/><i>tokenizes AIDL syntax</i>"]
PARSE["Parser<br/><i>recursive-descent → AST</i>"]
RESOLVE["Resolver<br/><i>import resolution + type registry</i>"]
GRAPH["Import Graph<br/><i>SCC-based cycle detection</i>"]
GEN["Code Generator"]
end
subgraph GENOUT["Generated Output"]
direction LR
PROXY["Interface → Proxy struct<br/>+ transaction methods"]
PARCEL_GEN["Parcelable → Go struct<br/>+ Marshal/Unmarshal"]
ENUM["Enum → typed constants"]
UNION["Union → tagged variant"]
end
subgraph RUNTIME["Binder Runtime"]
direction TB
KBIND["kernelbinder<br/><i>/dev/binder ioctl</i>"]
PARCELF["parcel<br/><i>wire format serialization</i>"]
BIND["binder<br/><i>IBinder + Transact</i>"]
SM["servicemanager<br/><i>GetService / ListServices</i>"]
end
ANDROID["Android System Services<br/><i>ActivityManager, SurfaceFlinger, ...</i>"]
AIDL --> LEX
AOSP --> LEX
LEX --> PARSE
PARSE --> RESOLVE
RESOLVE --> GRAPH
GRAPH --> GEN
GEN --> GENOUT
PROXY --> BIND
BIND --> PARCELF
BIND --> KBIND
SM --> BIND
KBIND --> ANDROID
style AIDL fill:#fff3cd,color:#000
style AOSP fill:#fff3cd,color:#000
style COMPILER fill:#e8eaf6,color:#000
style GENOUT fill:#d4edda,color:#000
style RUNTIME fill:#cce5ff,color:#000
style ANDROID fill:#e0e0e0,color:#000
Loading

Compiler Pipeline

The compiler transforms AIDL source files into Go code through four stages:

flowchart LR
subgraph S1["1. Lex"]
L1["Keywords, identifiers,<br/>operators, literals"]
end
subgraph S2["2. Parse"]
P1["Document AST:<br/>interfaces, parcelables,<br/>enums, unions, constants"]
end
subgraph S3["3. Resolve"]
R1["Transitive imports<br/>Type registry<br/>Circular import detection"]
end
subgraph S4["4. Generate"]
G1["Go source files:<br/>proxies, structs,<br/>marshal/unmarshal"]
end
S1 --> S2 --> S3 --> S4
Loading

Stage 1 — Lexer (tools/pkg/parser/lexer.go): Tokenizes AIDL source into keywords (interface, parcelable, oneway, ...), identifiers, operators, and literals. Handles >> splitting for nested generics like List<List<String>>.

Stage 2 — Parser (tools/pkg/parser/parser.go): Recursive-descent parser builds a typed AST. Supports the full AIDL grammar: interfaces with methods and transaction codes, parcelables with typed fields and defaults, enums with explicit or implicit values, unions, nested types, generics (List<T>, Map<K,V>), annotations (@nullable, @Backing, @utf8InCpp), and constant expressions with arithmetic/bitwise operators.

Stage 3 — Resolver (tools/pkg/resolver/resolver.go): Given search paths (-I flags), resolves AIDL imports transitively. Converts qualified names like android.os.IServiceManager to file paths, parses each imported file, and registers all definitions in a shared TypeRegistry. Detects circular imports. Supports skip-unresolved mode for bulk AOSP processing where some imports reference unavailable files.

Stage 4 — Code Generator (tools/pkg/codegen/): Produces Go source for each AIDL definition:

AIDL TypeGenerated Go Code
InterfaceGo interface + proxy struct with Transact()-based methods, descriptor constant, transaction code constants
ParcelableGo struct with MarshalParcel(*parcel.Parcel) error and UnmarshalParcel(*parcel.Parcel) error
EnumType alias on backing type (int32, int64, byte) + typed const block
UnionStruct with tag field + typed variant accessors

The code generator includes an import graph (tools/pkg/codegen/import_graph.go) that computes strongly-connected components (Tarjan's SCC algorithm) to detect and break import cycles between generated packages.

Binder Runtime

The runtime implements the Android Binder IPC protocol in pure Go:

flowchart TD
subgraph APP["Your Go Application"]
PROXY2["ActivityManagerProxy.GetProcessLimit(ctx)"]
end
subgraph MARSHAL["parcel"]
M1["WriteInterfaceToken(descriptor)"]
M2["WriteInt32 / WriteString16 / ..."]
M3["ReadInt32 / ReadString16 / ..."]
end
subgraph BINDER["binder"]
B1["IBinder.Transact(ctx, code, flags, data)"]
B2["ReadStatus(reply) → check AIDL exceptions"]
end
subgraph KERNEL["kernelbinder"]
K1["open(/dev/binder)"]
K2["mmap(1MB read buffer)"]
K3["ioctl(BINDER_WRITE_READ)"]
end
PROXY2 --> M1
M1 --> M2
M2 --> B1
B1 --> K3
K3 -->|reply| B2
B2 --> M3
M3 -->|typed result| PROXY2
Loading

kernelbinder.Driver: Opens /dev/binder, verifies the protocol version via ioctl, memory-maps the kernel buffer, and implements Transact() as a write-read ioctl. Handles transaction replies, error codes, and death notifications.

parcel.Parcel: 4-byte aligned, little-endian byte buffer implementing the Binder wire format. Writes/reads all AIDL primitive types (int32, int64, float, double, bool, byte, String as UTF-16), arrays, binder handles (flat_binder_object), and file descriptors.

binder.ProxyBinder: Client-side handle wrapping a kernel binder reference. Provides Transact(), IsAlive() (ping), and death notification registration (LinkToDeath/UnlinkToDeath).

servicemanager: Client for Android's ServiceManager, the registry of all system services. Implements GetService(), CheckService(), ListServices(), and AddService() as typed binder transactions.

Generated Code

For an AIDL interface like:

// android/app/IActivityManager.aidlpackageandroid.app;
interfaceIActivityManager {
intgetProcessLimit();
intcheckPermission(inStringpermission, intpid, intuid);
booleanisUserAMonkey();
// ... 200+ more methods
}

The compiler generates:

package app
constDescriptorIActivityManager="android.app.IActivityManager"const (
TransactionIActivityManagerGetProcessLimit=binder.FirstCallTransaction+51TransactionIActivityManagerCheckPermission=binder.FirstCallTransaction+8// ...
)
const (
MethodIActivityManagerGetProcessLimit="getProcessLimit"MethodIActivityManagerCheckPermission="checkPermission"// ...
)
typeIActivityManagerinterface {
GetProcessLimit(ctx context.Context) (int32, error)
CheckPermission(ctx context.Context, permissionstring, pidint32, uidint32) (int32, error)
IsUserAMonkey(ctx context.Context) (bool, error)
// ...
}
typeActivityManagerProxystruct {
Remote binder.IBinder
}
funcNewActivityManagerProxy(remote binder.IBinder) *ActivityManagerProxy {
return&ActivityManagerProxy{Remote: remote}
}
func (p*ActivityManagerProxy) GetProcessLimit(ctx context.Context) (int32, error) {
var_resultint32_data:=parcel.New()
defer_data.Recycle()
_data.WriteInterfaceToken(DescriptorIActivityManager)
_code, _err:=p.Remote.ResolveCode(ctx, DescriptorIActivityManager, MethodIActivityManagerGetProcessLimit)
if_err!=nil {
return_result, fmt.Errorf("resolving %s.%s: %w", DescriptorIActivityManager, MethodIActivityManagerGetProcessLimit, _err)
}
_reply, _err:=p.Remote.Transact(ctx, _code, 0, _data)
if_err!=nil {
return_result, _err
}
defer_reply.Recycle()
if_err=binder.ReadStatus(_reply); _err!=nil {
return_result, _err
}
_result, _err=_reply.ReadInt32()
if_err!=nil {
return_result, _err
}
return_result, nil
}

Supported AIDL Constructs

ConstructExampleGenerated Go
Interface methodsString getName();Proxy method with marshal/unmarshal
oneway methodsoneway void fire(in String msg);Fire-and-forget (no reply parcel)
Parcelable fieldsint id; String name;Struct + MarshalParcel/UnmarshalParcel
Enums@Backing(type="int") enum Status { OK, FAIL }type Status int32 + typed constants
Unionsunion Result { int value; String error; }Struct with tag + variant accessors
GenericsList<String>, Map<String, int>[]string, map[string]int32
Nullable types@nullable String desc;*string
Constantsconst int VERSION = 1;Package-level const
Nested typesParcelable inside interfaceSeparate file, qualified name
In/out/inoutvoid read(out byte[] buf);Bidirectional parcel marshaling
Annotations@nullable, @utf8InCpp, @BackingAffects type mapping and codegen

Code Generation

From Individual AIDL Files

# Compile AIDL files to Go via bindercli:
bindercli aidl compile -I path/to/search/root --output gen file1.aidl file2.aidl

From AOSP (Bulk Generation)

With the AOSP submodules in tools/pkg/3rdparty/:

git submodule update --init --depth 1
go run ./tools/cmd/aidl2spec -3rdparty tools/pkg/3rdparty -output specs/
go run ./tools/cmd/spec2go -specs specs/ -output . -smoke-tests

This discovers all AIDL files across frameworks-base, frameworks-native, hardware-interfaces, and system-hardware-interfaces, infers search roots from package declarations, and generates Go proxies for all AOSP services. The current AOSP snapshot produces 5,174 Go files across 407 packages.

Transaction Code Resolution

Each binder method has a numeric transaction code that can differ between Android versions. The generated proxies call ResolveCode() at runtime to get the correct code for the device, using a multi-layer detection strategy:

  1. DEX bytecode extraction (primary) — scans /system/framework/*.jar and APEX module JARs, parses DEX bytecode, and reads TRANSACTION_* constants from $Stub classes. Individual interfaces are extracted on demand (lazy), and results are cached to avoid re-scanning. This gives definitive codes for the exact firmware running on the device. This method is expected to work on all Android devices. If it fails on your platform, please open an issue.

  2. Compiled version tables + ELF filtering (fallback) — pre-compiled tables from AOSP revision tags, narrowed by API level and exported symbols in libbinder.so. Used when framework JARs are not readable (e.g. non-Android host, restricted SELinux context).

  3. Live transaction probing (last resort) — sends a test transaction (isUserAMonkey() on ActivityManager) with each candidate code and picks the one that returns a valid response. Used only to distinguish between AOSP revisions when ELF inspection is ambiguous.

Methods 2 and 3 exist only for environments where framework JARs are unavailable. On a standard Android device, all transaction codes are resolved dynamically from the device's own JARs.

Testing and Verification

The project is verified at four levels:

1. Unit Tests

The compiler packages (parser, codegen, resolver, binder, parcel, typesys) and tools/pkg/testutil have unit tests that run without any Android device or special environment:

go test ./tools/pkg/... ./binder/ ./parcel/

These test:

  • Parser correctness: Lexing/parsing of all AIDL constructs against testdata fixtures (interfaces, parcelables, enums, unions, generics, constants, annotations)
  • Code generation: Each generator (GenerateInterface, GenerateParcelable, GenerateEnum, GenerateUnion) is tested by parsing AIDL input, generating Go, and verifying the output is valid gofmt-compliant Go source that contains expected identifiers (descriptors, transaction codes, type names, method signatures)
  • Import cycle detection: Verifies the SCC algorithm correctly identifies and breaks cross-package import cycles
  • Marshal/unmarshal naming: Maps from AIDL types to parcel read/write expressions
  • Parcel serialization: Round-trip encoding/decoding of all primitive types
  • Binder status: Exception code marshaling

2. AOSP Codegen Test

Tests that code generation succeeds for the entire AOSP AIDL surface (requires tools/pkg/3rdparty/ submodules):

go test -tags aosp_codegen -v -run TestCodegenAllAOSP ./tools/pkg/codegen/

Walks all ~11,000 AIDL files, parses each, generates Go code, and verifies the output parses as valid Go. Reports per-file success/failure statistics.

3. Generated Smoke Tests

Auto-generated tests that instantiate every proxy type with a mock binder and call every method with zero-value arguments:

go run ./tools/cmd/spec2go -specs specs/ -output . -smoke-tests
go test ./tests/e2e/... # requires /dev/binder OR mock mode

4. End-to-End Tests on Android

Full integration tests that open /dev/binder and transact with real Android system services:

# Run on Android device or emulator
go test -tags e2e -v ./tests/e2e/...

These verify:

  • ServiceManager: ListServices, GetService, CheckService, service handle aliveness
  • Typed transactions: Call ActivityManager.GetProcessLimit(), SurfaceFlinger.GetPhysicalDisplayIds(), etc. and validate returned types
  • Exception handling: AIDL security exceptions, status codes
  • Parcelable round-trip: Real service data deserialized through generated UnmarshalParcel
  • Concurrency: Multiple goroutines with isolated binder drivers
  • Death notifications: Registration/unregistration lifecycle
  • Oneway transactions: Fire-and-forget calls
  • Error handling: Invalid handles, dead processes

CI

Unit tests run automatically on every push and pull request via GitHub Actions. E2E tests require an Android device and must be run manually.

A weekly workflow checks for new AOSP revision tags, regenerates version tables and proxy code, and opens a PR automatically if anything changed.

binder-mcp

AI agents can interact with Android devices through binder-mcp, a Model Context Protocol server that exposes binder services as tools.

Device mode

# Build and push
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o build/binder-mcp ./cmd/binder-mcp/
adb push build/binder-mcp /data/local/tmp/
# Use with Claude Code (or any MCP client)# In your MCP config, add:# {# "mcpServers": {# "android": {# "command": "adb",# "args": ["shell", "/data/local/tmp/binder-mcp"]# }# }# }

Remote mode (runs on host)

go run ./cmd/binder-mcp/ --mode remote
# Auto-discovers device via ADB, pushes daemon, serves MCP on stdio

Available tools

ToolDescription
list_servicesEnumerate all binder services
get_service_infoDescriptor, handle, liveness for a service
call_methodInvoke raw binder transactions
get_device_infoPower, display, thermal status
get_locationGPS/fused location
check_permissionsSELinux context and service accessibility

Using binder-mcp with AI Agents

Installation

# Via go install
go install github.com/AndroidGoLab/binder/cmd/binder-mcp@latest
# Via GitHub releases (pre-built binaries)# Download from https://github.com/AndroidGoLab/binder/releases# Via Docker (host mode)
docker run ghcr.io/androidgolab/binder-mcp

Claude Code

claude mcp add --transport stdio binder-mcp -- binder-mcp --mode remote

Cursor

Add to .cursor/mcp.json:

{
"mcpServers": {
"binder-mcp": {
"command": "binder-mcp",
"args": ["--mode", "remote"]
}
}
}

Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

{
"mcpServers": {
"binder-mcp": {
"command": "binder-mcp",
"args": ["--mode", "remote"]
}
}
}

Cline

Add to Cline MCP settings:

{
"mcpServers": {
"binder-mcp": {
"command": "binder-mcp",
"args": ["--mode", "remote"],
"alwaysAllow": ["list_services", "get_device_info", "take_screenshot"]
}
}
}

On-device mode (via adb)

# Build for Android
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o binder-mcp ./cmd/binder-mcp/
adb push binder-mcp /data/local/tmp/
# Configure agent to use adb transport
claude mcp add --transport stdio binder-mcp -- adb shell /data/local/tmp/binder-mcp

Interoperability

gadb — Pure Go ADB for CI/CD

The interop/gadb/runner/ package provides pure-Go ADB device control without requiring the adb binary. Discover devices, push binaries, and run commands programmatically:

dr, _:=runner.NewDeviceRunner("SERIAL")
dr.PushBinary(ctx, "build/mybinary", "/data/local/tmp/mybinary")
result, _:=dr.Run(ctx, "/data/local/tmp/mybinary", 30*time.Second)
fmt.Println(result.Stdout)

For remote binder access from a host machine, interop/gadb/proxy/ sets up a forwarded session:

sess, _:=proxy.NewSession(ctx, "SERIAL")
defersess.Close(ctx)
// Session manages the daemon lifecycle and port forwarding;// binder calls are routed through the remote transport.
gomobile — Android AAR

interop/gomobile/client/ wraps binder calls in a Java-friendly API via gomobile. Build the AAR:

gomobile bind -target android -o binder.aar ./interop/gomobile/client/

Available methods: GetPowerStatus(), GetDisplayInfo(), GetLastLocation(), GetDeviceInfo().

See the example app at examples/gomobile/.

Project Layout

.
├── tools/
│ ├── cmd/
│ │ ├── aidl2spec/ AIDL-to-YAML spec compiler
│ │ ├── java2spec/ Java source info extractor (service maps, parcelables)
│ │ ├── spec2go/ Go proxy code generator from specs
│ │ ├── spec2cli/ bindercli command registry generator from specs
│ │ └── spec2readme/ README package table generator from specs
│ └── pkg/
│ ├── parser/ Lexer + recursive-descent AIDL parser
│ ├── resolver/ Import resolution and type registry
│ ├── codegen/ Go code generator
│ │ ├── codegen.go GenerateAll orchestration, validation, import graph
│ │ ├── interface_gen.go Interface → proxy struct + methods
│ │ ├── parcelable_gen.go Parcelable → struct + Marshal/Unmarshal
│ │ ├── enum_gen.go Enum → typed constants
│ │ ├── marshal.go AIDL type → parcel read/write expressions
│ │ └── import_graph.go SCC-based import cycle detection
│ ├── spec/ YAML spec read/write
│ ├── javaparser/ Java source parser
│ ├── parcelspec/ Parcelable spec extraction
│ ├── servicemap/ Service name mapping
│ ├── validate/ Semantic validation (types, directions, oneway)
│ ├── testutil/ Mock binder, reflection-based smoke testing
│ └── 3rdparty/ AOSP submodules (frameworks-base, frameworks-native, ...)
├── binder/ Binder IPC abstractions
│ ├── ibinder.go IBinder interface
│ ├── proxy_binder.go Client-side proxy: Transact, IsAlive, LinkToDeath
│ └── status.go AIDL exception reading/writing
├── parcel/ Wire format serialization
│ └── parcel.go 4-byte aligned little-endian buffer
├── kernelbinder/ /dev/binder kernel driver interface
│ └── driver.go Open, mmap, ioctl BINDER_WRITE_READ
├── servicemanager/ ServiceManager client
├── errors/ AIDL exception types (ExceptionCode, StatusError)
├── android/ Pre-generated AOSP service proxies (5,174 files)
│ ├── app/ ActivityManager, AlarmManager, ...
│ ├── os/ ServiceManager, PowerManager, ...
│ ├── hardware/ HAL interfaces
│ └── ... 407 packages total
├── com/ AOSP com.android.* service proxies
├── interop/ Interoperability helpers
│ ├── gadb/ Pure-Go ADB integration
│ └── gomobile/ Android AAR via gomobile
├── examples/ 106 runnable examples
└── .github/workflows/ CI configuration

About

Go bindings (+ CLI) for ~14K methods across 1500+ Android interfaces via Binder IPC — pure Go, no Java, no cgo

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages