• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[DOZE] Enable Android DOZE on MIUI ROMS

Search This thread

asusm930

Senior Member
Oct 10, 2009
496
282
FROGGSVILE SWAMP
Some MIUI ROM/Custom ROMS do not have doze enabled and this is due to Xiaomi disabling doze on China STABLE/BETA builds because they don't have to comply to google standards as of now. There has been some reports that some China based custom MIUI roms do have doze enabled and that is simply because roms like Xiaomi.eu and others do some mix and matching between the GLOBAL BETA builds and CHINA BETA builds to get best performance out of their roms. It explains why doze is enabled. I have personally decompiled the framework-res of both the Xiaomi.EU and MultiROM roms and found that on Xiaomi.EU the value
Code:
bool name="config_enableAutoPowerModes">true</bool>
is set true (doze enabled) On MultiROM its the opposite. You guys can go ahead and check on your own. To remind you folks, if you use Better Battery Stats (BBS), the Doze Interactive stat means the amount of time the device IS NOT DOZING. That value in no way shows that doze is working. Instead look for Doze Idle stat. No Doze Idle stat, then no doze. MultiROM on the other hand bases its roms solely on the China builds which explains why their roms don't doze at all.

So how did I enable/fix doze? MIUI has this feature when it lets theme make overlays on certain values of files and apk in their rom. In this case its framework-res.apk. With the help of a template that I got from here http://en.miui.com/thread-387638-1-1.html I edited the files to apply the correct values on framework-res.apk to enable doze. I also tried to edit navbar size using this method but it didnt work :angel: but the doze tweak DEFINITELY works. So it pretty much confirms that it only works on certain parts of the code/certain APKs. There is a similar concept on AOSP android called RRO/Overlays. But its much more complicated You'll need to det up an environment and compile apk etc...thats not possible because we dont have source code rofl. It's better to use what I have here.

So how do we apply this tweak? Download this file and put it into system/media/theme/default and reboot.
https://drive.google.com/open?id=0B_Q4QjvbODxodTRhQnJVeURubUU

to get doze kicking in faster/faster doze time (instead of the 30 minutes that android sets default) install doze editor and choose the last profile. You can uninstall the app after that because the value sticks/is saved somewhere else.

and of course you'll need to be rooted

Hope this is any help to any of you

Interested in how doze works and its requirements? look here https://source.android.com/devices/tech/power/mgmt.html#doze-reqs
 
Last edited:

longnt2007

Senior Member
Nov 2, 2015
100
139

Attachments

  • Screenshot_20170220-221441.png
    Screenshot_20170220-221441.png
    52.6 KB · Views: 4,609
  • Like
Reactions: nofx161

asusm930

Senior Member
Oct 10, 2009
496
282
FROGGSVILE SWAMP
There is an app to check Doze config flag in framework-res.apk
https://forum.xda-developers.com/android/apps-games/app-check-doze-support-t3374265

For RMN4 AOSP rom, just decompile framework-res.apk, set config_enableAutoPowerModes from false to true, recompile and install back to system then you will have Doze enabled AOSP rom like me :)

I tried that and I gave up because every time I replaced the recompiled apk, the phone wouldn't boot lol.

Can you recommend a better way to decompile and recompile MIUI apks?
 

longnt2007

Senior Member
Nov 2, 2015
100
139
I tried that and I gave up because every time I replaced the recompiled apk, the phone wouldn't boot lol.

Can you recommend a better way to decompile and recompile MIUI apks?

If you want modify system apk, the first thing you must do is remove signature check in PackageManagerService.smali (compareSignatures func) of services.jar.

Here is the guide but can appy to any rom, just modify compareSignatures func like that guide. To decompile and recompile apk, I'm using apktool 2.1.1 and it's work fine with AOSP rom of RMN4.
https://forum.xda-developers.com/showthread.php?t=1698352
 
  • Like
Reactions: ssojyeti2

Dovidhalevi

