PowerManagerService.java
2022/1/10 14:04:02
本文主要是介绍PowerManagerService.java,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
判断显示屏保还是息屏
2112 /** 2113 * Updates the wakefulness of the device. 2114 * 2115 * This is the function that decides whether the device should start dreaming 2116 * based on the current wake locks and user activity state. It may modify mDirty 2117 * if the wakefulness changes. 2118 * 2119 * Returns true if the wakefulness changed and we need to restart power state calculation. 2120 */ 2121 private boolean updateWakefulnessLocked(int dirty) { 2122 boolean changed = false; 2123 if ((dirty & (DIRTY_WAKE_LOCKS | DIRTY_USER_ACTIVITY | DIRTY_BOOT_COMPLETED 2124 | DIRTY_WAKEFULNESS | DIRTY_STAY_ON | DIRTY_PROXIMITY_POSITIVE 2125 | DIRTY_DOCK_STATE)) != 0) { //当前屏幕保持唤醒&&设备将要进入睡眠or屏保状态 2126 if (mWakefulness == WAKEFULNESS_AWAKE && isItBedTimeYetLocked()) { 2127 if (DEBUG_SPEW) { 2128 Slog.d(TAG, "updateWakefulnessLocked: Bed time..."); 2129 } 2130 final long time = SystemClock.uptimeMillis(); //用户活动超时了应该自动的进入屏保模式 2131 if (shouldNapAtBedTimeLocked()) { //进入屏保模式 2132 changed = napNoUpdateLocked(time, Process.SYSTEM_UID); 2133 } else { //进入休眠模式 2134 changed = goToSleepNoUpdateLocked(time, 2135 PowerManager.GO_TO_SLEEP_REASON_TIMEOUT, 0, Process.SYSTEM_UID); 2136 } 2137 } 2138 } 2139 return changed; 2140 }
这篇关于PowerManagerService.java的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-05-31全网首发第二弹!软考2024年5月《软件设计师》真题+解析+答案!(11-20题)
- 2024-05-31全网首发!软考2024年5月《软件设计师》真题+解析+答案!(21-30题)
- 2024-05-30【Java】百万数据excel导出功能如何实现
- 2024-05-30我们小公司,哪像华为一样,用得上IPD(集成产品开发)?
- 2024-05-30java excel上传--poi
- 2024-05-30安装笔记本应用商店的pycharm,再安排pandas等模块,说是没有打包工具?
- 2024-05-29java11新特性
- 2024-05-29哪些无用敏捷指标正在破坏敏捷转型?
- 2024-05-29鸿蒙原生应用再新丁!新华社 入局鸿蒙
- 2024-05-29设计模式 之 迭代器模式(Iterator)