赞
踩
在PowerManagerService中
mWakeLockSuspendBlocker 是控制CPU休眠的锁。
mDisplaySuspendBlocker 是控制显示开关的锁。
通过查看文件,亮屏时看到的也是这两个锁:
# cat /sys/power/wake_lock
PowerManagerService.Display PowerManagerService.WakeLocks
当按下电源键,会调用goToSleep—>goToSleepInternal —>goToSleepNoUpdateLocked—>updatePowerStateLocked;
当Activity用户无操作活动超时,会调用handleUserActivityTimeout—>updatePowerStateLocked—>;
最终走的都是updatePowerStateLocked
frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
@Override // Binder call
public void goToSleep(long eventTime, int reason, int flags) {
+ if(true){
+ return;
+ }
if (eventTime > SystemClock.uptimeMillis()) {
throw new IllegalArgumentException("event time must not be in the future");
}
frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
/**
* Updates the suspend blocker that keeps the CPU alive.
*
* This function must have no other side-effects.
*/
private void updateSuspendBlockerLocked() {
+ if (SystemProperties.getBoolean("sys.pms.holding_wake_lock", false)){
+ Slog.d(TAG, "Holding wake lock suspend blocker");
+ return;
+ }
+
// Then release suspend blockers if needed.
if (!needWakeLockSuspendBlocker && mHoldingWakeLockSuspendBlocker) {
mWakeLockSuspendBlocker.release();
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。