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:
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?
This is what dumpsys power
shows:
$ 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
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…