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

Commit 3c44ceb0 authored by Andres Calderon Jaramillo's avatar Andres Calderon Jaramillo Committed by Android (Google) Code Review
Browse files

Revert "adb: fix the initial adbd state in AdbService"

This reverts commit 4ace1668.

Reason for revert: breaks desktop bootPerf tests (b/415900799).

Bug: 402444824
Bug: 415900799
Change-Id: I97e3a1859648ce3ffd90dab32df37b10de325ef8
parent 4ace1668
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -242,19 +242,21 @@ public class AdbService extends IAdbManager.Stub {
         * Use the normal bootmode persistent prop to maintain state of adb across
         * all boot modes.
         */
        final boolean shouldEnableAdbUsb =
                containsFunction(SystemProperties.get(USB_PERSISTENT_CONFIG_PROPERTY, ""),
                                 UsbManager.USB_FUNCTION_ADB)
                || SystemProperties.getBoolean(TestHarnessModeService.TEST_HARNESS_MODE_PROPERTY,
                                               false);
        final boolean shouldEnableAdbWifi = "1".equals(
        mIsAdbUsbEnabled = containsFunction(
                SystemProperties.get(USB_PERSISTENT_CONFIG_PROPERTY, ""),
                UsbManager.USB_FUNCTION_ADB);
        boolean shouldEnableAdbUsb = mIsAdbUsbEnabled
                || SystemProperties.getBoolean(
                        TestHarnessModeService.TEST_HARNESS_MODE_PROPERTY, false);
        mIsAdbWifiEnabled = "1".equals(
                SystemProperties.get(WIFI_PERSISTENT_CONFIG_PROPERTY, "0"));

        // make sure the ADB_ENABLED setting value matches the current state
        try {
            Settings.Global.putInt(mContentResolver,
                    Settings.Global.ADB_ENABLED, shouldEnableAdbUsb ? 1 : 0);
            Settings.Global.putInt(mContentResolver,
                    Settings.Global.ADB_WIFI_ENABLED, shouldEnableAdbWifi ? 1 : 0);
                    Settings.Global.ADB_WIFI_ENABLED, mIsAdbWifiEnabled ? 1 : 0);
        } catch (SecurityException e) {
            // If UserManager.DISALLOW_DEBUGGING_FEATURES is on, that this setting can't be changed.
            Slog.d(TAG, "ADB_ENABLED is restricted.");
@@ -266,6 +268,8 @@ public class AdbService extends IAdbManager.Stub {
     */
    public void bootCompleted() {
        Slog.d(TAG, "boot completed");
        mDebuggingManager.setAdbEnabled(mIsAdbUsbEnabled, AdbTransportType.USB);
        mDebuggingManager.setAdbEnabled(mIsAdbWifiEnabled, AdbTransportType.WIFI);
    }

    @Override