Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit edfcb00f authored by Daichi Hirono's avatar Daichi Hirono
Browse files

Add config resource to specify device specific services

The new string resource contains class names of device specific services
and referred by SystemServer.java.

Bug: 63893131
Test: Manually added device specific service and see if it's launched
Change-Id: I0cf88de5dfcf86dad459c0909073dce7fbfa57b9
parent 0f2512db
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -3124,4 +3124,8 @@
    <!-- Decide whether to display 'No service' on status bar instead of 'Emergency calls only'
         when SIM is unready. -->
    <bool name="config_display_no_service_when_sim_unready">false</bool>

    <!-- Class names of device specific services inheriting com.android.server.SystemService. The
         classes are instantiated in the order of the array. -->
    <string-array translatable="false" name="config_deviceSpecificSystemServices"></string-array>
</resources>
+1 −0
Original line number Diff line number Diff line
@@ -454,6 +454,7 @@
  <java-symbol type="integer" name="config_keepPreloadsMinDays" />
  <java-symbol type="bool" name="config_hasPermanentDpad" />
  <java-symbol type="bool" name="config_useDefaultFocusHighlight" />
  <java-symbol type="array" name="config_deviceSpecificSystemServices" />

  <java-symbol type="color" name="tab_indicator_text_v4" />

+5 −0
Original line number Diff line number Diff line
@@ -63,6 +63,11 @@ public abstract class SystemService {
     */
    public static final int PHASE_SYSTEM_SERVICES_READY = 500;

    /**
     * After receiving this boot phase, services can safely call into device specific services.
     */
    public static final int PHASE_DEVICE_SPECIFIC_SERVICES_READY = 520;

    /**
     * After receiving this boot phase, services can broadcast Intents.
     */
+19 −0
Original line number Diff line number Diff line
@@ -1656,6 +1656,25 @@ public final class SystemServer {

        mSystemServiceManager.setSafeMode(safeMode);

        // Start device specific services
        traceBeginAndSlog("StartDeviceSpecificServices");
        final String[] classes = mSystemContext.getResources().getStringArray(
                R.array.config_deviceSpecificSystemServices);
        for (final String className : classes) {
            traceBeginAndSlog("StartDeviceSpecificServices " + className);
            try {
                mSystemServiceManager.startService(className);
            } catch (Throwable e) {
                reportWtf("starting " + className, e);
            }
            traceEnd();
        }
        traceEnd();

        traceBeginAndSlog("StartBootPhaseDeviceSpecificServicesReady");
        mSystemServiceManager.startBootPhase(SystemService.PHASE_DEVICE_SPECIFIC_SERVICES_READY);
        traceEnd();

        // These are needed to propagate to the runnable below.
        final NetworkManagementService networkManagementF = networkManagement;
        final NetworkStatsService networkStatsF = networkStats;