简体   繁体   中英

How to deny to access to external storage programmatically?

I'm working on a privileged app with system permissions. I need to deny user access to external storage (SD card). I've used UserManager for this purpose. It works for other privileges like disallow Bluetooth configuration, Wifi configuration etc, but it doesn't work for UserManager.DISALLOW_MOUNT_PHYSICAL_MEDIA

I've used following code to access method:

MethodUtils.invokeMethod(getUserManagerStub(),"setUserRestriction",new Object[]{key,value,userId});

with the DevicePolicyManager there's .addUserRestriction() & .clearUserRestriction() .

this should support flags DISALLOW_MOUNT_PHYSICAL_MEDIA & DISALLOW_USB_FILE_TRANSFER .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM