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

Commit f1a7f5b2 authored by Alex Stetson's avatar Alex Stetson Committed by Android (Google) Code Review
Browse files

Merge "Allow overriding of service start behavior" into main

parents d9e836cf b7674111
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,