I have a few devices using the Android Management API and running in kiosk mode.
I have encountered a new issue regarding the NFC scanning after upgrading from Android 10 -> Android 12. After a device restart everything seems to be working fine and if I manually trigger a device sleep by pressing the power button and waking it all is well.
But as soon as the device's display times out and I press the power button to wake it the NFC stops working.
Here are some of the debug logs of the NfcService (the device is unlocked, left for a few seconds and locked again):
2022-09-01 21:12:16.245 2325-2325/? D/NfcService: BroadcastReceiver - SCREEN_STATE_ON_UNLOCKED
2022-09-01 21:12:16.271 2325-2325/? D/NfcService: NfcServiceHandler - handleMessage(MSG_APPLY_SCREEN_STATE) - state: ON_UNLOCKED
2022-09-01 21:12:16.273 2325-2325/? D/NfcService: Discovery configuration equal, not updating.
2022-09-01 21:12:16.442 2325-4028/? D/NfcService: Disabling default Beam behavior
2022-09-01 21:12:16.520 2325-2325/? D/NfcService: BroadcastReceiver - SCREEN_STATE_ON_LOCKED
2022-09-01 21:12:16.520 2325-2325/? D/NfcService: NfcServiceHandler - handleMessage(MSG_APPLY_SCREEN_STATE) - state: ON_LOCKED
2022-09-01 21:12:17.284 2325-2325/? D/NfcService: NfcServiceHandler - debounceRfField() - debouncing RF_FIELD: 0 (cur:0, pol:true)
2022-09-01 21:12:17.284 2325-2325/? D/NfcService: NfcServiceHandler - debounceRfField() - Ignoring, already the current state
2022-09-01 21:12:18.244 2325-2325/? D/NfcService: BroadcastReceiver - SCREEN_STATE_OFF_LOCKED
2022-09-01 21:12:18.244 2325-2325/? D/NfcService: NfcServiceHandler - handleMessage(MSG_APPLY_SCREEN_STATE) - state: OFF_LOCKED
As far as I can see the screen is unlocked but something is triggering the screen to get caught up in a locked state (SCREEN_STATE_ON_LOCKED
).
I can confirm this because if I physically hover the device over a NFC tag and unlock it, it immediately scans the tag but after the first second it doesn't work at all.
I have also tried to disable the keyguard programmatically but without any success!
Here is the current active device policy:
{
"factoryResetDisabled": true,
"systemUpdate": {
"type": "WINDOWED",
"startMinutes": 0,
"endMinutes": 240,
"freezePeriods": [
{
"startDate": {"month": 8,"day": 1},
"endDate": {"month": 9,"day": 30}
}
]
},
"applications": [
{
"packageName": "com.xxx.yyy",
"installType": "KIOSK",
"defaultPermissionPolicy": "GRANT",
"autoUpdateMode": "AUTO_UPDATE_DEFAULT"
}
],
"funDisabled": true,
"appAutoUpdatePolicy": "WIFI_ONLY",
"kioskCustomization": {
"statusBar": "NOTIFICATIONS_AND_SYSTEM_INFO_ENABLED",
"deviceSettings": "SETTINGS_ACCESS_ALLOWED",
"systemNavigation": "HOME_BUTTON_ONLY"
},
"tetheringConfigDisabled": true,
"mobileNetworksConfigDisabled": false,
"advancedSecurityOverrides": {
"developerSettings": "DEVELOPER_SETTINGS_ALLOWED"
} ,
"maximumTimeToLock": 0,
"keyguardDisabled": true,
"keyguardDisabledFeatures": "ALL_FEATURES"
}
It seems that the issue is similar to these questions:
- Android 11 - Kiosk Mode Lock Screen NFC Issue
- Android 10 NFC App - Stops working when phone sleeps while in MS Intune Kiosk Mode
Unfortunately the solutions proposed aren't going to work for my application.
Can anyone recommend a solution or has anyone encountered the same issue?