Fix for CB-4519 and CB-4520, clean-up indenting

Instead of checking for battery level of exactly 20% or 5%, compare the
last known level to the current level and fire appropriate events if
the change crosses the 20% or 5% threshold. Should be a bit more
reliable. Also, only fires when level change is a decrease, so the
event won’t fire (unnecessarily) if the battery is charging or the
level increases for any other reason.