Merge "Add additional SystemUI services config."

This commit is contained in:
Bryce Lee
2021-07-23 22:34:41 +00:00
committed by Android (Google) Code Review
3 changed files with 28 additions and 3 deletions

View File

@@ -313,7 +313,8 @@
<!-- SystemUIFactory component -->
<string name="config_systemUIFactoryComponent" translatable="false">com.android.systemui.SystemUIFactory</string>
<!-- SystemUI Services: The classes of the stuff to start. -->
<!-- SystemUI Services: The classes of base stuff to start by default for all
configurations. -->
<string-array name="config_systemUIServiceComponents" translatable="false">
<item>com.android.systemui.util.NotificationChannels</item>
<item>com.android.systemui.keyguard.KeyguardViewMediator</item>
@@ -340,6 +341,12 @@
<item>com.android.systemui.wmshell.WMShell</item>
</string-array>
<!-- SystemUI Services: The classes of the additional stuff to start. Services here are
specified as an overlay to provide configuration-specific services that
supplement those listed in config_systemUIServiceComponents. -->
<string-array name="config_additionalSystemUIServiceComponents" translatable="false">
</string-array>
<!-- QS tile shape store width. negative implies fill configuration instead of stroke-->
<dimen name="config_qsTileStrokeWidthActive">-1dp</dimen>
<dimen name="config_qsTileStrokeWidthInactive">-1dp</dimen>

View File

@@ -42,6 +42,8 @@ import com.android.systemui.util.NotificationChannels;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collections;
/**
* Application class for SystemUI.
@@ -159,8 +161,17 @@ public class SystemUIApplication extends Application implements
*/
public void startServicesIfNeeded() {
String[] names = SystemUIFactory.getInstance().getSystemUIServiceComponents(getResources());
startServicesIfNeeded(/* metricsPrefix= */ "StartServices", names);
final String[] names = SystemUIFactory.getInstance()
.getSystemUIServiceComponents(getResources());
final String[] additionalNames = SystemUIFactory.getInstance()
.getAdditionalSystemUIServiceComponents(getResources());
final ArrayList<String> serviceComponents = new ArrayList<>();
Collections.addAll(serviceComponents, names);
Collections.addAll(serviceComponents, additionalNames);
startServicesIfNeeded(/* metricsPrefix= */ "StartServices",
serviceComponents.toArray(new String[serviceComponents.size()]));
}
/**

View File

@@ -186,6 +186,13 @@ public class SystemUIFactory {
return resources.getStringArray(R.array.config_systemUIServiceComponents);
}
/**
* Returns the list of additional system UI components that should be started.
*/
public String[] getAdditionalSystemUIServiceComponents(Resources resources) {
return resources.getStringArray(R.array.config_additionalSystemUIServiceComponents);
}
/**
* Returns the list of system UI components that should be started per user.
*/