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

Commit e51099f1 authored by Mike Lockwood's avatar Mike Lockwood
Browse files

UsbManager: add getDefaultFunction()



Bug: 5108883

Change-Id: I211f1ee39987da4a5456d86b49b954c564fa3bf4
Signed-off-by: default avatarMike Lockwood <lockwood@android.com>
parent 2124ef9e
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -407,6 +407,23 @@ public class UsbManager {
        return propertyContainsFunction("sys.usb.config", function);
    }

    /**
     * Returns the current default USB function.
     *
     * @return name of the default function.
     *
     * {@hide}
     */
    public String getDefaultFunction() {
        String functions = SystemProperties.get("persist.sys.usb.config", "");
        int commaIndex = functions.indexOf(',');
        if (commaIndex > 0) {
            return functions.substring(0, commaIndex);
        } else {
            return functions;
        }
    }

    /**
     * Sets the current USB function.
     * If function is null, then the current function is set to the default function.