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

Commit 1c888f6d authored by Narayan Kamath's avatar Narayan Kamath
Browse files

SystemServer: Get rid of some unused config.* knobs.

They are untested and were committed as part of a legacy refactoring
that appears incomplete.

The Wear team have added a few new config.* flags to disable services
they don't need on watches. These should probably be unified since we
don't really need this fine level of granularity.

Test: make & flash
Bug: 64052650
Change-Id: I5c8ed3f0e78c2ed0d2e733939a82e1ab8940de22
parent 0de586a4
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -836,7 +836,6 @@ public class Environment {
     *         physically removed.
     */
    public static boolean isExternalStorageRemovable() {
        if (isStorageDisabled()) return false;
        final File externalDir = sCurrentUser.getExternalDirs()[0];
        return isExternalStorageRemovable(externalDir);
    }
@@ -875,7 +874,6 @@ public class Environment {
     *      boolean)
     */
    public static boolean isExternalStorageEmulated() {
        if (isStorageDisabled()) return false;
        final File externalDir = sCurrentUser.getExternalDirs()[0];
        return isExternalStorageEmulated(externalDir);
    }
@@ -951,9 +949,6 @@ public class Environment {
        return cur;
    }

    private static boolean isStorageDisabled() {
        return SystemProperties.getBoolean("config.disable_storage", false);
    }

    /**
     * If the given path exists on emulated external storage, return the
+0 −4
Original line number Diff line number Diff line
@@ -163,10 +163,6 @@ public final class ContentService extends IContentService.Stub {
    };

    private SyncManager getSyncManager() {
        if (SystemProperties.getBoolean("config.disable_network", false)) {
            return null;
        }

        synchronized(mSyncManagerLock) {
            try {
                // Try to create the SyncManager, return null if it fails (e.g. the disk is full).
+290 −331
Original line number Diff line number Diff line
@@ -545,11 +545,9 @@ public final class SystemServer {
        traceEnd();

        // Bring up recovery system in case a rescue party needs a reboot
        if (!SystemProperties.getBoolean("config.disable_noncore", false)) {
        traceBeginAndSlog("StartRecoverySystemService");
        mSystemServiceManager.startService(RecoverySystemService.class);
        traceEnd();
        }

        // Now that we have the bare essentials of the OS up and running, take
        // note that we just booted, which might send out a rescue party if
@@ -705,13 +703,7 @@ public final class SystemServer {
        MmsServiceBroker mmsService = null;
        HardwarePropertiesManagerService hardwarePropertiesService = null;

        boolean disableStorage = SystemProperties.getBoolean("config.disable_storage", false);
        boolean disableBluetooth = SystemProperties.getBoolean("config.disable_bluetooth", false);
        boolean disableLocation = SystemProperties.getBoolean("config.disable_location", false);
        boolean disableSystemUI = SystemProperties.getBoolean("config.disable_systemui", false);
        boolean disableNonCoreServices = SystemProperties.getBoolean("config.disable_noncore", false);
        boolean disableNetwork = SystemProperties.getBoolean("config.disable_network", false);
        boolean disableNetworkTime = SystemProperties.getBoolean("config.disable_networktime", false);
        boolean disableRtt = SystemProperties.getBoolean("config.disable_rtt", false);
        boolean disableMediaProjection = SystemProperties.getBoolean("config.disable_mediaproj",
                false);
@@ -875,8 +867,6 @@ public final class SystemServer {
            } else if (!context.getPackageManager().hasSystemFeature
                       (PackageManager.FEATURE_BLUETOOTH)) {
                Slog.i(TAG, "No Bluetooth Service (Bluetooth Hardware Not Present)");
            } else if (disableBluetooth) {
                Slog.i(TAG, "Bluetooth Service disabled by config");
            } else {
                traceBeginAndSlog("StartBluetoothService");
                mSystemServiceManager.startService(BluetoothService.class);
@@ -927,8 +917,7 @@ public final class SystemServer {
        traceEnd();

        if (mFactoryTestMode != FactoryTest.FACTORY_TEST_LOW_LEVEL) {
            if (!disableStorage &&
                    !"0".equals(SystemProperties.get("system_init.startmountservice"))) {
            if (!"0".equals(SystemProperties.get("system_init.startmountservice"))) {
                traceBeginAndSlog("StartStorageManagerService");
                try {
                    /*
@@ -978,7 +967,6 @@ public final class SystemServer {
        traceEnd();

        if (mFactoryTestMode != FactoryTest.FACTORY_TEST_LOW_LEVEL) {
            if (!disableNonCoreServices) {
            traceBeginAndSlog("StartLockSettingsService");
            try {
                mSystemServiceManager.startService(LOCK_SETTINGS_SERVICE_CLASS);
@@ -1012,7 +1000,6 @@ public final class SystemServer {
            traceBeginAndSlog("StartDevicePolicyManager");
            mSystemServiceManager.startService(DevicePolicyManagerService.Lifecycle.class);
            traceEnd();
            }

            if (!disableSystemUI) {
                traceBeginAndSlog("StartStatusBarManagerService");
@@ -1025,13 +1012,10 @@ public final class SystemServer {
                traceEnd();
            }

            if (!disableNonCoreServices) {
            traceBeginAndSlog("StartClipboardService");
            mSystemServiceManager.startService(ClipboardService.class);
            traceEnd();
            }

            if (!disableNetwork) {
            traceBeginAndSlog("StartNetworkManagementService");
            try {
                networkManagement = NetworkManagementService.create(context);
@@ -1049,15 +1033,13 @@ public final class SystemServer {
                reportWtf("starting IpSec Service", e);
            }
            traceEnd();
            }

            if (!disableNonCoreServices && !disableTextServices) {
            if (!disableTextServices) {
                traceBeginAndSlog("StartTextServicesManager");
                mSystemServiceManager.startService(TextServicesManagerService.Lifecycle.class);
                traceEnd();
            }

            if (!disableNetwork) {
            traceBeginAndSlog("StartNetworkScoreService");
            try {
                networkScore = new NetworkScoreService(context);
@@ -1160,9 +1142,7 @@ public final class SystemServer {
                reportWtf("starting Service Discovery Service", e);
            }
            traceEnd();
            }

            if (!disableNonCoreServices) {
            traceBeginAndSlog("StartUpdateLockService");
            try {
                ServiceManager.addService(Context.UPDATE_LOCK_SERVICE,
@@ -1171,7 +1151,6 @@ public final class SystemServer {
                reportWtf("starting UpdateLockService", e);
            }
            traceEnd();
            }

            traceBeginAndSlog("StartNotificationManager");
            mSystemServiceManager.startService(NotificationManagerService.class);
@@ -1185,7 +1164,6 @@ public final class SystemServer {
            mSystemServiceManager.startService(DeviceStorageMonitorService.class);
            traceEnd();

            if (!disableLocation) {
            traceBeginAndSlog("StartLocationManagerService");
            try {
                location = new LocationManagerService(context);
@@ -1203,9 +1181,8 @@ public final class SystemServer {
                reportWtf("starting Country Detector", e);
            }
            traceEnd();
            }

            if (!disableNonCoreServices && !disableSearchManager) {
            if (!disableSearchManager) {
                traceBeginAndSlog("StartSearchManagerService");
                try {
                    mSystemServiceManager.startService(SEARCH_MANAGER_SERVICE_CLASS);
@@ -1215,8 +1192,7 @@ public final class SystemServer {
                traceEnd();
            }

            if (!disableNonCoreServices && context.getResources().getBoolean(
                        R.bool.config_enableWallpaperService)) {
            if (context.getResources().getBoolean(R.bool.config_enableWallpaperService)) {
                traceBeginAndSlog("StartWallpaperManagerService");
                mSystemServiceManager.startService(WALLPAPER_SERVICE_CLASS);
                traceEnd();
@@ -1232,7 +1208,6 @@ public final class SystemServer {
                traceEnd();
            }

            if (!disableNonCoreServices) {
            traceBeginAndSlog("StartDockObserver");
            mSystemServiceManager.startService(DockObserver.class);
            traceEnd();
@@ -1242,7 +1217,6 @@ public final class SystemServer {
                mSystemServiceManager.startService(THERMAL_OBSERVER_CLASS);
                traceEnd();
            }
            }

            traceBeginAndSlog("StartWiredAccessoryManager");
            try {
@@ -1254,7 +1228,6 @@ public final class SystemServer {
            }
            traceEnd();

            if (!disableNonCoreServices) {
            if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_MIDI)) {
                // Start MIDI Manager service
                traceBeginAndSlog("StartMidiManager");
@@ -1292,7 +1265,6 @@ public final class SystemServer {
                Slog.e(TAG, "Failure starting HardwarePropertiesManagerService", e);
            }
            traceEnd();
            }

            traceBeginAndSlog("StartTwilightService");
            mSystemServiceManager.startService(TwilightService.class);
@@ -1312,7 +1284,6 @@ public final class SystemServer {
            mSystemServiceManager.startService(SoundTriggerService.class);
            traceEnd();

            if (!disableNonCoreServices) {
            if (!disableTrustManager) {
                traceBeginAndSlog("StartTrustManager");
                mSystemServiceManager.startService(TrustManagerService.class);
@@ -1352,7 +1323,6 @@ public final class SystemServer {
            traceBeginAndSlog("StartContextHubSystemService");
            mSystemServiceManager.startService(ContextHubSystemService.class);
            traceEnd();
            }

            traceBeginAndSlog("StartDiskStatsService");
            try {
@@ -1375,7 +1345,6 @@ public final class SystemServer {
                traceEnd();
            }

            if (!disableNetwork && !disableNetworkTime) {
            traceBeginAndSlog("StartNetworkTimeUpdateService");
            try {
                networkTimeUpdater = new NetworkTimeUpdateService(context);
@@ -1384,7 +1353,6 @@ public final class SystemServer {
                reportWtf("starting NetworkTimeUpdate service", e);
            }
            traceEnd();
            }

            traceBeginAndSlog("StartCommonTimeManagementService");
            try {
@@ -1395,7 +1363,6 @@ public final class SystemServer {
            }
            traceEnd();

            if (!disableNetwork) {
            traceBeginAndSlog("CertBlacklister");
            try {
                CertBlacklister blacklister = new CertBlacklister(context);
@@ -1403,30 +1370,25 @@ public final class SystemServer {
                reportWtf("starting CertBlacklister", e);
            }
            traceEnd();
            }

            if (!disableNetwork && !disableNonCoreServices && EmergencyAffordanceManager.ENABLED) {
            if (EmergencyAffordanceManager.ENABLED) {
                // EmergencyMode service
                traceBeginAndSlog("StartEmergencyAffordanceService");
                mSystemServiceManager.startService(EmergencyAffordanceService.class);
                traceEnd();
            }

            if (!disableNonCoreServices) {
            // Dreams (interactive idle-time views, a/k/a screen savers, and doze mode)
            traceBeginAndSlog("StartDreamManager");
            mSystemServiceManager.startService(DreamManagerService.class);
            traceEnd();
            }

            if (!disableNonCoreServices) {
            traceBeginAndSlog("AddGraphicsStatsService");
            ServiceManager.addService(GraphicsStatsService.GRAPHICS_STATS_SERVICE,
                new GraphicsStatsService(context));
            traceEnd();
            }

            if (!disableNonCoreServices && CoverageService.ENABLED) {
            if (CoverageService.ENABLED) {
                traceBeginAndSlog("AddCoverageService");
                ServiceManager.addService(CoverageService.COVERAGE_SERVICE, new CoverageService());
                traceEnd();
@@ -1477,7 +1439,6 @@ public final class SystemServer {
                traceEnd();
            }

            if (!disableNonCoreServices) {
            traceBeginAndSlog("StartMediaRouterService");
            try {
                mediaRouter = new MediaRouterService(context);
@@ -1508,7 +1469,7 @@ public final class SystemServer {
                reportWtf("StartPruneInstantAppsJobService", e);
            }
            traceEnd();
            }

            // LauncherAppsService uses ShortcutService.
            traceBeginAndSlog("StartShortcutServiceLifecycle");
            mSystemServiceManager.startService(ShortcutService.Lifecycle.class);
@@ -1519,7 +1480,7 @@ public final class SystemServer {
            traceEnd();
        }

        if (!disableNonCoreServices && !disableMediaProjection) {
        if (!disableMediaProjection) {
            traceBeginAndSlog("StartMediaProjectionManager");
            mSystemServiceManager.startService(MediaProjectionManagerService.class);
            traceEnd();
@@ -1530,7 +1491,6 @@ public final class SystemServer {
            mSystemServiceManager.startService(WEAR_CONNECTIVITY_SERVICE_CLASS);
            traceEnd();

            if (!disableNonCoreServices) {
            traceBeginAndSlog("StartWearTimeService");
            mSystemServiceManager.startService(WEAR_DISPLAY_SERVICE_CLASS);
            mSystemServiceManager.startService(WEAR_TIME_SERVICE_CLASS);
@@ -1542,7 +1502,6 @@ public final class SystemServer {
                traceEnd();
            }
        }
        }

        if (!disableCameraService) {
            traceBeginAndSlog("StartCameraServiceProxy");