Reputation: 23
It's known to us that android system service register to system manager when device is booting.For Example:
AlarmManagerService alarm = new AlarmManagerService(context);
ServiceManager.addService(Context.ALARM_SERVICE, alarm);
The code above is in
/frameworks/base/services/java/com/android/server/SystemServer.java
So,if you want to use AlarmManager you, you only need to get the proxy of AlarmManagerService to call a function, and then AlarmManagerProxy call the corresponding method in BinderProxy to execute.
Importantly, the BinderProxy.java or BpBinder.cpp has the right handle to Binder---AlarmManagerService.
But when comes to AIDL, for example:
interface IDCSCore {
int add(int i,int j);
void show();
}
When we bind a remote service in another process, the onBind method will return a Binder--the implemention of IDCSCore.Stub, then in the ServiceConnect onServiceBinded call back you get the IDCSCore.Stub.Proxy.
Android System Service,such as AlarmManagerSerice is register in servicemanger, and you can use adb shell service list
to find all system service in system manager, but I can't find the IDCSCore related infomation. Where is the IDCSCore.Stub? How the proxy without handle correctly execute a function call??
I am frustrated! It is a bit sophiscated to me...
Upvotes: 1
Views: 743
Reputation: 2499
AOSP system service and Android service both have different implementation and works differently. You can't bind to the AOSP system services. In order to get the proxy stub, AOSP has already provided the getSystemService()
API. ServiceManager holds all the proxy stub of system services.
To list all activity services, below command can be used.
adb shell dumpsys activity services
What is IDCSCore?
To get more details on AOSP system service and Android service refer this link, AOSP System Service vs Service Differences
Upvotes: -1