<!-- The default tiles to display in QuickSettings --> <string name="quick_settings_tiles_default" translatable="false"> wifi,bt,dnd,rotation,battery,cell,cast </string>
<!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" --> <string name="quick_settings_tiles_stock" translatable="false"> wifi,cell,battery,dnd,rotation,bt,location,hotspot,inversion,saver,work,cast,night </string>
// Temporary mapping USB device name to list of UIDs with permissions for the device privatefinal HashMap<String, SparseBooleanArray> mDevicePermissionMap = new HashMap<>(); // Temporary mapping UsbAccessory to list of UIDs with permissions for the accessory privatefinal HashMap<UsbAccessory, SparseBooleanArray> mAccessoryPermissionMap = new HashMap<>();
两个hashmap分别储存的uid和对应的usbdevice,只要存在即允许了权限 publicbooleanhasPermission(UsbDevice device, String packageName, int uid){ synchronized (mLock) { if (isCameraDevicePresent(device)) { //camera权限,usb camera需要额外的camera权限 if (!isCameraPermissionGranted(packageName, uid)) { returnfalse; } } //如果是系统uid,或者mDisablePermissionDialogs 设置禁用usb权限询问框,则默认拥有权限 if (uid == Process.SYSTEM_UID || mDisablePermissionDialogs) { returntrue; } //获取对应usbdevice的已允许权限uid,如果uid存在则判断拥有权限 SparseBooleanArray uidList = mDevicePermissionMap.get(device.getDeviceName()); if (uidList == null) { returnfalse; } return uidList.get(uid);