[X Style (Pure) Q&A, Help & Troubleshooting] bv90andy:
Hello,

So I was on a rooted stock firmware and noticed Android OS keeping my phone awake a lot and drainig battery. I cleaned caches, nothing. I then clean flashed, the same.

Now I reflashed the stock image XT1572_CLARK_RETEU_6.0_MPHS24.49-18-3_cid7_subsidy-DEFAULT_CFC.xml.zip, even the BTFM.bin which I almost didn't notice, and locked the phone up.

And now even on the newest stock firmware for my region (unrooted) it's still doing it. Out of a night on my nightstand, with moto display off, Android OS kept the phone awake for 4 hours, taking about 10% of the battery.

I did a dumpsys power if it's at all helpful:

POWER MANAGER (dumpsys power)

Power Manager State:
mDirty=0x0
mWakefulness=Asleep
mWakefulnessChanging=false
mIsPowered=true
mPlugType=2
mBatteryLevel=89
mBatteryLevelWhenDreamStarted=0
mDockState=0
mStayOn=false
mProximityPositive=false
mBootCompleted=true
mSystemReady=true
mHalAutoSuspendModeEnabled=true
mHalInteractiveModeEnabled=false
mWakeLockSummary=0x0
mUserActivitySummary=0x0
mRequestWaitForNegativeProximity=false
mSandmanScheduled=false
mSandmanSummoned=false
mLowPowerModeEnabled=false
mBatteryLevelLow=false
mDeviceIdleMode=false
mDeviceIdleWhitelist=[10000, 10019]
mDeviceIdleTempWhitelist=[]
mLastWakeTime=28711674 (328144 ms ago)
mLastSleepTime=28760836 (278982 ms ago)
mLastUserActivityTime=28714835 (324983 ms ago)
mLastUserActivityTimeNoChangeLights=28600112 (439706 ms ago)
mLastInteractivePowerHintTime=28765970 (273848 ms ago)
mLastScreenBrightnessBoostTime=0 (29039818 ms ago)
mScreenBrightnessBoostInProgress=false
mDisplayReady=true
mHoldingWakeLockSuspendBlocker=false
mHoldingDisplaySuspendBlocker=false

Settings and Configuration:
mDecoupleHalAutoSuspendModeFromDisplayConfig=false
mDecoupleHalInteractiveModeFromDisplayConfig=true
mWakeUpWhenPluggedOrUnpluggedConfig=true
mWakeUpWhenPluggedOrUnpluggedInTheaterModeConfig=false
mTheaterModeEnabled=false
mSuspendWhenScreenOffDueToProximityConfig=true
mDreamsSupportedConfig=true
mDreamsEnabledByDefaultConfig=true
mDreamsActivatedOnSleepByDefaultConfig=false
mDreamsActivatedOnDockByDefaultConfig=true
mDreamsEnabledOnBatteryConfig=false
mDreamsBatteryLevelMinimumWhenPoweredConfig=-1
mDreamsBatteryLevelMinimumWhenNotPoweredConfig=15
mDreamsBatteryLevelDrainCutoffConfig=5
mDreamsEnabledSetting=true
mDreamsActivateOnSleepSetting=false
mDreamsActivateOnDockSetting=true
mDozeAfterScreenOffConfig=true
mLowPowerModeSetting=false
mAutoLowPowerModeConfigured=false
mAutoLowPowerModeSnoozing=false
mMinimumScreenOffTimeoutConfig=10000
mMaximumScreenDimDurationConfig=7000
mMaximumScreenDimRatioConfig=0.20000005
mScreenOffTimeoutSetting=60000
mSleepTimeoutSetting=-1
mMaximumScreenOffTimeoutFromDeviceAdmin=2147483647 (enforced=false)
mStayOnWhilePluggedInSetting=0
mScreenBrightnessSetting=77
mScreenAutoBrightnessAdjustmentSetting=0.03515625
mScreenAutoBrightnessAdjustmentOverrideFromWindowManager=NaN
mScreenBrightnessModeSetting=1
mScreenBrightnessOverrideFromWindowManager=-1
mUserActivityTimeoutOverrideFromWindowManager=10000
mTemporaryScreenBrightnessSettingOverride=-1
mTemporaryScreenAutoBrightnessAdjustmentSettingOverride=NaN
mDozeScreenStateOverrideFromDreamManager=0
mDozeScreenBrightnessOverrideFromDreamManager=-1
mScreenBrightnessSettingMinimum=3
mScreenBrightnessSettingMaximum=255
mScreenBrightnessSettingDefault=77
mDoubleTapWakeEnabled=false

Sleep timeout: -1 ms
Screen off timeout: 10000 ms
Screen dim duration: 2000 ms

UID states:
UID 1000: 0
UID 1001: 0
UID 1027: 0
UID 1037: 16
UID u0a0: 6
UID u0a2: 0
UID u0a8: 16
UID u0a10: 16
UID u0a15: 16
UID u0a17: 10
UID u0a19: 3
UID u0a24: 16
UID u0a29: 10
UID u0a30: 10
UID u0a32: 10
UID u0a33: 6
UID u0a34: 6
UID u0a37: 10
UID u0a44: 6
UID u0a47: 0
UID u0a49: 3
UID u0a57: 16
UID u0a60: 5
UID u0a69: 16
UID u0a71: 16
UID u0a76: 5
UID u0a82: 7
UID u0a89: 10
UID u0a95: 16
UID u0a101: 16
UID u0a102: 12
UID u0a104: 16
UID u0a106: 10
UID u0a115: 16
UID u0a121: 16
UID u0a132: 10
UID u0a138: 16
UID u0a154: 16
UID u0a170: 16
UID u0a171: 6
UID u0a173: 4
UID u0a175: 10
UID u0a185: 16
UID u0a193: 16
UID u0i8: 15
UID u0i9: 5

Wake Locks: size=0

Suspend Blockers: size=4
PowerManagerService.WakeLocks: ref count=0
PowerManagerService.Display: ref count=0
PowerManagerService.Broadcasts: ref count=0
PowerManagerService.WirelessChargerDetector: ref count=0

Display Power: state=OFF

Wireless Charger Detector State:
mGravitySensor={Sensor name="Gravity", vendor="Motorola", version=1, type=9, maxRange=9.80665, resolution=2.9928435E-4, power=5.65, minDelay=10000}
mPoweredWirelessly=false
mAtRest=false
mRestX=0.0, mRestY=0.0, mRestZ=0.0
mDetectionInProgress=false
mDetectionStartTime=0 (never)
mMustUpdateRestPosition=false
mTotalSamples=0
mMovingSamples=0
mFirstSampleX=0.0, mFirstSampleY=0.0, mFirstSampleZ=0.0
mLastSampleX=0.0, mLastSampleY=0.0, mLastSampleZ=0.0

If anyone could help out I'd be grateful.