Senior Member
Jun 26, 2012
2,729
1,171
Seems we have our own doze-like operation. Battery life on this phone is stellar. The app/battery management is highly customizable and effective.
 

realista87

Senior Member
Sep 3, 2011
779
96
marche
ok, i recently discovered the L-speed app.
in battery menu i see "doze iptimization"
- aggressive doze
- light doze optimization

do they enable THE SAME your trick? or something else?
i don't even know it l-speed is fully compatible for my globerom ( derived from xiaomi.eu)
 
  • Like
Reactions: bydal and abhis3k

asusm930

Senior Member
Oct 10, 2009
496
282
FROGGSVILE SWAMP
ok, i recently discovered the L-speed app.
in battery menu i see "doze iptimization"
- aggressive doze
- light doze optimization

do they enable THE SAME your trick? or something else?
i don't even know it l-speed is fully compatible for my globerom ( derived from xiaomi.eu)

L speed's Aggressive doze simply forces the device to enter doze whenever screen is off.

A user has has tested the app on a non-doze FLAG enabled MIUI rom (in this case multirom) and it worked for him. The app simply forces doze mode.

The light doze optimization changes around the doze timouts etc to save a bit more battery. A user has tested L-Speed on a rom without doze and it does enable it. My problem with using a separate app is it can get killed (even worse on MIUI because it likes to kill apps) and the feature/app wont work anymore.
 
Last edited:

gsmyth

Senior Member
Dec 16, 2010
2,428
768
Redmi Note 9 Pro
Redmi Note 9
L speed's Aggressive doze simply forces the device to enter doze whenever screen is off.

A user has has tested the app on a non-doze FLAG enabled MIUI rom (in this case multirom) and it worked for him. The app simply forces doze mode.

The light doze optimization changes around the doze timouts etc to save a bit more battery. A user has tested L-Speed on a rom without doze and it does enable it. My problem with using a separate app is it can get killed (even worse on MIUI because it likes to kill apps) and the feature/app wont work anymore.
Great work @asusm930, made the XDA news!
https://twitter.com/xdadevelopers/status/834356065596821504

Sent from my Redmi Note 4 using Tapatalk
 
Last edited:

d_borghi

Senior Member
Mar 3, 2012
163
3
Hi all,
This thread talks about a problem similar of mine.

i've made a stupid thing.
I've found this article:
xxx.androidworld.it/forum/guide-e-tutorial-11/%5Bguida%5D-come-abilitare-android-doze-sulle-rom-miui-211382/#post1722713

where there is a tutorial to activate doze on miui.
i downloaded the framework-res and place it in system/media/theme/default.
reboot
then i find that every 30 minutes of screen off, apps went killed, but tasker too, and i need tasker always active.

then i delete the framework-res and reboot it.
after that, every 30 minutes of screen off, apps are killed too, tasker too.
then i try to install over the miui ita, the new build of miui ita, but nothing changes.
how can i make tasker always active?

sorry for my poor english.

db
 

deathkid13

Senior Member
Mar 11, 2015
184
80
I can confirm that this works for RMN4 AOSP.

---------- Post added at 08:25 AM ---------- Previous post was at 08:24 AM ----------

As for the steps, there's a bit of a condition that you need to complete before it starts working as intended
 

tweakradje

Senior Member
Mar 18, 2005
1,071
539
Android
sites.google.com
Does this works too to doze directly after screen off?

<bool name="config_dozeAfterScreenOff">false</bool>

<bool name="config_dozeAfterScreenOff">true</bool>

Cheers

EDIT: Never mind. This is for Screen Doze (ambient screen)
 
Last edited:

solis_f

Senior Member
Mar 26, 2015
1,000
578
Some MIUI ROM/Custom ROMS do not have doze enabled and this is due to Xiaomi disabling doze on China STABLE/BETA builds because they don't have to comply to google standards as of now. There has been some reports that some China based custom MIUI roms do have doze enabled and that is simply because roms like Xiaomi.eu and others do some mix and matching between the GLOBAL BETA builds and CHINA BETA builds to get best performance out of their roms. It explains why doze is enabled. I have personally decompiled the framework-res of both the Xiaomi.EU and MultiROM roms and found that on Xiaomi.EU the value is set true (doze enabled) On MultiROM its the opposite. You guys can go ahead and check on your own. To remind you folks, if you use Better Battery Stats (BBS), the Doze Interactive stat means the amount of time the device IS NOT DOZING. That value in no way shows that doze is working. Instead look for Doze Idle stat. No Doze Idle stat, then no doze. MultiROM on the other hand bases its roms solely on the China builds which explains why their roms don't doze at all.

So how did I enable/fix doze? MIUI has this feature when it lets theme make overlays on certain values of files and apk in their rom. In this case its framework-res.apk. With the help of a template that I got from here http://en.miui.com/thread-387638-1-1.html I edited the files to apply the correct values on framework-res.apk to enable doze. I also tried to edit navbar size using this method but it didnt work :angel: but the doze tweak DEFINITELY works. So it pretty much confirms that it only works on certain parts of the code/certain APKs. There is a similar concept on AOSP android called RRO/Overlays. But its much more complicated You'll need to det up an environment and compile apk etc...thats not possible because we dont have source code rofl. It's better to use what I have here.

So how do we apply this tweak? Download this file and put it into system/media/theme/default and reboot.
https://drive.google.com/open?id=0B_Q4QjvbODxodTRhQnJVeURubUU

to get doze kicking in faster/faster doze time (instead of the 30 minutes that android sets default) install doze editor and choose the last profile. You can uninstall the app after that because the value sticks/is saved somewhere else.

and of course you'll need to be rooted

Hope this is any help to any of you

Interested in how doze works and its requirements? look here https://source.android.com/devices/tech/power/mgmt.html#doze-reqs
Hello there and good job on this. Something I noticed and you might have an insight on this. If you disable miui optimization or through Naptime app you can access the battery optimization settings. In all aosp roms everything is flagged as optimized. In all MIUI roms a very large amount of apps is not optimized and in my understanding they are not "dozing well" when not optimized. I can do this by myself manual, but I'm searching for a more automated way here since they are a lot off apps. Thanks in advance!
 

asusm930

Senior Member
Oct 10, 2009
496
282
FROGGSVILE SWAMP
Hello there and good job on this. Something I noticed and you might have an insight on this. If you disable miui optimization or through Naptime app you can access the battery optimization settings. In all aosp roms everything is flagged as optimized. In all MIUI roms a very large amount of apps is not optimized and in my understanding they are not "dozing well" when not optimized. I can do this by myself manual, but I'm searching for a more automated way here since they are a lot off apps. Thanks in advance!

Hold on. Not all apps are optimized even on AOSP. Some google apps, for example, aren't optimized.

As for automating the process, there's nothing we can do. I found this to be frustrating too :(
 

solis_f

Senior Member
Mar 26, 2015
1,000
578
Hold on. Not all apps are optimized even on AOSP. Some google apps, for example, aren't optimized.

As for automating the process, there's nothing we can do. I found this to be frustrating too :(
Yes but on aosp is 2-3 apps which can't be optimized. In miui there are a huge amount that can be and are not optimized. Check for yourself when you have time... Install naptime and go to battery optimization
 

Top Liked Posts

  • There are no posts matching your filters.
  • 24
    Some MIUI ROM/Custom ROMS do not have doze enabled and this is due to Xiaomi disabling doze on China STABLE/BETA builds because they don't have to comply to google standards as of now. There has been some reports that some China based custom MIUI roms do have doze enabled and that is simply because roms like Xiaomi.eu and others do some mix and matching between the GLOBAL BETA builds and CHINA BETA builds to get best performance out of their roms. It explains why doze is enabled. I have personally decompiled the framework-res of both the Xiaomi.EU and MultiROM roms and found that on Xiaomi.EU the value
    Code:
    bool name="config_enableAutoPowerModes">true</bool>
    is set true (doze enabled) On MultiROM its the opposite. You guys can go ahead and check on your own. To remind you folks, if you use Better Battery Stats (BBS), the Doze Interactive stat means the amount of time the device IS NOT DOZING. That value in no way shows that doze is working. Instead look for Doze Idle stat. No Doze Idle stat, then no doze. MultiROM on the other hand bases its roms solely on the China builds which explains why their roms don't doze at all.

    So how did I enable/fix doze? MIUI has this feature when it lets theme make overlays on certain values of files and apk in their rom. In this case its framework-res.apk. With the help of a template that I got from here http://en.miui.com/thread-387638-1-1.html I edited the files to apply the correct values on framework-res.apk to enable doze. I also tried to edit navbar size using this method but it didnt work :angel: but the doze tweak DEFINITELY works. So it pretty much confirms that it only works on certain parts of the code/certain APKs. There is a similar concept on AOSP android called RRO/Overlays. But its much more complicated You'll need to det up an environment and compile apk etc...thats not possible because we dont have source code rofl. It's better to use what I have here.

    So how do we apply this tweak? Download this file and put it into system/media/theme/default and reboot.
    https://drive.google.com/open?id=0B_Q4QjvbODxodTRhQnJVeURubUU

    to get doze kicking in faster/faster doze time (instead of the 30 minutes that android sets default) install doze editor and choose the last profile. You can uninstall the app after that because the value sticks/is saved somewhere else.

    and of course you'll need to be rooted

    Hope this is any help to any of you

    Interested in how doze works and its requirements? look here https://source.android.com/devices/tech/power/mgmt.html#doze-reqs
    2
    ok, i recently discovered the L-speed app.
    in battery menu i see "doze iptimization"
    - aggressive doze
    - light doze optimization

    do they enable THE SAME your trick? or something else?
    i don't even know it l-speed is fully compatible for my globerom ( derived from xiaomi.eu)
    2
    thanks man. have you tried updating to the latest 7.3.30? I already downloaded the file but I read somewhere in the MIUI forum that the stock camera app did not work after they update.

    btw their unit is redmi note 3 and 4G, not sure with our nikel if it has the same bug.

    I was on the stable multirom and had updated to the latest a few weeks ago. It was generally very good but I did have issues with the gallery and camera app lagging/freezing which seemed to appear after the last update, which was a bit annoying. So a few nights ago I decided to switch to the xiaomi.eu weekly (7.3.23) rom. So far I think its looking like the best rom I have used out of everything in terms of stability and battery life. Doze is working without any mods (as it does on the global dev roms), I dont use root and havent made any other significant changes at all. I'll try to attach my current gsam battery stats, currently at 50% remaining. I also prefer the way the xiaomi eu orm is based of the beta/dev rom as it doesnt vibrate when unlocking with fingerprint scanner, not a big deal just a personal preference.

    I'm not a heavy user and typically tend to use wifi 90% of the time and so use 'prefer 2G' connection with a bit of 3G if needed. I dont play a lot of games but use viber, facebook messenger, whatsapp, hangouts, chrome browsing, tapatalk (XDA), youtube, spotify, flamingo (twitter), metal (for facebook), miui official forum app, relay for reddit on a daily basis.
    494e34f20ecab0c00a436b93a01a7c77.jpg


    0ca216e1f32f0ffbd933b13c40365712.jpg


    51ab9c767e767ee146452eeee16530c0.jpg


    Last screen shot of battery stats before going on the charger, never seen this battery life before on my Note 4, will be sticking with this ROM.

    aa11f2c67029114064b506217c20d43c.jpg
    1
    There is an app to check Doze config flag in framework-res.apk
    https://forum.xda-developers.com/android/apps-games/app-check-doze-support-t3374265

    For RMN4 AOSP rom, just decompile framework-res.apk, set config_enableAutoPowerModes from false to true, recompile and install back to system then you will have Doze enabled AOSP rom like me :)
    1
    MIUI Global Stable ROM is Doze enabled right?

    Yes