Loading services/core/java/com/android/server/adb/AdbService.java +19 −15 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ import com.android.internal.util.dump.DualDumpOutputStream; import com.android.server.FgThread; import com.android.server.LocalServices; import com.android.server.SystemService; import com.android.server.testharness.TestHarnessModeService; import java.io.File; import java.io.FileDescriptor; Loading Loading @@ -163,18 +164,8 @@ public class AdbService extends IAdbManager.Stub { } } private void initAdbState() { private void registerContentObservers() { try { /* * Use the normal bootmode persistent prop to maintain state of adb across * all boot modes. */ mIsAdbUsbEnabled = containsFunction( SystemProperties.get(USB_PERSISTENT_CONFIG_PROPERTY, ""), UsbManager.USB_FUNCTION_ADB); mIsAdbWifiEnabled = "1".equals( SystemProperties.get(WIFI_PERSISTENT_CONFIG_PROPERTY, "0")); // register observer to listen for settings changes mObserver = new AdbSettingsObserver(); mContentResolver.registerContentObserver( Loading @@ -184,7 +175,7 @@ public class AdbService extends IAdbManager.Stub { Settings.Global.getUriFor(Settings.Global.ADB_WIFI_ENABLED), false, mObserver); } catch (Exception e) { Slog.e(TAG, "Error in initAdbState", e); Slog.e(TAG, "Error in registerContentObservers", e); } } Loading Loading @@ -248,7 +239,7 @@ public class AdbService extends IAdbManager.Stub { mContentResolver = context.getContentResolver(); mDebuggingManager = new AdbDebuggingManager(context); initAdbState(); registerContentObservers(); LocalServices.addService(AdbManagerInternal.class, new AdbManagerInternalImpl()); } Loading @@ -259,10 +250,23 @@ public class AdbService extends IAdbManager.Stub { public void systemReady() { if (DEBUG) Slog.d(TAG, "systemReady"); /* * Use the normal bootmode persistent prop to maintain state of adb across * all boot modes. */ 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, mIsAdbUsbEnabled ? 1 : 0); Settings.Global.ADB_ENABLED, shouldEnableAdbUsb ? 1 : 0); Settings.Global.putInt(mContentResolver, Settings.Global.ADB_WIFI_ENABLED, mIsAdbWifiEnabled ? 1 : 0); } catch (SecurityException e) { Loading @@ -272,7 +276,7 @@ public class AdbService extends IAdbManager.Stub { } /** * Callend in response to {@code SystemService.PHASE_BOOT_COMPLETED} from {@code SystemServer}. * Called in response to {@code SystemService.PHASE_BOOT_COMPLETED} from {@code SystemServer}. */ public void bootCompleted() { if (DEBUG) Slog.d(TAG, "boot completed"); Loading services/core/java/com/android/server/testharness/OWNERS 0 → 100644 +1 −0 Original line number Diff line number Diff line williamhester@google.com services/core/java/com/android/server/testharness/TestHarnessModeService.java +3 −3 Original line number Diff line number Diff line Loading @@ -69,8 +69,8 @@ import java.util.Set; * automatic updates, etc.) are all disabled by default but may be re-enabled by the user. */ public class TestHarnessModeService extends SystemService { public static final String TEST_HARNESS_MODE_PROPERTY = "persist.sys.test_harness"; private static final String TAG = TestHarnessModeService.class.getSimpleName(); private static final String TEST_HARNESS_MODE_PROPERTY = "persist.sys.test_harness"; private PersistentDataBlockManagerInternal mPersistentDataBlockManagerInternal; Loading Loading @@ -168,9 +168,9 @@ public class TestHarnessModeService extends SystemService { Slog.d(TAG, "Restarted adbd"); } // Disable the TTL for ADB keys before enabling ADB // Disable the TTL for ADB keys before ADB is enabled as a part of AdbService's // initialization. Settings.Global.putLong(cr, Settings.Global.ADB_ALLOWED_CONNECTION_TIME, 0); Settings.Global.putInt(cr, Settings.Global.ADB_ENABLED, 1); Settings.Global.putInt(cr, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1); Settings.Global.putInt(cr, Settings.Global.PACKAGE_VERIFIER_INCLUDE_ADB, 0); Settings.Global.putInt( Loading Loading
services/core/java/com/android/server/adb/AdbService.java +19 −15 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ import com.android.internal.util.dump.DualDumpOutputStream; import com.android.server.FgThread; import com.android.server.LocalServices; import com.android.server.SystemService; import com.android.server.testharness.TestHarnessModeService; import java.io.File; import java.io.FileDescriptor; Loading Loading @@ -163,18 +164,8 @@ public class AdbService extends IAdbManager.Stub { } } private void initAdbState() { private void registerContentObservers() { try { /* * Use the normal bootmode persistent prop to maintain state of adb across * all boot modes. */ mIsAdbUsbEnabled = containsFunction( SystemProperties.get(USB_PERSISTENT_CONFIG_PROPERTY, ""), UsbManager.USB_FUNCTION_ADB); mIsAdbWifiEnabled = "1".equals( SystemProperties.get(WIFI_PERSISTENT_CONFIG_PROPERTY, "0")); // register observer to listen for settings changes mObserver = new AdbSettingsObserver(); mContentResolver.registerContentObserver( Loading @@ -184,7 +175,7 @@ public class AdbService extends IAdbManager.Stub { Settings.Global.getUriFor(Settings.Global.ADB_WIFI_ENABLED), false, mObserver); } catch (Exception e) { Slog.e(TAG, "Error in initAdbState", e); Slog.e(TAG, "Error in registerContentObservers", e); } } Loading Loading @@ -248,7 +239,7 @@ public class AdbService extends IAdbManager.Stub { mContentResolver = context.getContentResolver(); mDebuggingManager = new AdbDebuggingManager(context); initAdbState(); registerContentObservers(); LocalServices.addService(AdbManagerInternal.class, new AdbManagerInternalImpl()); } Loading @@ -259,10 +250,23 @@ public class AdbService extends IAdbManager.Stub { public void systemReady() { if (DEBUG) Slog.d(TAG, "systemReady"); /* * Use the normal bootmode persistent prop to maintain state of adb across * all boot modes. */ 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, mIsAdbUsbEnabled ? 1 : 0); Settings.Global.ADB_ENABLED, shouldEnableAdbUsb ? 1 : 0); Settings.Global.putInt(mContentResolver, Settings.Global.ADB_WIFI_ENABLED, mIsAdbWifiEnabled ? 1 : 0); } catch (SecurityException e) { Loading @@ -272,7 +276,7 @@ public class AdbService extends IAdbManager.Stub { } /** * Callend in response to {@code SystemService.PHASE_BOOT_COMPLETED} from {@code SystemServer}. * Called in response to {@code SystemService.PHASE_BOOT_COMPLETED} from {@code SystemServer}. */ public void bootCompleted() { if (DEBUG) Slog.d(TAG, "boot completed"); Loading
services/core/java/com/android/server/testharness/OWNERS 0 → 100644 +1 −0 Original line number Diff line number Diff line williamhester@google.com
services/core/java/com/android/server/testharness/TestHarnessModeService.java +3 −3 Original line number Diff line number Diff line Loading @@ -69,8 +69,8 @@ import java.util.Set; * automatic updates, etc.) are all disabled by default but may be re-enabled by the user. */ public class TestHarnessModeService extends SystemService { public static final String TEST_HARNESS_MODE_PROPERTY = "persist.sys.test_harness"; private static final String TAG = TestHarnessModeService.class.getSimpleName(); private static final String TEST_HARNESS_MODE_PROPERTY = "persist.sys.test_harness"; private PersistentDataBlockManagerInternal mPersistentDataBlockManagerInternal; Loading Loading @@ -168,9 +168,9 @@ public class TestHarnessModeService extends SystemService { Slog.d(TAG, "Restarted adbd"); } // Disable the TTL for ADB keys before enabling ADB // Disable the TTL for ADB keys before ADB is enabled as a part of AdbService's // initialization. Settings.Global.putLong(cr, Settings.Global.ADB_ALLOWED_CONNECTION_TIME, 0); Settings.Global.putInt(cr, Settings.Global.ADB_ENABLED, 1); Settings.Global.putInt(cr, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1); Settings.Global.putInt(cr, Settings.Global.PACKAGE_VERIFIER_INCLUDE_ADB, 0); Settings.Global.putInt( Loading