Skip to content

Commit 76485a9

Browse files
xaionaro@dx.centerxaionaro@dx.center
authored andcommitted
Update README.md
1 parent 363b83f commit 76485a9

1 file changed

Lines changed: 27 additions & 11 deletions

File tree

README.md

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,31 @@ Call Android system services from pure Go. Provides ~12000 type-safe Go methods
1010

1111
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.
1212

13-
## Android Interfaces for Go
13+
## What can it do?
14+
15+
- **Query system services** — battery level, GPS location, thermal status, running processes, installed packages
16+
- **Control hardware** — connect to WiFi, toggle flashlight, manage Bluetooth, configure audio
17+
- **Interact with any binder service** — ActivityManager, PowerManager, SurfaceFlinger, camera/sensor HALs, and 600+ more
18+
- **No Java, no cgo** — pure Go, cross-compiles to a static binary, runs on Android or any Linux with `/dev/binder`
19+
- **CLI tool included**`bindercli` for interactive service discovery, method invocation, and debugging
20+
21+
## Quick start
22+
23+
**Go library**`go get github.com/xaionaro-go/binder` and call any service:
24+
25+
```go
26+
driver, _ := kernelbinder.Open(ctx, binder.WithMapSize(128*1024))
27+
defer driver.Close(ctx)
28+
sm := servicemanager.New(driver)
29+
svc, _ := sm.GetService(ctx, "activity")
30+
am := app.NewActivityManagerProxy(svc)
31+
limit, _ := am.GetProcessLimit(ctx)
32+
```
33+
34+
## Related Projects
35+
36+
<details>
37+
<summary>ndk, jni, binder (click to expand)</summary>
1438

1539
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:
1640

@@ -69,6 +93,8 @@ All three libraries talk to the same Android system services, but through differ
6993
- 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.
7094
- 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.
7195

96+
</details>
97+
7298
## Usage Examples
7399

74100
### List Binder Services
@@ -1750,16 +1776,6 @@ Each binder method has a numeric transaction code that can differ between Androi
17501776

17511777
Methods 2 and 3 exist only for extra reliability in edge cases (e.g. no read access to `/system/framework/`). The `genversions` tool builds the version tables by checking out AOSP revision tags and recording method→code mappings.
17521778

1753-
The resolved table can be cached to disk for fast subsequent startups by passing `OptionCachePath`:
1754-
1755-
```go
1756-
transport, err := versionaware.NewTransport(ctx, driver, 0,
1757-
versionaware.OptionCachePath("/data/local/tmp/binder-codes.json"),
1758-
)
1759-
```
1760-
1761-
Caching is disabled by default. The cache is fingerprinted and automatically invalidated when the device firmware changes.
1762-
17631779
## Testing and Verification
17641780

17651781
The project is verified at four levels:

0 commit comments

Comments
 (0)