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

Commit 65c67aa0 authored by Dave Mankoff's avatar Dave Mankoff
Browse files

Remove config_additionalSystemUIServiceComponents

Also removes @AdditionaStartable and its associated logic.

Bug: 205725937
Test: manual
Change-Id: I1ba01928b19313e71060d4e4de22b62c8f20207f
parent f727dbbd
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -292,12 +292,6 @@
    <!-- SystemUIFactory component -->
    <string name="config_systemUIFactoryComponent" translatable="false">com.android.systemui.SystemUIFactory</string>

    <!-- 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>
+13 −19
Original line number Diff line number Diff line
@@ -184,8 +184,8 @@ public class SystemUIApplication extends Application implements
     */

    public void startServicesIfNeeded() {
        final String[] additionalNames = SystemUIFactory.getInstance()
                .getAdditionalSystemUIServiceComponents(getResources());
        final String vendorComponent = SystemUIFactory.getInstance()
                .getVendorComponent(getResources());

        // Sort the startables so that we get a deterministic ordering.
        // TODO: make #start idempotent and require users of CoreStartable to call it.
@@ -193,7 +193,7 @@ public class SystemUIApplication extends Application implements
                Comparator.comparing(Class::getName));
        sortedStartables.putAll(SystemUIFactory.getInstance().getStartableComponents());
        startServicesIfNeeded(
                sortedStartables, "StartServices", additionalNames);
                sortedStartables, "StartServices", vendorComponent);
    }

    /**
@@ -208,17 +208,17 @@ public class SystemUIApplication extends Application implements
                Comparator.comparing(Class::getName));
        sortedStartables.putAll(SystemUIFactory.getInstance().getStartableComponentsPerUser());
        startServicesIfNeeded(
                sortedStartables, "StartSecondaryServices", new String[]{});
                sortedStartables, "StartSecondaryServices", null);
    }

    private void startServicesIfNeeded(
            Map<Class<?>, Provider<CoreStartable>> startables,
            String metricsPrefix,
            String[] services) {
            String vendorComponent) {
        if (mServicesStarted) {
            return;
        }
        mServices = new CoreStartable[startables.size() + services.length];
        mServices = new CoreStartable[startables.size() + (vendorComponent == null ? 0 : 1)];

        if (!mBootCompleteCache.isBootComplete()) {
            // check to see if maybe it was already completed long before we began
@@ -251,14 +251,11 @@ public class SystemUIApplication extends Application implements
            i++;
        }

        // Loop over any "additional" startables that are defined in an xml overlay.
        final int N = services.length;
        for (i = 0; i < N; i++) {
            int j = i;  // Copied to make lambda happy.
            String clsName = services[i];
        if (vendorComponent != null) {
            timeInitialization(
                    clsName,
                    () -> mServices[j + startables.size()] = startAdditionalStartable(clsName),
                    vendorComponent,
                    () -> mServices[mServices.length - 1] =
                            startAdditionalStartable(vendorComponent),
                    log,
                    metricsPrefix);
        }
@@ -294,12 +291,9 @@ public class SystemUIApplication extends Application implements
        CoreStartable startable;
        if (DEBUG) Log.d(TAG, "loading: " + clsName);
        try {
            startable = mComponentHelper.resolveAdditionalCoreStartable(clsName);
            if (startable == null) {
            Constructor<?> constructor = Class.forName(clsName).getConstructor(
                    Context.class);
            startable = (CoreStartable) constructor.newInstance(this);
            }
        } catch (ClassNotFoundException
                | NoSuchMethodException
                | IllegalAccessException
+2 −11
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import com.android.systemui.navigationbar.gestural.BackGestureTfClassifierProvid
import com.android.systemui.screenshot.ScreenshotNotificationSmartActionsProvider;
import com.android.wm.shell.transition.ShellTransitions;

import java.util.Arrays;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
@@ -203,16 +202,8 @@ public class SystemUIFactory {
    /**
     * Returns the list of additional system UI components that should be started.
     */
    public String[] getAdditionalSystemUIServiceComponents(Resources resources) {
        String[] results = resources.getStringArray(
                R.array.config_additionalSystemUIServiceComponents);
        String vendorComponent = resources.getString(
                R.string.config_systemUIVendorServiceComponent);

        results = Arrays.copyOf(results, results.length + 1);
        results[results.length - 1] = vendorComponent;

        return results;
    public String getVendorComponent(Resources resources) {
        return resources.getString(R.string.config_systemUIVendorServiceComponent);
    }

    /**
+0 −4
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.app.Activity;
import android.app.Service;
import android.content.BroadcastReceiver;

import com.android.systemui.CoreStartable;
import com.android.systemui.recents.RecentsImplementation;

/**
@@ -36,9 +35,6 @@ public interface ContextComponentHelper {
    /** Turns a classname into an instance of the class or returns null. */
    Service resolveService(String className);

    /** Turns a classname into an instance of the class or returns null. */
    CoreStartable resolveAdditionalCoreStartable(String className);

    /** Turns a classname into an instance of the class or returns null. */
    BroadcastReceiver resolveBroadcastReceiver(String className);
}
+0 −14
Original line number Diff line number Diff line
@@ -20,8 +20,6 @@ import android.app.Activity;
import android.app.Service;
import android.content.BroadcastReceiver;

import com.android.systemui.CoreStartable;
import com.android.systemui.dagger.qualifiers.AdditionalStartable;
import com.android.systemui.recents.RecentsImplementation;

import java.util.Map;
@@ -36,20 +34,16 @@ import javax.inject.Provider;
public class ContextComponentResolver implements ContextComponentHelper {
    private final Map<Class<?>, Provider<Activity>> mActivityCreators;
    private final Map<Class<?>, Provider<Service>> mServiceCreators;
    private final Map<Class<?>, Provider<CoreStartable>> mAdditionalStartableCreators;
    private final Map<Class<?>, Provider<RecentsImplementation>> mRecentsCreators;
    private final Map<Class<?>, Provider<BroadcastReceiver>> mBroadcastReceiverCreators;

    @Inject
    ContextComponentResolver(Map<Class<?>, Provider<Activity>> activityCreators,
            Map<Class<?>, Provider<Service>> serviceCreators,
            Map<Class<?>, Provider<CoreStartable>> startableCreators,
            @AdditionalStartable Map<Class<?>, Provider<CoreStartable>> additionalStartableCreators,
            Map<Class<?>, Provider<RecentsImplementation>> recentsCreators,
            Map<Class<?>, Provider<BroadcastReceiver>> broadcastReceiverCreators) {
        mActivityCreators = activityCreators;
        mServiceCreators = serviceCreators;
        mAdditionalStartableCreators = additionalStartableCreators;
        mRecentsCreators = recentsCreators;
        mBroadcastReceiverCreators = broadcastReceiverCreators;
    }
@@ -86,14 +80,6 @@ public class ContextComponentResolver implements ContextComponentHelper {
        return resolve(className, mServiceCreators);
    }

    /**
     * Looks up the SystemUI class name to see if Dagger has an instance of it.
     */
    @Override
    public CoreStartable resolveAdditionalCoreStartable(String className) {
        return resolve(className, mAdditionalStartableCreators);
    }

    private <T> T resolve(String className, Map<Class<?>, Provider<T>> creators) {
        try {
            Class<?> clazz = Class.forName(className);
Loading