summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Heemin Seog <hseog@google.com> 2020-04-28 16:12:00 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-04-28 16:12:00 +0000
commitd5b5453d1863ac87f4cb4899697a23b2901f64a4 (patch)
treeda7458fbfa57858f38ea198d95593f6b139f7966
parentb9c9917810be41223ed2345e5f1c0860d2d41386 (diff)
parent8277c314ca4b6dfa1363b245776394c357e95009 (diff)
Merge "Make SystemUI config extendable" into rvc-dev
-rw-r--r--packages/CarSystemUI/res/values/config.xml45
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/CarSystemUIFactory.java26
-rw-r--r--packages/SystemUI/src/com/android/systemui/SystemUIApplication.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/SystemUIFactory.java11
4 files changed, 59 insertions, 29 deletions
diff --git a/packages/CarSystemUI/res/values/config.xml b/packages/CarSystemUI/res/values/config.xml
index 050db3218a1d..67066d7c426f 100644
--- a/packages/CarSystemUI/res/values/config.xml
+++ b/packages/CarSystemUI/res/values/config.xml
@@ -92,35 +92,28 @@
<item>com.android.vending</item>
</string-array>
- <!-- SystemUI Services: The classes of the stuff to start. -->
- <string-array name="config_systemUIServiceComponents" translatable="false">
- <item>com.android.systemui.util.NotificationChannels</item>
- <item>com.android.systemui.keyguard.KeyguardViewMediator</item>
-<!-- <item>com.android.systemui.recents.Recents</item>-->
-<!-- <item>com.android.systemui.volume.VolumeUI</item>-->
-<!-- <item>com.android.systemui.stackdivider.Divider</item>-->
-<!-- <item>com.android.systemui.statusbar.phone.StatusBar</item>-->
- <item>com.android.systemui.usb.StorageNotification</item>
- <item>com.android.systemui.power.PowerUI</item>
- <item>com.android.systemui.media.RingtonePlayer</item>
-<!-- <item>com.android.systemui.keyboard.KeyboardUI</item>-->
-<!-- <item>com.android.systemui.pip.PipUI</item>-->
-<!-- <item>com.android.systemui.shortcut.ShortcutKeyDispatcher</item>-->
- <item>@string/config_systemUIVendorServiceComponent</item>
- <item>com.android.systemui.util.leak.GarbageMonitor$Service</item>
-<!-- <item>com.android.systemui.LatencyTester</item>-->
-<!-- <item>com.android.systemui.globalactions.GlobalActionsComponent</item>-->
- <item>com.android.systemui.ScreenDecorations</item>
- <item>com.android.systemui.biometrics.AuthController</item>
-<!-- <item>com.android.systemui.SliceBroadcastRelayHandler</item>-->
- <item>com.android.systemui.SizeCompatModeActivityController</item>
-<!-- <item>com.android.systemui.statusbar.notification.InstantAppNotifier</item>-->
- <item>com.android.systemui.theme.ThemeOverlayController</item>
- <item>com.android.systemui.toast.ToastUI</item>
+ <!-- The list of components to exclude from config_systemUIServiceComponents. -->
+ <string-array name="config_systemUIServiceComponentsExclude" translatable="false">
+ <item>com.android.systemui.recents.Recents</item>
+ <item>com.android.systemui.volume.VolumeUI</item>
+ <item>com.android.systemui.stackdivider.Divider</item>
+ <item>com.android.systemui.statusbar.phone.StatusBar</item>
+ <item>com.android.systemui.keyboard.KeyboardUI</item>
+ <item>com.android.systemui.pip.PipUI</item>
+ <item>com.android.systemui.shortcut.ShortcutKeyDispatcher</item>
+ <item>com.android.systemui.LatencyTester</item>
+ <item>com.android.systemui.globalactions.GlobalActionsComponent</item>
+ <item>com.android.systemui.SliceBroadcastRelayHandler</item>
+ <item>com.android.systemui.statusbar.notification.InstantAppNotifier</item>
+ <item>com.android.systemui.accessibility.WindowMagnification</item>
+ <item>com.android.systemui.accessibility.SystemActions</item>
+ </string-array>
+
+ <!-- The list of components to append to config_systemUIServiceComponents. -->
+ <string-array name="config_systemUIServiceComponentsInclude" translatable="false">
<item>com.android.systemui.car.navigationbar.CarNavigationBar</item>
<item>com.android.systemui.car.voicerecognition.ConnectedDeviceVoiceRecognitionNotifier</item>
<item>com.android.systemui.car.window.SystemUIOverlayWindowManager</item>
<item>com.android.systemui.car.volume.VolumeUI</item>
- <item>com.android.systemui.car.sideloaded.SideLoadedAppController</item>
</string-array>
</resources>
diff --git a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIFactory.java b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIFactory.java
index 2bd5fe228f41..1a1b93b33caf 100644
--- a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIFactory.java
+++ b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIFactory.java
@@ -17,9 +17,13 @@
package com.android.systemui;
import android.content.Context;
+import android.content.res.Resources;
import com.android.systemui.dagger.SystemUIRootComponent;
+import java.util.HashSet;
+import java.util.Set;
+
/**
* Class factory to provide car specific SystemUI components.
*/
@@ -31,4 +35,26 @@ public class CarSystemUIFactory extends SystemUIFactory {
.contextHolder(new ContextHolder(context))
.build();
}
+
+ @Override
+ public String[] getSystemUIServiceComponents(Resources resources) {
+ Set<String> names = new HashSet<>();
+
+ for (String s : super.getSystemUIServiceComponents(resources)) {
+ names.add(s);
+ }
+
+ for (String s : resources.getStringArray(R.array.config_systemUIServiceComponentsExclude)) {
+ names.remove(s);
+ }
+
+ for (String s : resources.getStringArray(R.array.config_systemUIServiceComponentsInclude)) {
+ names.add(s);
+ }
+
+ String[] finalNames = new String[names.size()];
+ names.toArray(finalNames);
+
+ return finalNames;
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
index cbdae4e6fe63..c84701c9512e 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
+++ b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
@@ -139,7 +139,7 @@ public class SystemUIApplication extends Application implements
*/
public void startServicesIfNeeded() {
- String[] names = getResources().getStringArray(R.array.config_systemUIServiceComponents);
+ String[] names = SystemUIFactory.getInstance().getSystemUIServiceComponents(getResources());
startServicesIfNeeded(/* metricsPrefix= */ "StartServices", names);
}
@@ -150,8 +150,8 @@ public class SystemUIApplication extends Application implements
* <p>This method must only be called from the main thread.</p>
*/
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 fb40774a1f5c..be82a2d5325b 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.