求助:Android Kiosk模式下如何让Google FILES应用访问U盘?
Kiosk模式下U盘无法被Google FILES识别问题排查
我基于Advanced Android Kiosk Mode模板做了定制,实现了两个核心功能:
- 允许Kiosk应用启动其他应用
- 支持用户从U盘选择
.apk文件完成应用更新
为选择.apk文件,Kiosk应用会调用设备预装的Google FILES应用,但在Kiosk模式下,FILES应用无法识别U盘。
已尝试的修改
我修改了Kiosk应用中的GetRestrictions函数,移除了DISALLOW_MOUNT_PHYSICAL_MEDIA限制,但问题依然存在:
function TKioskApplication.GetRestrictions: TArrayOfJStrings; begin // SetLength(Result, 6); SetLength(Result, 5); Result[0] := StringToJString(TJUserManagerDISALLOW_FACTORY_RESET); Result[1] := StringToJString(TJUserManagerDISALLOW_SAFE_BOOT); // Result[2] := StringToJString(TJUserManagerDISALLOW_MOUNT_PHYSICAL_MEDIA); Result[2] := StringToJString(TJUserManagerDISALLOW_ADJUST_VOLUME); Result[3] := StringToJString(TJUserManagerDISALLOW_ADD_USER); Result[4] := StringToJString(TJUserManagerDISALLOW_CREATE_WINDOWS); end;
Android日志分析
连接U盘时的系统日志显示,设备已识别到U盘硬件,但最终U盘状态为state=UNMOUNTED,无法被访问:
2-1 new high-speed USB device number 4 using ehci-platform 2-1 New USB device found, idVendor=0718, idProduct=0619, bcdDevice= 1.00 2-1 New USB device strings: Mfr=1, Product=2, SerialNumber=3 2-1 Product: Trans-It Drive 2-1 Manufacturer: TDKMedia 2-1 SerialNumber: 07BA0703BE242FA7 2-1: 1.0: USB Mass Storage device detected host0: usb-storage 2-1:1.0 uid=1000(system) android.fg identical 129 lines Close system dialogs USB device attached: vidpid 0718:0619 mfg/product/ver/serial TDKMedia/Trans-It Drive/1.00/07BA0703BE242FA7 hasAudio/HID/Storage: false/false/true Close system dialogs uid=10117(com.android.systemui) identical 130 lines NotificationShadeWindow: com.android.systemui.statusbar.phone.NotificationShadeWindowView{dbf45aa I.E...... ......ID 0,0-1280,800} canPanelBeCollapsed(): false 1 configs Added device UsbDevice[mName=/dev/bus/usb/002/004,mVendorId=1816,mProductId=1561,mClass=0,mSubclass=0,mProtocol=0,mManufacturerName=TDKMedia,mProductName=Trans-It Drive,mVersion=1.00,mSerialNumberReader=com.android.server.usb.UsbSerialReader@6898cac, mHasAudioPlayback=false, mHasAudioCapture=false, mHasMidi=false, mHasVideoCapture=false, mHasVideoPlayback=false, mConfigurations=[ UsbConfiguration[mId=1,mName=null,mAttributes=128,mMaxPower=100,mInterfaces=[ UsbInterface[mId=0,mAlternateSetting=0,mName=null,mClass=8,mSubclass=6,mProtocol=80,mEndpoints=[ UsbEndpoint[mAddress=129,mAttributes=2,mMaxPacketSize=512,mInterval=0] UsbEndpoint[mAddress=2,mAttributes=2,mMaxPacketSize=512,mInterval=0]]]] Clear notification Close system dialogs NotificationShadeWindow: com.android.systemui.statusbar.phone.NotificationShadeWindowView{dbf45aa I.E...... ......ID 0,0-1280,800} canPanelBeCollapsed(): false 0 0:0:0: Direct-Access TDKMedia Trans-It Drive PMAP PQ: 0 ANSI: 4 0 0:0:0: Attached scsi generic sg0 type 0 uid=10117(com.android.systemui) identical 26 lines NotificationShadeWindow: com.android.systemui.statusbar.phone.NotificationShadeWindowView{dbf45aa I.E...... ......ID 0,0-1280,800} canPanelBeCollapsed(): false Updating roots due to change on user 0at content://com.android.externalstorage.documents NotificationShadeWindow: com.android.systemui.statusbar.phone.NotificationShadeWindowView{dbf45aa I.E...... ......ID 0,0-1280,800} canPanelBeCollapsed(): false 0 0:0:0: [sda] 7555072 512-byte logical blocks: (3.87 GB/3.60 GiB) 0 0:0:0: [sda] Write Protect is off 0 0:0:0: [sda] Mode Sense: 23 00 00 00 0 0:0:0: [sda] No Caching mode page found 0 0:0:0: [sda] Assuming drive cache: write through sda1 uid=1000(system) android.fg identical 46 lines Close system dialogs /system/bin/sgdisk --android-dump /dev/block/vold/disk:8,0 0 0:0:0: [sda] Attached SCSI removable disk DISK mbr PART 1 c uid=10117(com.android.systemui) identical 18 lines NotificationShadeWindow: com.android.systemui.statusbar.phone.NotificationShadeWindowView{dbf45aa I.E...... ......ID 0,0-1280,800} canPanelBeCollapsed(): false -----for all public volume is visible----- Ignoring mount public:8,1 due to policy Notifying volume state changed for session with id: public:8,1 No session found for sessionId: public:8,1 After updating volumes, found 1 active roots Notifying about public volume: VolumeInfo{public:8,1}: type=PUBLIC diskId=disk:8,0 partGuid= mountFlags=VISIBLE mountUserId=0 state=UNMOUNTED fsType=null fsUuid=null fsLabel=null path=null internalPath=null After updating volumes, found 1 active roots Close system dialogs NotificationShadeWindow: com.android.systemui.statusbar.phone.NotificationShadeWindowView{dbf45aa I.E...... ......ID 0,0-1280,800} canPanelBeCollapsed(): false uid=10117(com.android.systemui) identical 162 lines NotificationShadeWindow: com.android.systemui.statusbar.phone.NotificationShadeWindowView{dbf45aa I.E...... ......ID 0,0-1280,800} canPanelBeCollapsed(): false Updating roots due to change on user 0at content://com.android.externalstorage.documents Updating roots due to change on user 0at content://com.android.externalstorage.documents NotificationShadeWindow: com.android.systemui.statusbar.phone.NotificationShadeWindowView{dbf45aa I.E...... ......ID 0,0-1280,800} canPanelBeCollapsed(): false
环境信息
- 目标设备:Android 11
- 开发环境:Delphi 12.2 + Patch 2
非Kiosk模式下,U盘可正常被FILES应用识别并访问。
内容的提问来源于stack exchange,提问作者steve.b
相关产品推荐
相关产品推荐

