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

Commit a4cced6e authored by Mike Lockwood's avatar Mike Lockwood Committed by Android (Google) Code Review
Browse files

Merge "UsbManager: add getDefaultFunction()"

parents 9f8e0153 e51099f1
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.