I've already reviewed this code as part of the notifications-specific bug.  Please consider Wilson's comments in addition to mine when revising the notification code.

If you get the notification code landed, it will be easier to create clean pull requests for the battery stuff.