Hi,

I am trying to understand the process of launching a service at system
init and during runtime. I read through the various posts and the
following is what I understood so far:

During system init:
- At system init, we read the init.rc file and add a bunch of services
with a particular userId. E.g., The following lines:
service media /system/bin/mediaserver
        user media
It indicates to launch a program "mediaserver" with the userid
"media".
- This "mediaserver" [defined in frameworks/base/media/
mediaserver/...] essentially adds a few services to the services list
"svclist" [defined in frameworks/base/cmds/servicemanager/
service_manager.c].
- During the process of "add_service", there is a check
(svc_can_register) to make sure that the userid with which the service
is being added is in the approved list as defined in the array of
allowed services (allowed[] ).

With the above information, I was able to launch my own test server
and then write a console app. to access it.

Using AIDL:
- I was able to implement a service and the inherent IPC mechanism
using the steps detailed in http://code.google.com/android/reference/aidl.html.
- I even looked at the corresponding .java file that gets generated as
part of the build process.

addService from Java:
Next, I tried to read how services are added from Java.
- I looked at frameworks/base/services/java/com/android/server/
SystemServer.java.
- This translates to a call in frameworks/base/core/java/andrid/os/
ServiceManager.java and then to frameworks/base/core/java/andrid/os/
ServiceManagerNative.java.
- Here, there is a remote call to call native "addService" in
frameworks/base/cmds/runtime/ServiceManager.cpp.
- The requested service is added to a KeyedVector "mServices".

Service as an application component:
http://code.google.com/android/reference/android/app/Service.html

If any of the above is incorrect, please twist my arm now.

Now, I am trying to see how I can launch a native service during
runtime that has the following characteristics: (I am lost looking at
the code and need some fresh ideas)
- It needs access to a private directory that no other service can
access -- For this, I was thinking of launching the service from a
Java .apk file (through a JNI) because each application would have
it's own private directory.
- It needs to be accessible to other services, say mediaservice.
- It needs a way to validate the calls, i.e., it should honor calls
only from a trusted service.


I hope this thread can capture enough information for future
reference.

Thanks,
Ravi
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"android-framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/android-framework?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to