I have modified the Advanced Android Kiosk Mode for my needs so it launches another app, and can also update it making the user choose an .apk
file from a USB stick.
To choose the .apk
file, the kiosk app launches the FILES app (by Google) that is present on the device, and the user should select the .apk
file. The problem is that in Kiosk mode, the FILES app doesn’t see the USB stick.
In the Kiosk app, there is the following function that I have modified removing DISALLOW_MOUNT_PHYSICAL_MEDIA
, but this don’t solve the problem:
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;
The Android log while connecting the USB stick is the following:
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
In the first part, the USB stick is recognized. But, in the last part, the state is state=UNMOUNTED
, so it is not accessible.
If the app is not in kiosk mode, everything works.
The target device runs Android 11, and I use Delphi 12.2 w/ patch 2.
Can anybody give me some help?