To create a custom system service in android following steps are required
- Create service in framework
- Register service in SystemServer
- Create a .aidl interface of the service in framework
- Register .aidl interface in build system
- Create a manager for the service in framework
- Leverage the features of the service from service manager
- Register the service manager in ContextImpl
- Register name of service manager in Context (abstract class)
After performing the above steps we need to build the new SDK for using the features of service through service manager.
1. Create service in framework
We need to create a service (Not an android service) in directory /frameworks/base/services/java/com/android/server/ where other system service are placed.