This method must only be called from the main thread.
*/ void startSecondaryUserServicesIfNeeded() { - String[] names = - getResources().getStringArray(R.array.config_systemUIServiceComponentsPerUser); + String[] names = SystemUIFactory.getInstance().getSystemUIServiceComponentsPerUser( + getResources()); startServicesIfNeeded(/* metricsPrefix= */ "StartSecondaryServices", names); } diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java index fb40774a1f5c2..be82a2d5325bb 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java @@ -18,6 +18,7 @@ package com.android.systemui; import android.annotation.NonNull; import android.content.Context; +import android.content.res.Resources; import android.os.Handler; import android.os.Looper; import android.util.Log; @@ -120,6 +121,16 @@ public class SystemUIFactory { return mRootComponent; } + /** Returns the list of system UI components that should be started. */ + public String[] getSystemUIServiceComponents(Resources resources) { + return resources.getStringArray(R.array.config_systemUIServiceComponents); + } + + /** Returns the list of system UI components that should be started per user. */ + public String[] getSystemUIServiceComponentsPerUser(Resources resources) { + return resources.getStringArray(R.array.config_systemUIServiceComponentsPerUser); + } + /** * Creates an instance of ScreenshotNotificationSmartActionsProvider. * This method is overridden in vendor specific implementation of Sys UI.