Android Question Kiosk example not working after rebooting (DOOGEE X10)

IdealtekDev

Member
Licensed User
Hello all,

First, thanks for B4A I am using it since about a month and it is really nice to use.

I am currently developping a kiosk application which I test on a DOOGEE X10, which is a low cost phone running on android 6.0.

I tried to use the example given by Eren (https://www.b4x.com/android/forum/threads/device-owner-tasklock-kiosk-apps-2017.81765/#post-518018), it works well the first time I launch it. Then, I activate kiosk mode and when I reboot the phone the application is well launched as it is the home application but the application won't block the phone. The message "Screen Pinned" is displayed but soon after the message "Screen unpinned" is displayed without me doing any action.

I first encountered this bug developping my application, which doesn't have any ways of unlocking the screen btw so it's really weird, and then I tried with Eren example and met this bug again.

I'm wondering if it could come from the phone (I doesn't have another one on which I can test kiosk mode), If anyone can try to reproduce this bug on another phone I would be grateful.
I'm also wondering if it's really a bug or if it's some kind of protection and that it should stay that way ?

Anyway if anyone have an idea I would be very grateful, thanks in advance :) !
 

techknight

Well-Known Member
Licensed User
I would go into the android security settings and look for other device administrators. Another activated device administrator could "undo" what your app does.
 

IdealtekDev

Member
Licensed User
I quickly made a sub that check every second if the app is locked, and if it isn't it tries to lock it to see the logs.

From what I understand, each time the app is locked, immediatly after it unlock itself. This is weird because there is no function to unlock the app in my code.

"Check : false" says that the app isn't locked, this is verified with
B4X:
Dim ctxt As JavaObject
ctxt.InitializeContext
Dim activityManager As JavaObject = ctxt.RunMethod("getSystemService", Array("activity"))
Log("Check : " & activityManager.RunMethod("isInLockTaskMode", Null))
"Locked" Is displayed after :

B4X:
GetManager.RunMethod("setLockTaskPackages", Array(GetAdminComponent, Array As String(Application.PackageName)))
GetContext.RunMethod("startLockTask", Null)
Here are the log I got

B4X:
Check : false
Unknown event: AM_ReadyToStartComponent
 low_ram : true
Broadcast: Intent { act=android.app.action.DEVICE_POLICY_MANAGER_STATE_CHANGED flg=0x40000010 } ordered=false userid=0 callerApp=ProcessRecord{f1acebe 803:system/1000}
checkComponentPermission: null, 803, 1000, -1, true
checkComponentPermission: null, 803, 1000, -1, true
checkComponentPermission: null, 803, 1000, -1, true
checkComponentPermission: null, 904, 10015, -1, true, 10015, false, false
checkComponentPermission: null, 904, 10015, -1, true, 10015, false, false
checkComponentPermission: android.permission.INTERACT_ACROSS_USERS, 803, 1000, -1, true
setEnabledFunctions functions=mtp,adb, forceRestart=false
applyAcmFunction - sys.usb.acm_idx=,mAcmPortIdx=
applyAcmFunction - functions: mtp,adb
setKeyguardEnabled(true)
checkComponentPermission: null, 904, 10015, -1, true, 10015, false, false
 from settings cache , name = lock_screen_show_notifications , value = 1
