1.概述
在定制化广告机项目中,需要不间断的播放视频,当对屏幕没有操作时继续播放视频,对于这个功能,
在app中,可以通过onTouch事件来判断手势抬起后倒计时10s无操作时然后播放视频,但是对于系统而言就难判断屏幕是否操作了
查阅资料得知,在PowerManagerService.java中有对操作屏幕做了记录时间
2.实现屏幕10s无操作自动播放视频的核心类
frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
3.实现屏幕10s无操作自动播放视频的核心功能分析和实现
/**
* Updates the global power state based on dirty bits recorded in mDirty.
*
* This is the main function that performs power state transitions.
* We centralize them here so that we can recompute the power state completely
* each time something important changes, and ensure that we do it the