Is there a way to check if Android device screen is locked via adb? -


i know powermanager and/or keyguardmanager can me check if device screen locked/unlocked. there way check via adb?

this command output relating power device:

adb shell dumpsys power 

you can pipe grep values of mholdingwakelocksuspendblocker , mholdingdisplaysuspendblocker:

adb shell dumpsys power | grep 'mholding' 

if both false, display off.

if mholdingwakelocksuspendblocker false, , mholdingdisplaysuspendblocker true, display on, locked.

if both true, display on.


Comments