mDeviceProvisioned is true
mDeviceProvisioned is true
mDeviceProvisioned is true
checkComponentPermission: android.permission.ACCESS_KEYGUARD_SECURE_STORAGE, 803, 1000, -1, true
checkComponentPermission: android.permission.ACCESS_KEYGUARD_SECURE_STORAGE, 904, 10015, -1, true, 10015, false, false
checkComponentPermission: android.permission.INTERACT_ACROSS_USERS, 904, 10015, -1, true, 10015, false, false
Set focused app to: AppWindowToken{7ad2396 token=Token{be1463b ActivityRecord{27384ca u0 idealtek.dashboard/.main t35}}} old focus=AppWindowToken{7ad2396 token=Token{be1463b ActivityRecord{27384ca u0 idealtek.dashboard/.main t35}}} moveFocusNow=false
enqueueToast pkg=android callback=android.widget.Toast$TN@55b8b0 duration=1
checkComponentPermission: android.permission.ACCESS_KEYGUARD_SECURE_STORAGE, 803, 1000, -1, true
noteOperation: allowing code 11 uid 1000 package android
checkComponentPermission: android.permission.SET_PROCESS_LIMIT, 803, 1000, -1, true
checkComponentPermission: android.permission.DEVICE_POWER, 0, 1000, -1, true, 1000, false, false
Looking for focus: 9 = Window{1642729 u0 StatusBar}, flags=-2122055608, canReceive=false
findFocusedWindow: Found new focus @ 5 = Window{c6fc0eb u0 idealtek.dashboard/idealtek.dashboard.main}
notifyActivityDrawnForKeyguard: waiting=false Callers=com.android.server.wm.WindowManagerService.handleAppTransitionReadyLocked:10124 com.android.server.wm.WindowManagerService.performLayoutAndPlaceSurfacesLockedInner:10744 com.android.server.wm.WindowManagerService.performLayoutAndPlaceSurfacesLockedLoop:9488 com.android.server.wm.WindowManagerService.performLayoutAndPlaceSurfacesLocked:9435 com.android.server.wm.WindowManagerService.executeAppTransition:4616
Looking for focus: 9 = Window{1642729 u0 StatusBar}, flags=-2122055608, canReceive=false
findFocusedWindow: Found new focus @ 5 = Window{c6fc0eb u0 idealtek.dashboard/idealtek.dashboard.main}
checkComponentPermission: android.permission.ACCESS_KEYGUARD_SECURE_STORAGE, 803, 1000, -1, true
checkComponentPermission: android.permission.DEVICE_POWER, 0, 1000, -1, true, 1000, false, false
checkComponentPermission: android.permission.STATUS_BAR, 803, 1000, -1, true
disable statusbar calling PID = 803
checkComponentPermission: android.permission.DISABLE_KEYGUARD, 803, 1000, -1, true
Unknown event: AM_ReadyToStartComponent
 low_ram : true
Broadcast: Intent { act=android.app.action.LOCK_TASK_ENTERING flg=0x10 cmp=idealtek.dashboard/anywheresoftware.b4a.objects.AdminReceiver2 (has extras) } ordered=false userid=0 callerApp=ProcessRecord{f1acebe 803:system/1000}
disable1: 0x00000000 -> 0x03bf0000 (diff1: 0x03bf0000)
disable1: 0x00000000 -> 0x03bf0000 (diff1: 0x03bf0000)
disable2: 0x00000000 -> 0x00000000 (diff2: 0x00000000)
disable: < EXPAND* ICONS* ALERTS* SYSTEM_INFO* back HOME* RECENT* CLOCK* SEARCH* quick_settings >
checkComponentPermission: android.permission.STATUS_BAR, 803, 1000, -1, true
disable statusbar calling PID = 803
checkComponentPermission: android.permission.INTERACT_ACROSS_USERS, 803, 1000, -1, true
checkComponentPermission: android.permission.VIBRATE, 803, 1000, -1, true
setPlmnVisibility
heads up is disabled
dismissing any existing heads up notification on disable event
releaseAllImmediately
setKeyguardEnabled(false)
Locked
checkComponentPermission: android.permission.DISABLE_KEYGUARD, 803, 1000, -1, true
setKeyguardEnabled(true)
Unknown event: AM_ReadyToStartComponent
 low_ram : true
Broadcast: Intent { act=android.app.action.LOCK_TASK_EXITING flg=0x10 cmp=idealtek.dashboard/anywheresoftware.b4a.objects.AdminReceiver2 } ordered=false userid=0 callerApp=ProcessRecord{f1acebe 803:system/1000}
enqueueToast pkg=android callback=android.widget.Toast$TN@530fc4f duration=1
noteOperation: allowing code 11 uid 1000 package android
checkComponentPermission: android.permission.SET_PROCESS_LIMIT, 803, 1000, -1, true
 from settings cache , name = lock_to_app_exit_locked , value = 0
