android-binder-native

Implement and review native C++ Binder services for AOSP using libbinder.

1|Updated Feb 28, 2026
One-click install
npx skills add https://github.com/Binh230199/ai --skill android-binder-native
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-binder-native
Source: https://github.com/Binh230199/ai/tree/main/.github/skills/android-binder-native
Command: npx skills add https://github.com/Binh230199/ai --skill android-binder-native

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Manually writing native Binder services is error-prone, and this Skill helps you design, review, and debug libbinder-based IPC code for AOSP without missing transaction, parcel, or threading details.

Core Features & Use Cases

  • Interface Pattern Guidance: Defines the IInterface, BnInterface, and BpInterface structure for manual Binder APIs.
  • Parcel and Transaction Handling: Shows how to serialize data correctly, validate interface tokens, and dispatch onTransact calls safely.
  • Service Lifecycle Support: Covers ServiceManager registration, client lookup, thread pool setup, and death notifications for robust runtime behavior.
  • Use Cases: Ideal for maintaining existing platform services, implementing vendor native services, and reviewing Binder code for correctness and concurrency risks.

Quick Start

Ask for a native Binder service implementation or review plan for your AOSP service, including the interface, proxy, stub, service registration, and client-side usage.

Frequently Asked Questions about android-binder-native

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement a native C++ Binder service in AOSP using libbinder?

To implement a native C++ Binder service in AOSP using libbinder, you must define IInterface, BnInterface, and BpInterface structures, handle Parcel marshaling, dispatch onTransact calls safely, and register with ServiceManager.

What is the correct way to handle Parcel transactions and interface tokens in libbinder?

Handling Parcel transactions in libbinder requires serializing data correctly, validating interface tokens, and dispatching onTransact calls safely. You must ensure ordered parcel read and write operations to maintain data integrity.

How do I set up a thread pool and death notifications for an AOSP native service?

Setting up a thread pool and death notifications for an AOSP native service involves configuring libbinder runtime behavior. This ensures robust concurrent state handling and allows clients to detect when a bound service process terminates unexpectedly.

Can I use this approach to review existing platform services for concurrency risks?

Yes, you can review existing platform services and vendor native services for concurrency risks. The approach validates manual Bn/Bp interfaces, checks meta-interface macros, and ensures safe concurrent state handling within your Binder IPC code.

Why does my native Binder service fail to delegate unknown transactions?

Native Binder service transaction delegation fails when delegated unknown transactions are not properly routed. You must ensure your onTransact implementation correctly delegates unknown transactions and validates interface tokens to prevent dispatch errors.

Do I need ServiceManager registration to expose a vendor native service via IPC?

Yes, ServiceManager registration is required to expose a vendor native service via IPC. After defining your Bn/Bp interfaces and setting up the thread pool, you must register the service so clients can discover and connect to it.