by Ron Deagle
This is just a simple flow to change the device data rate between 2G/3G/4G/LTE and 2G, in order to save as much power as possible (or better stated, not waste unnecessary power). depending on 1) whether the device is locked or unlocked, 2) whether data connection is enabled or disabled, and 3) the current Power Save state.
12 Jun 2016: Experienced failure to set Power Save state while device charges (illegal operation; Android Power Save automatically turns off when charging). Added Power Connection sense loop to avoid this in the future. Also modified "unlocked" data rate to accept 2G/3G/4G, instead of only 4G.
13 Jun: Added CPU governor blocks to restrict CPU usage when device is locked.
Edit: Removed CPU governor blocks. Abnormal behavior on Z5c.
16 Jun: Eliminate redundancy