UPDATE: Take a look at this Xposed Module by @itandy, it'll give you the same results of this modded APK and it's easier to install (since you need only Xposed Installer). Also, it'll work in any Android version available for Xperia M, while this modded APK will work only in stock 4.2.2 ROM
As you guys may already know, Stamina Mode is a power management state included with many Xperia phones that improves battery life up to 4 times by disabling background apps/processes when the screen is locked and automatically enabling them again when screen is unlocked. However, when Stamina mode is enabled, the LED notifications are completely disabled or replaced with a generic three-time white LED notification, depending of the Android version running in your Xperia.
Third-party apps (like Light Flow) are completely disabled in Stamina Mode, even if you whitelist it. So, based on the info posted by @quisvir I managed to mod SuperStamina.apk from Xperia M dual. The APK used on Android 4.2 based ROMs seems to be different, so, the enableLeds() call isn't present in the decompiled smali. Using the modded version quisvir made for Xperia SP causes boot loops on Xperia M dual (C2004/C2005), so I researched a little and after some tests, I got the changes working...
The only file that was modified in this mod is smali/com/sonymobile/superstamina/xssm/Xssm.smali, where I removed these lines from the method setPowerStateLocked:
I tested the modded APK in Xperia M dual (C2004/C2005) running 4.2.2 and it works flawlessly, even with third-party apps, but it should work with any Xperia running stock ROM based on Android 4.2. It won't work in Xperia M (C1904/C1905) unless you have crossflashed it with 4.2.2 firmware from Xperia M dual. It'll also won't work in 4.3 firmware. If you have Xperia M running 4.1 and don't want to crossflash, the Xperia SP version from quisvir may work.
To install the mod, you'll need root access and a file manager (like Root Explorer or ES File Manager) to replace the original APK in /system/app. Also, make sure to set permissions to 0644. After that, reboot your phone and your LED notifications should work even with Stamina Mode on.
As you guys may already know, Stamina Mode is a power management state included with many Xperia phones that improves battery life up to 4 times by disabling background apps/processes when the screen is locked and automatically enabling them again when screen is unlocked. However, when Stamina mode is enabled, the LED notifications are completely disabled or replaced with a generic three-time white LED notification, depending of the Android version running in your Xperia.
Third-party apps (like Light Flow) are completely disabled in Stamina Mode, even if you whitelist it. So, based on the info posted by @quisvir I managed to mod SuperStamina.apk from Xperia M dual. The APK used on Android 4.2 based ROMs seems to be different, so, the enableLeds() call isn't present in the decompiled smali. Using the modded version quisvir made for Xperia SP causes boot loops on Xperia M dual (C2004/C2005), so I researched a little and after some tests, I got the changes working...
The only file that was modified in this mod is smali/com/sonymobile/superstamina/xssm/Xssm.smali, where I removed these lines from the method setPowerStateLocked:
Code:
iget-object v0, p0, Lcom/sonymobile/superstamina/xssm/Xssm;->mService:Lcom/sonymobile/superstamina/XperiaPowerService;
invoke-virtual {v0, v13}, Lcom/sonymobile/superstamina/XperiaPowerService;->enableLedsOverride(Z)V
I tested the modded APK in Xperia M dual (C2004/C2005) running 4.2.2 and it works flawlessly, even with third-party apps, but it should work with any Xperia running stock ROM based on Android 4.2. It won't work in Xperia M (C1904/C1905) unless you have crossflashed it with 4.2.2 firmware from Xperia M dual. It'll also won't work in 4.3 firmware. If you have Xperia M running 4.1 and don't want to crossflash, the Xperia SP version from quisvir may work.
To install the mod, you'll need root access and a file manager (like Root Explorer or ES File Manager) to replace the original APK in /system/app. Also, make sure to set permissions to 0644. After that, reboot your phone and your LED notifications should work even with Stamina Mode on.
Attachments
Last edited: