本文介绍了如何查看哪些唤醒锁处于活动状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于某种原因,我的 Android 手机无法进入睡眠状态.我假设唤醒锁使其保持唤醒状态,但无法判断哪些唤醒锁处于活动状态.正在运行的服务没有列出任何可疑的东西,当然也和平常没有什么不同.所以我的问题是:

For some reason my Android phone won't go to sleep. I assume that a wakelock is keeping it awake, but there is no way to tell which wakelocks are active. The running services doesn't list anything suspicious, and certainly nothing different from usual. So my questions are:

  1. Android 一定会在进程结束时释放唤醒锁吗?是否有可能应用程序编写不当并且在退出前没有释放唤醒锁?

  1. Does Android definitely release wakelocks when a process ends? Is it possible an app was badly written and didn't release a wakelock before exiting?

有什么办法可以看到活动的唤醒锁吗?

Is there any way to see the active wakelocks?

这是dumpsys power 显示的内容:

$ dumpsys power
Power Manager State:
  mIsPowered=true mPowerState=0 mScreenOffTime=226093 ms
  mPartialCount=0
  mWakeLockState=
  mUserState=
  mPowerState=
  mLocks.gather=
  mNextTimeout=91922738 now=92136117 -213s from now
  mDimScreen=true mStayOnConditions=0
  mScreenOffReason=3 mUserState=0
  mBroadcastQueue={-1,-1,-1}
  mBroadcastWhy={0,0,0}
  mPokey=1 mPokeAwakeonSet=false
  mKeyboardVisible=false mUserActivityAllowed=false
  mKeylightDelay=6000 mDimDelay=47000 mScreenOffDelay=7000
  mPreventScreenOn=false  mScreenBrightnessOverride=-1  mButtonBrightnessOverride=-1
  mScreenOffTimeoutSetting=60000 mMaximumScreenOffTimeout=2147483647
  mLastScreenOnTime=0
  mBroadcastWakeLock=UnsynchronizedWakeLock(mFlags=0x1 mCount=0 mHeld=false)
  mStayOnWhilePluggedInScreenDimLock=UnsynchronizedWakeLock(mFlags=0x6 mCount=0 mHeld=false)
  mStayOnWhilePluggedInPartialLock=UnsynchronizedWakeLock(mFlags=0x1 mCount=0 mHeld=false)
  mPreventScreenOnPartialLock=UnsynchronizedWakeLock(mFlags=0x1 mCount=0 mHeld=false)
  mProximityPartialLock=UnsynchronizedWakeLock(mFlags=0x1 mCount=0 mHeld=false)
  mProximityWakeLockCount=0
  mProximitySensorEnabled=false
  mProximitySensorActive=false
  mProximityPendingValue=-1
  mLastProximityEventTime=0
  mLightSensorEnabled=false
  mLightSensorValue=-1.0 mLightSensorPendingValue=-1.0
  mLightSensorScreenBrightness=35 mLightSensorButtonBrightness=255 mLightSensorKeyboardBrightness=0
  mUseSoftwareAutoBrightness=true
  mAutoBrightessEnabled=false
  mScreenBrightness: animating=false targetValue=-1 curValue=0.0 delta=-1.3333334

mLocks.size=0:

mPokeLocks.size=1:
    poke lock 'PhoneApp': POKE_LOCK_IGNORE_CHEEK_EVENTS

推荐答案

在新版本的 Android 中,您可以在此处查看唤醒锁列表:

In new versions of Android you can see list of wakelocks here:

adb shell "cat /sys/kernel/debug/wakeup_sources"

这篇关于如何查看哪些唤醒锁处于活动状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 10:08