如何使用 adb 在设置中检查是否启用了屏幕锁定

问题描述:

我需要知道如何检查设备的设置部分是否启用了任何类型的屏幕锁定.我需要使用 adb 命令(通过使用 adb shell)来检查这个.我还需要知道应用的锁类型.

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 know the type of lock applied.

我尝试过 dumpsys 但没有成功.

I have tried dumpsys but did not get any success.

我想知道设置中是否启用了屏幕锁定,即使设备当前已解锁,只需检查是否有任何安全措施,在任何状态下.

I want to know if the screen lock is enabled in the settings even if the device is currently unlocked, just check if any security is there, in any state.

已在 有没有办法通过adb检查Android设备屏幕是否被锁定?- 堆栈溢出并复制到这里:

  • 我的手机:小米9
    • 安卓:10
    • 命令:adb shell dumpsys window |grep mDreamingLockscreen
    • 输出:
      • mShowingDream=false mDreamingLockscreen=true mDreamingSleepToken=null -> 屏幕 锁定
        • 无论屏幕是ON还是OFF
        • Command: adb shell dumpsys window | grep mDreamingLockscreen
        • Output:
          • mShowingDream=false mDreamingLockscreen=true mDreamingSleepToken=null -> Screen Locked
            • no matter Screen is ON or OFF
            • 命令:adb shell dumpsys nfc |grep 'mScreenState='
            • 输出:
              • mScreenState=OFF_LOCKED -> 屏幕关闭并锁定
              • mScreenState=ON_LOCKED -> 屏幕开启和锁定
              • mScreenState=ON_UNLOCKED -> 屏幕开启和解锁
              • Command: adb shell dumpsys nfc | grep 'mScreenState='
              • Output:
                • mScreenState=OFF_LOCKED -> Screen OFF and Locked
                • mScreenState=ON_LOCKED -> Screen ON and Locked
                • mScreenState=ON_UNLOCKED -> Screen ON and Unlocked