Skip to content

Commit b8b391c

Browse files
xaionaro@dx.centerxaionaro@dx.center
authored andcommitted
docs: add Transaction Code Resolution section to README
:Explains the three-layer detection strategy: DEX bytecode extraction, compiled version tables with ELF filtering, and live transaction probing.
1 parent 5b5a715 commit b8b391c

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,6 +1738,18 @@ go run ./tools/cmd/aospgen -3rdparty tools/pkg/3rdparty -output . -smoke-tests
17381738

17391739
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,490 Go files** across **666 packages**.
17401740

1741+
### Transaction Code Resolution
1742+
1743+
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 three-layer detection strategy:
1744+
1745+
1. **DEX bytecode extraction** (primary) — scans `/system/framework/*.jar`, parses DEX bytecode, and reads `TRANSACTION_*` constants from `$Stub` classes. 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](https://github.com/xaionaro-go/binder/issues).
1746+
1747+
2. **Compiled version tables + ELF filtering** (fallback) — pre-compiled tables from multiple AOSP revision tags, narrowed by API level (from ELF `.note.android.ident`) and exported symbols in `libbinder.so`.
1748+
1749+
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.
1750+
1751+
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.
1752+
17411753
## Testing and Verification
17421754

17431755
The project is verified at four levels:

0 commit comments

Comments
 (0)