判断屏幕的状态后,怎么处理?

Posted testerhome-yizhou2018

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了判断屏幕的状态后,怎么处理?相关的知识,希望对你有一定的参考价值。

## 判断锁屏状态 adb shell dumpsys window policy | findstr isStatusBarKeyguard
## 判断亮灭屏状态 adb shell dumpsys window policy | findstr ScreenOn
def handling_screen_status():
    "检查屏幕状态,并作出处理"
    order = adb shell dumpsys window policy | findstr isStatusBarKeyguard #可以直接指定APP吗?
    pi = subprocess.Popen(order, shell=True)
    # print(str(pi))
    if "isStatusBarKeyguard=true" in str(pi):   #状态值不能接收,怎么实现?
        powerkey()

 

这里学习下:

https://blog.csdn.net/u013948858/article/details/80424430

以上是关于判断屏幕的状态后,怎么处理?的主要内容,如果未能解决你的问题,请参考以下文章

Android - 通过 FragmentManager 替换片段后,片段返回到它们的第一个状态

Android 片段不保存状态,在旋转/屏幕锁定/返回时崩溃

滑动 ViewPager 时如何清除片段相关状态

片段处理屏幕方向与操作栏中的选项卡

ADB获取手机屏幕状态

从其他片段启动视频视图片段时显示问题?