抑郁症健康,内容丰富有趣,生活中的好帮手!
抑郁症健康 > android shell检查是否锁屏_有没有办法检查Android设备屏幕是否通过adb锁定?

android shell检查是否锁屏_有没有办法检查Android设备屏幕是否通过adb锁定?

时间:2019-10-01 23:24:56

相关推荐

I know that PowerManager and/or KeyguardManager can help me check if a device screen is locked/unlocked. Is there a way to check this via adb?

解决方案

This command will output everything relating to power for the device:

adb shell dumpsys power

You can pipe this to a grep to get the values of mHoldingWakeLockSuspendBlocker and mHoldingDisplaySuspendBlocker:

adb shell dumpsys power | grep 'mHolding'

If both are false, the display is off.

If mHoldingWakeLockSuspendBlocker is false, and mHoldingDisplaySuspendBlocker is true, the display is on, but locked.

If both are true, the display is on.

如果觉得《android shell检查是否锁屏_有没有办法检查Android设备屏幕是否通过adb锁定?》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。