Friday 1 August 2014

Dealing with System Service Dependencies

As an example of a case where a system service depends on another, below is the constructor for a 'test' service which when constructed, initializes a location manager.


The 'test' service requires that the 'LocationManagerService' is running before 'test' is created so that it can successfully initialize  a location manager.

When Android is started, 'init' is a component of the bootloader sequence which initializes a number of daemons which run continuously whilst the operating system is running.

One of those daemons 'Zygote' is the process responsible for starting system services. It does this by executing the initAndLoop() function of the SystemServer Class.

SystemServer located in frameworks/base/services/java/com/android/server/SystemServer.java

In order to ensure 'LocationManagerService' is running before 'test' service, place the 'test' service's addService code anywhere below that of the 'LocationManagerService'.



1 comments:

salbachert said...

Iron Knuckle - Titanium Shift knob | Titanium Arts
Iron Knuckle titanium muffler - welding titanium Titanium Shift titanium prices knob titanium trim walmart | Titanium sunscreen with zinc oxide and titanium dioxide Arts

Post a Comment