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

Commit 9d640958 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

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
parent f23a5e10
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ public class RescueParty {
    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 @@ public class RescueParty {
     * 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, "");