checkComponentPermission: android.permission.BIND_DEVICE_ADMIN, 803, 1000, 10083, true
checkComponentPermission: android.permission.CHANGE_COMPONENT_ENABLED_STATE, 803, 1000, -1, true
Unknown event: AM_PackageStoppedStatusChanged
BDC-Calling onReceive: intent=Intent { act=android.app.action.LOCK_TASK_ENTERING flg=0x10 cmp=idealtek.dashboard/anywheresoftware.b4a.objects.AdminReceiver2 (has extras) }, receiver=anywheresoftware.b4a.objects.AdminReceiver2@1b4b537
idealtek.dashboard.managerservice not found.
BDC-RECEIVER handled : 0 / ReceiverData{intent=Intent { act=android.app.action.LOCK_TASK_ENTERING flg=0x10 cmp=idealtek.dashboard/anywheresoftware.b4a.objects.AdminReceiver2 (has extras) } packageName=idealtek.dashboard resultCode=-1 resultData=null resultExtras=null}
checkComponentPermission: android.permission.BIND_DEVICE_ADMIN, 803, 1000, 10083, true
checkComponentPermission: android.permission.CHANGE_COMPONENT_ENABLED_STATE, 803, 1000, -1, true
Unknown event: AM_PackageStoppedStatusChanged
[StatusBar](this:0xb8eea3c8,id:8,api:1,p:904,c:191) queueBuffer: fps=1.89 dur=1060.24 max=1033.36 min=26.88
checkComponentPermission: android.permission.DEVICE_POWER, 0, 1000, -1, true, 1000, false, false
BDC-Calling onReceive: intent=Intent { act=android.app.action.LOCK_TASK_EXITING flg=0x10 cmp=idealtek.dashboard/anywheresoftware.b4a.objects.AdminReceiver2 }, receiver=anywheresoftware.b4a.objects.AdminReceiver2@8b21aa4
idealtek.dashboard.managerservice not found.
BDC-RECEIVER handled : 0 / ReceiverData{intent=Intent { act=android.app.action.LOCK_TASK_EXITING flg=0x10 cmp=idealtek.dashboard/anywheresoftware.b4a.objects.AdminReceiver2 } packageName=idealtek.dashboard resultCode=-1 resultData=null resultExtras=null}
 from settings cache , name = device_provisioned , value = 1
checkComponentPermission: android.permission.INTERACT_ACROSS_USERS, 904, 10015, -1, true, 10015, false, false
Unknown event: AM_ReadyToStartComponent
 low_ram : true
Broadcast: Intent { act=action_hide_recents_activity flg=0x14000010 pkg=com.android.systemui (has extras) } ordered=false userid=-2 callerApp=ProcessRecord{42c88da 904:com.android.systemui/u0a15}
checkComponentPermission: android.permission.INTERACT_ACROSS_USERS_FULL, 904, 10015, -1, true, 10015, false, false
disable1: 0x03bf0000 -> 0x00000000 (diff1: 0x03bf0000)
disable2: 0x00000000 -> 0x00000000 (diff2: 0x00000000)
disable: < expand* icons* alerts* system_info* back home* recent* clock* search* quick_settings >
setPlmnVisibility
 from settings cache , name = heads_up_notifications_enabled , value = 1
 from settings cache , name = ticker_gets_heads_up , value = null
heads up is enabled
checkComponentPermission: android.permission.DEVICE_POWER, 0, 1000, -1, true, 1000, false, false
[idealtek.dashboard/idealtek.dashboard.main](this:0xb8f37778,id:111,api:1,p:1328,c:191) queueBuffer: fps=4.94 dur=1011.95 max=316.83 min=113.54
checkComponentPermission: android.permission.DEVICE_POWER, 0, 1000, -1, true, 1000, false, false
checkComponentPermission: android.permission.DEVICE_POWER, 0, 1000, -1, true, 1000, false, false
checkComponentPermission: android.permission.DEVICE_POWER, 0, 1000, -1, true, 1000, false, false
checkComponentPermission: android.permission.DEVICE_POWER, 0, 1000, -1, true, 1000, false, false
checkComponentPermission: android.permission.DEVICE_POWER, 0, 1000, -1, true, 1000, false, false
checkComponentPermission: android.permission.DEVICE_POWER, 0, 1000, -1, true, 1000, false, false
checkComponentPermission: android.permission.DEVICE_POWER, 0, 1000, -1, true, 1000, false, false
checkComponentPermission: android.permission.DEVICE_POWER, 0, 1000, -1, true, 1000, false, false
checkComponentPermission: android.permission.DEVICE_POWER, 0, 1000, -1, true, 1000, false, false
checkComponentPermission: android.permission.DEVICE_POWER, 0, 1000, -1, true, 1000, false, false
checkComponentPermission: android.permission.DEVICE_POWER, 0, 1000, -1, true, 1000, false, false
checkComponentPermission: android.permission.DEVICE_POWER, 0, 1000, -1, true, 1000, false, false
mLteRsrp: 2147483647,rsrpIconLevel: -1,mLteRssnr: 0,mLteSignalStrength: 99
gsmRscpQdbm: -319,asu: 14,dbm: -79,level: 4
checkComponentPermission: android.permission.MODIFY_PHONE_STATE, 1298, 1001, -1, true, 1001, false, false
 from settings cache , name = multi_sim_voice_call , value = null
