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

Commit 8c0122d8 authored by Automerger Merge Worker's avatar Automerger Merge Worker Committed by Android (Google) Code Review
Browse files

Merge "Merge "Make SystemUI config extendable" into rvc-dev am: d5b5453d am:...

Merge "Merge "Make SystemUI config extendable" into rvc-dev am: d5b5453d am: 11c54a7a" into rvc-d1-dev-plus-aosp
parents d4d83696 dc906f8b
Loading
Loading
Loading
Loading
+19 −26
Original line number Diff line number Diff line
@@ -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>
+26 −0
Original line number Diff line number Diff line
@@ -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;
    }
}
+3 −3
Original line number Diff line number Diff line
@@ -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);
    }

+11 −0
Original line number Diff line number Diff line
@@ -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.