diff options
author | Zoltan Szatmary-Ban <szatmz@google.com> | 2015-07-08 11:44:32 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-07-08 11:44:35 +0000 |
commit | a2de7fc9fc0b96ba4db65ccf6c9684c8c27c2993 (patch) | |
tree | 8987229173aa3adfff8024d58f0a97e63c985814 /services/usb | |
parent | 895927603606e58a46ecaee8f2244e1e2b6f2840 (diff) | |
parent | b2eb6b9049567c134d7654f6cd79b4a47de643af (diff) | |
download | frameworks_base-a2de7fc9fc0b96ba4db65ccf6c9684c8c27c2993.zip frameworks_base-a2de7fc9fc0b96ba4db65ccf6c9684c8c27c2993.tar.gz frameworks_base-a2de7fc9fc0b96ba4db65ccf6c9684c8c27c2993.tar.bz2 |
Merge "Prevent accidental unlocking of USB data transfer." into mnc-dev
Diffstat (limited to 'services/usb')
-rw-r--r-- | services/usb/java/com/android/server/usb/UsbService.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/services/usb/java/com/android/server/usb/UsbService.java b/services/usb/java/com/android/server/usb/UsbService.java index 7a3426c..987a79f 100644 --- a/services/usb/java/com/android/server/usb/UsbService.java +++ b/services/usb/java/com/android/server/usb/UsbService.java @@ -273,6 +273,13 @@ public class UsbService extends IUsbManager.Stub { @Override public void setUsbDataUnlocked(boolean unlocked) { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USB, null); + // If attempt to change USB function while file transfer is restricted, ensure that + // usb data is always locked, and return. + UserManager userManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE); + if (userManager.hasUserRestriction(UserManager.DISALLOW_USB_FILE_TRANSFER)) { + if (mDeviceManager != null) mDeviceManager.setUsbDataUnlocked(false); + return; + } mDeviceManager.setUsbDataUnlocked(unlocked); } |