Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildServiceMap ¶
func BuildServiceMap( frameworksBasePath string, ) (map[string]ServiceMapEntry, error)
BuildServiceMap reads Context.java and SystemServiceRegistry.java from the given frameworks-base path and returns a map from service name to ServiceMapEntry. The returned map is keyed by service name (e.g. "power", "account").
func ExtractContextConstants ¶
ExtractContextConstants parses a Java source string and returns a map of constant name to service name value for all fields matching the pattern: public static final String XXX_SERVICE = "value".
func ExtractStringConstants ¶
ExtractStringConstants parses a Java source string and returns a map of constant name to string value for all public static final String fields.
Types ¶
type BinderUsage ¶
type BinderUsage struct {
// AIDLInterface is the fully qualified interface name when resolvable
// via imports, otherwise the simple name (e.g., "ITelephony").
AIDLInterface string
// ServiceConstant is the Context constant name when the call uses
// Context.XXX_SERVICE (e.g., "TELEPHONY_SERVICE"). Empty if the
// call uses a string literal instead.
ServiceConstant string
// ServiceLiteral is the service name string literal when the call
// uses ServiceManager.getService("name") directly. Empty if the
// call uses a Context constant.
ServiceLiteral string
}
BinderUsage records a single occurrence of an AIDL interface being obtained via ServiceManager.getService for a specific service.
func ScanBinderUsages ¶
func ScanBinderUsages( root string, ) ([]BinderUsage, error)
ScanBinderUsages walks all Java files under root and extracts service-to-AIDL-interface associations using two strategies:
- Direct: IFoo.Stub.asInterface(ServiceManager.getService(...)) in the same expression.
- Annotated: @SystemService(Context.XXX) on a class that calls IFoo.Stub.asInterface(), where the interface name relates to the class name (e.g., ActivityManager -> IActivityManager).
Multiple usages of the same interface are deduplicated.
type Registration ¶
type Registration struct {
ContextConstant string // e.g. "ACCOUNT_SERVICE"
AIDLInterface string // e.g. "IAccountManager"
}
Registration represents a service registration extracted from SystemServiceRegistry.java.
func ExtractRegistrations ¶
func ExtractRegistrations(src string) []Registration
ExtractRegistrations parses a Java source string (typically SystemServiceRegistry.java) and returns the service registrations that use AIDL binder interfaces. Only registerService calls containing a Stub.asInterface invocation are included.
type ServiceMapEntry ¶
type ServiceMapEntry struct {
ServiceName string `json:"service_name"` // e.g. "activity"
ConstantName string `json:"constant_name"` // e.g. "ACTIVITY_SERVICE"
AIDLInterface string `json:"aidl_interface"` // e.g. "IActivityManager" (simple name)
AIDLDescriptor string `json:"aidl_descriptor"` // e.g. "android.app.IActivityManager" (fully qualified)
}
ServiceMapEntry represents a fully resolved service mapping from service name to its AIDL interface descriptor.