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

Commit b7674111 authored by Alex Stetson's avatar Alex Stetson
Browse files

Allow overriding of service start behavior

Bug: 331480811
Test: manual
Flag: NA
Change-Id: I9b1b13e06663af54a928ca66567c682991611493
parent 9a24f344
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -204,7 +204,7 @@ public class SystemUIApplication extends Application implements
     */

    public void startSystemUserServicesIfNeeded() {
        if (!mProcessWrapper.isSystemUser()) {
        if (!shouldStartSystemUserServices()) {
            Log.wtf(TAG, "Tried starting SystemUser services on non-SystemUser");
            return;  // Per-user startables are handled in #startSystemUserServicesIfNeeded.
        }
@@ -227,7 +227,7 @@ public class SystemUIApplication extends Application implements
     * <p>This method must only be called from the main thread.</p>
     */
    void startSecondaryUserServicesIfNeeded() {
        if (mProcessWrapper.isSystemUser()) {
        if (!shouldStartSecondaryUserServices()) {
            return;  // Per-user startables are handled in #startSystemUserServicesIfNeeded.
        }
        // Sort the startables so that we get a deterministic ordering.
@@ -238,6 +238,14 @@ public class SystemUIApplication extends Application implements
                sortedStartables, "StartSecondaryServices", null);
    }

    protected boolean shouldStartSystemUserServices() {
        return mProcessWrapper.isSystemUser();
    }

    protected boolean shouldStartSecondaryUserServices() {
        return !mProcessWrapper.isSystemUser();
    }

    private void startServicesIfNeeded(
            Map<Class<?>, Provider<CoreStartable>> startables,
            String metricsPrefix,