Merge changes from topic 'usb_bugfixes'
* changes: Automatically turn on adb for userdebug and eng builds. Fixed handling of usb state during adb changes. Refactored setCurrentFunction and setUsbDataUnlocked into single method. Remove the kick from config switches in UsbDeviceManager
This commit is contained in:
@@ -88,15 +88,13 @@ interface IUsbManager
|
||||
/* Returns true if the specified USB function is enabled. */
|
||||
boolean isFunctionEnabled(String function);
|
||||
|
||||
/* Sets the current USB function. */
|
||||
void setCurrentFunction(String function);
|
||||
|
||||
/* Sets whether USB data (for example, MTP exposed pictures) should be made
|
||||
* available on the USB connection. Unlocking data should only be done with
|
||||
* user involvement, since exposing pictures or other data could leak sensitive
|
||||
* user information.
|
||||
/* Sets the current USB function as well as whether USB data
|
||||
* (for example, MTP exposed pictures) should be made available
|
||||
* on the USB connection. Unlocking data should only be done with
|
||||
* user involvement, since exposing pictures or other data could
|
||||
* leak sensitive user information.
|
||||
*/
|
||||
void setUsbDataUnlocked(boolean unlock);
|
||||
void setCurrentFunction(String function, boolean usbDataUnlocked);
|
||||
|
||||
/* Allow USB debugging from the attached host. If alwaysAllow is true, add the
|
||||
* the public key to list of host keys that the user has approved.
|
||||
|
||||
@@ -542,33 +542,23 @@ public class UsbManager {
|
||||
* {@link #USB_FUNCTION_MIDI}, {@link #USB_FUNCTION_MTP}, {@link #USB_FUNCTION_PTP},
|
||||
* or {@link #USB_FUNCTION_RNDIS}.
|
||||
* </p><p>
|
||||
* Also sets whether USB data (for example, MTP exposed pictures) should be made available
|
||||
* on the USB connection when in device mode. Unlocking usb data should only be done with
|
||||
* user involvement, since exposing pictures or other data could leak sensitive
|
||||
* user information.
|
||||
* </p><p>
|
||||
* Note: This function is asynchronous and may fail silently without applying
|
||||
* the requested changes.
|
||||
* </p>
|
||||
*
|
||||
* @param function name of the USB function, or null to restore the default function
|
||||
* @param usbDataUnlocked whether user data is accessible
|
||||
*
|
||||
* {@hide}
|
||||
*/
|
||||
public void setCurrentFunction(String function) {
|
||||
public void setCurrentFunction(String function, boolean usbDataUnlocked) {
|
||||
try {
|
||||
mService.setCurrentFunction(function);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether USB data (for example, MTP exposed pictures) should be made available
|
||||
* on the USB connection when in device mode. Unlocking usb data should only be done with
|
||||
* user involvement, since exposing pictures or other data could leak sensitive
|
||||
* user information.
|
||||
*
|
||||
* {@hide}
|
||||
*/
|
||||
public void setUsbDataUnlocked(boolean unlocked) {
|
||||
try {
|
||||
mService.setUsbDataUnlocked(unlocked);
|
||||
mService.setCurrentFunction(function, usbDataUnlocked);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user