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-01为什么公共事业机构会偏爱 TiDB :TiDB 数据库在某省妇幼健康管理系统的应用
- 2024-04-26敏捷开发:想要快速交付就必须舍弃产品质量?
- 2024-04-26静态代码分析的这些好处,我竟然都不知道?
- 2024-04-26你在测试金字塔的哪一层?(下)
- 2024-04-26快刀斩乱麻,DevOps让代码评审也自动起来
- 2024-04-262024年最好用的10款ER图神器!
- 2024-04-2203-为啥大模型LLM还没能完全替代你?
- 2024-04-2101-大语言模型发展
- 2024-04-17基于SpringWeb MultipartFile文件上传、下载功能
- 2024-04-14个人开发者,Spring Boot 项目如何部署