mLteRsrp: 2147483647,rsrpIconLevel: -1,mLteRssnr: 0,mLteSignalStrength: 99
gsmRscpQdbm: -319,asu: 14,dbm: -79,level: 4
Unknown event: AM_ReadyToStartComponent
 low_ram : true
Broadcast sticky: Intent { act=android.intent.action.SIG_STR flg=0x20000010 (has extras) } ordered=false userid=-1 callerApp=ProcessRecord{f1acebe 803:system/1000}
checkComponentPermission: android.permission.INTERACT_ACROSS_USERS_FULL, 1298, 1001, -1, true, 1001, false, false
checkComponentPermission: android.permission.BROADCAST_STICKY, 1298, 1001, -1, true, 1001, false, false
checkComponentPermission: android.permission.DEVICE_POWER, 0, 1000, -1, true, 1000, false, false
checkComponentPermission: android.permission.DEVICE_POWER, 0, 1000, -1, true, 1000, false, false
checkComponentPermission: android.permission.DEVICE_POWER, 0, 1000, -1, true, 1000, false, false
checkComponentPermission: android.permission.DEVICE_POWER, 0, 1000, -1, true, 1000, false, false
Check : false
EDIT: I tried to filter the intent that seems to unlock the application but I do not know a lot about Intent, here is how I tried (It didn't change anything)

B4X:
AddActivityText(Main,
<intent-filter>
   <action android:name="android.app.action.LOCK_TASK_EXITING" />
   <action android:name="android.intent.action.MAIN" />
   <category android:name="android.intent.category.HOME" />
   <category android:name="android.intent.category.DEFAULT" />
</intent-filter>
)
 

techknight

Well-Known Member
Licensed User
How much ram does this chinesium device have?

Edit: Found it:
https://www.devicespecifications.com/en/model/41ca42a2

Throw this thing away.... and fast....

The logs show it running in low_ram mode which was a red flag to me. there are several device features that will be unavailable when it is in this mode.

It only has 512MB of RAM. And its running Android 6 which is like trying to run Windows 10 on 1GB with no VM. Good luck.

Also, With android 5.0+ the minimum RAM requirement was raised to 1GB anyways.
 
Last edited:

IdealtekDev

Member
Licensed User
I know it is very slow on RAM but I'm using it only for tests, if it can be the reason why there is this bug I may throw it but if it's not linked to the RAM I should find why the bug is here before throwing it away
 

IdealtekDev

Member
Licensed User
It is linked to the RAM issue. Thats what I am trying to say.
Oh ok, my bad I misunderstood, I'll try to find a smartphone with more RAM on which I can test Kiosk Mode, but are you sure that it is linked to the RAM issue ? how do we know it ?

In any case, thank for your help :)
 

techknight

Well-Known Member
Licensed User
How do I know it? Look in your logs. your phone is going into low RAM mode. then the KIOSK mode exits.

Also, Googles documentation states that when you are in low RAM mode, tons of android features become unavailable.

A device such as that would require Android Oreo Go in order to work properly. The last official version of Android to natively support 512MB of RAM as a limit was KitKat. The fact that they even released a phone like that in this day and age, is shameful.

Its like selling a Prescott Pentium 4 HT Today.
 

IdealtekDev

Member
Licensed User
Ok ok I'll try, I'll tell you the result.

Still I reinstalled the application, (because as described in my first post kiosk works the first time I install it) and checked the logs and the phone is in low ram mode while kiosk is working well

So I don't know, i'll try and tell you
 

techknight

Well-Known Member
Licensed User
Well ive used the Kiosk example here in this forum, in the past and I have had 0 issues with it. So its definitely related to your device.
 
Top