How To Check If Screen Lock Is Enabled In The Settings Using Adb
I need to know how to check if any type of screen lock is enabled in the settings part of the device. I need to check this using an adb command (by using adb shell). I also need to
Solution 1:
Has answered in Is there a way to check if Android device screen is locked via adb? - Stack Overflow and copy to here:
- My Phone:
XiaoMi 9
- Android:
10
- Android:
use adb to check status of screen locked
method 1: (universal) use mDreamingLockscreen
- Command:
adb shell dumpsys window | grep mDreamingLockscreen
- Output:
mShowingDream=false mDreamingLockscreen=true mDreamingSleepToken=null
-> Screen Locked- no matter Screen is
ON
orOFF
- no matter Screen is
mShowingDream=false mDreamingLockscreen=false mDreamingSleepToken=null
-> Scrren Unlocked
method 2: use nfc
(if android has NFC module)
- Command:
adb shell dumpsys nfc | grep 'mScreenState='
- Output:
mScreenState=OFF_LOCKED
-> Screen OFF and LockedmScreenState=ON_LOCKED
-> Screen ON and LockedmScreenState=ON_UNLOCKED
-> Screen ON and Unlocked
Post a Comment for "How To Check If Screen Lock Is Enabled In The Settings Using Adb"