Android 12 Kiosk模式下屏幕超时后NFC功能失效问题求助
Android 12 Kiosk模式下NFC超时唤醒后失效问题求助
我们有多台通过Android Management API管控、运行在Kiosk模式的设备。从Android 10升级到Android 12后,遇到了NFC扫描的异常问题:设备重启后NFC功能完全正常,手动按电源键休眠再唤醒也没问题,但当设备因屏幕超时自动休眠后,按电源键唤醒时NFC就会停止工作。
NfcService调试日志(设备解锁后静置至自动锁定过程)
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
从日志可见,屏幕本应处于解锁状态,却被触发进入锁定状态(SCREEN_STATE_ON_LOCKED)。实际测试中,设备刚唤醒时靠近NFC标签能立即完成扫描,但仅一秒后NFC就完全失效。我尝试过通过代码禁用keyguard,但未成功。
当前生效的设备策略
{ "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" }
我发现有两个类似问题,但其中的解决方案都不适用于我的场景:
- Android 11 Kiosk模式锁屏NFC问题
- Android 10 Kiosk模式下设备休眠后NFC应用停止工作
有没有人遇到过相同问题?或者能提供可行的解决方案?
内容的提问来源于stack exchange,提问作者Johan Ferreira
相关产品推荐
相关产品推荐

