Hi,
I tried to add a custom system service by declaring .aidl files, writing a client implementation in ContextImpl, etc. pp. I followed the example of PackageManagerService and added everything to the platform. In SystemServer.java, line 175, run() added:
ServiceManager.addService(Context.PERMISSION_SERVICE, new PermissionManagerService(context));
However, it keeps crashing when I start the emulator:
09-23 15:51:09.501: INFO/SystemServer(77): Permission Manager
09-23 15:51:09.560: ERROR/ServiceManager(27): add_service('permission',0x11) uid=1000 - ALREADY REGISTERED
09-23 15:51:09.660: ERROR/System(77): Failure starting core service
09-23 15:51:09.660: ERROR/System(77): java.lang.SecurityException
09-23 15:51:09.660: ERROR/System(77): at android.os.BinderProxy.transact(Native Method)
09-23 15:51:09.660: ERROR/System(77): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
09-23 15:51:09.660: ERROR/System(77): at android.os.ServiceManager.addService(ServiceManager.java:72)
09-23 15:51:09.660: ERROR/System(77): at com.android.server.ServerThread.run(SystemServer.java:175)
I cannot find the implementation of the SystemServer. And I can't see that there is any other service registered with the name "permission"?! Any suggestions?
I need the service to run in such a way that I can redirect some permission checks from PackageManagerService to my customised service. But also applications should be able to query my custom service directly (so I cannot rely on the existing PackageManager). Basically, I could add everything to the interface of PackageManagerService but that's going to result in a large large java class (and I want to keep my source code separated from the existing one if possible).
Bye, David