Assume virtual devices always have USB connection.
We use the presence of an active USB data connection to suppress
the RescueParty logic. For example, all physical devices in a test
lab return "true" here to avoid interfering with test results.
Since virtual devices are pretty much only used in test labs, return
true for them too.
Bug: 37347800
Test: builds, boots
Change-Id: Ie79ce57ce67fb78234c1001a593918253a85254d
diff --git a/services/core/java/com/android/server/RescueParty.java b/services/core/java/com/android/server/RescueParty.java
index 3b36c3c..1924a86 100644
--- a/services/core/java/com/android/server/RescueParty.java
+++ b/services/core/java/com/android/server/RescueParty.java
@@ -55,6 +55,7 @@
private static final String PROP_RESCUE_LEVEL = "sys.rescue_level";
private static final String PROP_RESCUE_BOOT_COUNT = "sys.rescue_boot_count";
private static final String PROP_RESCUE_BOOT_START = "sys.rescue_boot_start";
+ private static final String PROP_VIRTUAL_DEVICE = "ro.hardware.virtual_device";
private static final int LEVEL_NONE = 0;
private static final int LEVEL_RESET_SETTINGS_UNTRUSTED_DEFAULTS = 1;
@@ -336,6 +337,10 @@
* a good proxy for someone doing local development work.
*/
private static boolean isUsbActive() {
+ if (SystemProperties.getBoolean(PROP_VIRTUAL_DEVICE, false)) {
+ Slog.v(TAG, "Assuming virtual device is connected over USB");
+ return true;
+ }
try {
final String state = FileUtils
.readTextFile(new File("/sys/class/android_usb/android0/state"), 128, "");