From a96d3d3ff46b2b94484f285da172db9572f3c26b Mon Sep 17 00:00:00 2001 From: William Hester Date: Wed, 19 Dec 2018 13:14:51 -0800 Subject: Implement test harness mode Test Harness Mode is a feature for device farms that want to wipe their devices after each test run. It stores the ADB keys in the persistent partition (used for Factory Reset Protection) then performs a factory reset by broadcasting the MASTER_CLEAR intent. Upon rebooting, the Setup Wizard is skipped, and a few settings are set: * Package Verifier is disabled * Stay Awake While Charging is enabled * OTA Updates are disabled * Auto-Sync for accounts is disabled Other apps may configure themselves differently in Test Harness Mode by checking ActivityManager.isRunningInUserTestHarness() Bug: 80137798 Test: make && fastboot flashall -w Test: adb shell cmd testharness enable Change-Id: I91285c056666e36ad0caf778bffc140a0656fcfa --- services/java/com/android/server/SystemServer.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'services/java/com') diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index cef47caff740..32d7649c5b51 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -136,6 +136,7 @@ import com.android.server.stats.StatsCompanionService; import com.android.server.statusbar.StatusBarManagerService; import com.android.server.storage.DeviceStorageMonitorService; import com.android.server.telecom.TelecomLoaderService; +import com.android.server.testharness.TestHarnessModeService; import com.android.server.textclassifier.TextClassificationManagerService; import com.android.server.textservices.TextServicesManagerService; import com.android.server.trust.TrustManagerService; @@ -1147,6 +1148,10 @@ public final class SystemServer { traceBeginAndSlog("StartPersistentDataBlock"); mSystemServiceManager.startService(PersistentDataBlockService.class); traceEnd(); + + traceBeginAndSlog("StartTestHarnessMode"); + mSystemServiceManager.startService(TestHarnessModeService.class); + traceEnd(); } if (hasPdb || OemLockService.isHalPresent()) { -- cgit v1.2.3-59-g8ed1b