Xposed Module To Fix MobileRadioActive Bug
Lollipop will be remembered as the Android version that introduced us to the world of Material Design, bringing on a rather significant change in how Android attempted presentation of UI. What Lollipop is also famous for is the numerous bugs it introduced to an OS that was very close to maturity, and ended up souring what was to be a pleasant UX change.
An Ugly Bug!
MobileRadioActive is amongst one of those bugs from Lollipop that has been affecting a lot of users, and is said to have been fixed in Android Marshmallow. In simple terms, the Android system would keep the mobile radio awake even after mobile data usage had been disabled, thereby causing the device to remain awake. XDA Senior Member Bazoocaze investigated the issue and gave us a lowdown on what was causing this bug:
After some investigation on the issue I found that the BatteryStats service was not receiving the radio power down notification. The investigation lead me to the NetworkManagementService.java, where I found that some code was discarding the radio power change notifications after the first radio power on.
The problem is that in NetworkManagementServer.java the notifyInterfaceClassActivity method is discarding the notifications of radio power change to the BatteryStats (via noteMobileRadioPowerState) if the fromRadio parameter is false after it’s being true some time before.
Even after a detailed analysis, it was unclear what is the real role of the fromRadio parameter. Changing it to true in the calling methods solved the issue in the testing unit (Sony Xperia ZL).
Reproducing this bug is rather simple. All the users have to do is enable mobile data, use it for a short while, and then disable it. After a some time, check for the “Mobile Data Active” time under the apps that were used, which should appear as significantly higher than your usage had been. As a confirmation, the “Cell Standby” option would also show high drain, sometimes even higher than your display’s power usage.
A Nice Fix!
Reddit user Chronophasia gives us a sample reproduction of this bug, wherein the browser was used for a few minutes only (left image).
Thankfully, XDA Senior Member Bazoocaze has found a fix for the issue. The fix originally comes as a modified CM12.1 build for the Sony Xperia ZL, but thanks to the patches submitted by the dev, it has also been adapted into a universal Xposed module by XDA Senior Member pyler. The fix module is still undergoing tests for further confirmation which is why it is not currently available in the Xposed repo. However, you can still grab the latest version from the forum thread. As an added bonus, a patch has also been submitted to the CyanogenMod for review and should make its way on to nightlies soon.
Edit: As pointed out by oshmoun in the comments below, the Xposed repo for this module is available afterall.
If you are amongst those suffering from this battery draining bug, give the Xposed module a spin and report back your results in the module thread!