Configure identity for native services

SDV derives the identity of service bundles and Java apps from their automatically generated Android ID (AID). Because native services, such as vendor hardware abstraction layers (HALs), lack this automatic mechanism, you must manually configure them to associate an SDV identity with each service's program.

To associate an SDV identity with a native service program, follow these steps:

  1. Define a unique AID for the service in the reserved range for the partition where the service is located, such as the vendor or product range.

    For more information about partition-specific ranges, see Configure AIDs.

    Define a unique AID for each native service, rather than sharing a single AID across multiple services. Because service identities are assigned to a service process based on its AID, sharing an AID results in sharing service identities and their authorizations.

  2. Configure your service under the unique AID you created using the user option in your service's .rc file.

    For example:

    service native_sdv_gateway_client_service /vendor/bin/native_sdv_gateway_client_service
        [..]
        user vendor_gateway_client
        [..]
    
  3. Map the numeric value of the unique AID to the service identity designated for the service in the sdv_native_services_names configuration file of the partition where the service is located.

    The service identity consists of the package name, service bundle name, and service instance name. It's encoded as a string of the form packageName.serviceBundleName/serviceInstanceName.

    For example, if your service runs on the vendor partition with the AID vendor_gateway_client and has the numeric value 2902, you must add the mapping to the /vendor/etc/sdv_native_services_names file:

    2902,android.sdv.samples.gateway.client.NativeTestApp/default