Help us shape the future of Go! Take the 2026 Go Developer Survey

servicemap

package
v0.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: CC0-1.0 Imports: 7 Imported by: 0

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

func ExtractContextConstants(src string) map[string]string

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

func ExtractStringConstants(src string) map[string]string

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:

  1. Direct: IFoo.Stub.asInterface(ServiceManager.getService(...)) in the same expression.
  2. 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL