am 92c1d283: am 706ad39b: am a2de7fc9: Merge "Prevent accidental unlocking of USB data transfer." into mnc-dev
* commit '92c1d2834b4528593c66b64e188f8d556641705e': Prevent accidental unlocking of USB data transfer.
This commit is contained in:
committed by
Android Git Automerger
commit
2fbfe42955
@@ -273,6 +273,13 @@ public class UsbService extends IUsbManager.Stub {
|
|||||||
@Override
|
@Override
|
||||||
public void setUsbDataUnlocked(boolean unlocked) {
|
public void setUsbDataUnlocked(boolean unlocked) {
|
||||||
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USB, null);
|
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);
|
mDeviceManager.setUsbDataUnlocked(unlocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user