In order to fulfill the basic functions of our service, the user hereby agrees to allow Xiaomi to collect, process and use personal information which shall include but not be limited to written threads, pictures, comments, replies in the Mi Community, and relevant data types listed in Xiaomi's Private Policy. By selecting "Agree", you agree to Xiaomi's Private Policy and Content Policy .
Agree

GeekLab

[Tips & Guides] [MIUI with Tom #8] FIX battery Drain in MIUI - after OTA or after reset to factory settings!

2020-01-24 02:02:09
14387 75


Hello MIUI Fan's!
Probably each of you was faced with high battery consumption in the first 3-4 days after updating or flashing the device, the android system is the first in the list of consumption and has 30-40% of use! This guide will help to remove this problem.
It should be after flashing or installing updates on older versions of Android starting from 6 and below.
You have encountered such a system dialog as "Optimizing app xx from xx"

In Android 7.0, did they hide this from the user's eyes or delete it? Does this mean that the optimization has been removed? No, this is not such. This option was not lost, but simply postponed, and the postponement of this task causes the battery to run out. Do you think that optimization is happening in the background? The answer is not correct. It only starts under special conditions. Lack of this optimization will drain the battery. Optimization is not performed because we do not know how to fulfill the conditions necessary for its launch. The consequence of this is the accelerated discharge of the phone.



You can often watch how the Android system consumes energy more than other applications. This is the result of not allowing the system to optimize.
If in Android 6 and earlier optimization was forced, then starting with Android 7 and higher. A new option was added to skip this step and optimize applications on the fly (JIT, Just-In-Time) while using applications.
At the same time, the initial optimization has not been deleted and only starts if the following conditions are met:
  • the phone is connected to the charger,
  • fully charged,
  • turned on (the phone itself, not the screen),
  • is not used,
  • inactive (like after at least 30 minutes).

If these conditions are met, optimization begins.

Why do we need this optimization?

Because application developers cannot do this for each set of hardware and each device is already. It compiles applications into the most efficient code for its processor. So just use your device and let it take care of the cache itself or help your device make full optimization with simpl command.
Quick note
People who dirty flash a lot. You might randomly experience longer app launch times after flashing a ROM and the only apparent way to fix it was to do a clean flash. I experienced this a few times and decided to investigate and saw that it had something to do with how dex2oat works after you dirty flash (it refuses to optimise properly?).

You can manually run dex2oat on everything after it booted into the system, and after it has finished the process (could take super long depending on how many apps you have), everything went back to its speedy state.

(And it seems improve idle drain (big battery usage by system), because we're forcing doing task that only can run if some condition only, but also sometimes can unexpectedly happens while phone was idle, o it's causing huge idle drain usage)

Be that as it may, you have the option to force the optimization to run.

For users with root:
open a terminal emulator and execute (along with quotation marks, as this is part of the command):
su -c "cmd package bg-dexopt-job"

or

su

next

"cmd package bg-dexopt-job"



If you don’t have root, use ADB. Connect the phone to the device, make sure it is available (enable USB debugging and USB debugging secure settings). Open CMD ADB platform-tools platform-tools.zip (3.97 MB, Downloads: 454) and write command one by one
adb devices

Run the following command
adb shell cmd package bg-dexopt-job

or
adb shell "cmd package bg-dexopt-job"

If you have 10 android you will see Success, if from 7 to 9 a new line for entering the command will simply appear!


The process can take from 20 minutes to 3 hours (on my  MI 9t this operation take 40 minutes).
Disconnecting the device during optimization will interrupt the process, but will not harm the device. It is absolutely safe.
Users without root may find the error message
"user 2000 nor current process has Android.permission.Update_Device_Stats"

It’s not worth worrying, you can ignore it and run the command again.

Thanks to all!
Also Many Thanks to Admin!

Video explanation for RUSSIAN user.







Rate

Number of participants 5 Experience +38 Pack Reason

View Rating Log

2020-01-24 02:02:09
Favorites106 RateRate

Advanced Bunny

nikosmts | from MI CC9 Pro

#1

thank you for info and guide
2020-01-24 02:10:37

Grand Master Bunny

1860bodo | from Mi 9 Lite

#2

thanks for information
2020-01-24 02:44:35

Master Bunny

frost_dragneel | from Redmi Note 6 Pro

#3

thnks for the info
2020-01-24 02:47:37

Master Bunny

m_mese_mosi | from Mi 9T

#4

it's really working?
2020-01-24 03:02:30

Wizard Bunny

BeingBishal | from Mi 9T Pro

#5

Helpful Guide!
2020-01-24 03:14:12

Pro Bunny

1717255881 | from app

#6

thanks
2020-01-24 04:40:14

Wizard Bunny

Bart.ek1 | from Redmi 3S

#7

Great tutorial, thanks.
2020-01-24 05:14:33

Wizard Bunny

Ian Adoe | from Redmi Note 5A Prime

#8

Explained very well... 👍👍
2020-01-24 05:30:47

Master Bunny

608612795 | from app

#9

Thank you for your guide
2020-01-24 06:15:50

Master Bunny

Engr. farukh | from Redmi Note 8

#10

great to know
2020-01-24 06:23:32
please sign in to reply.
Sign In Sign Up

TomHenson

Super Moderador

Check-in 3 jours
Check-in 7 jours
Check-in 21 jours
Check-in 40 jours
Check-in 70 jours
Newbie Member
100 Коментарів
100 Тем
New Home
10k Mi Fans
Redmi Note 7
Cast Away
20K Mi Fans
Mi Love U & I
Bunny Winner
20K Mi Fans
Best Mi
Android Q
50K Mi Fans
Mobile Photography Lover
70K Mi Fans
Challenger
Eid ul-Fitr Mubarak
Brain Teaser
100K Mi Fans
Selfie Day
Mi 9T
Global Fans
My Country My Pride
Like
Check in
Reply
Favorites
Post
Profile Medal
MIUI 9th Birthday
Global Community
500
Redmi 7A
better together slogan
Global Community
games discuss
Mid-Autumn Festival
200K Mi Fans
400K Mi Fans
300K Mi Fans
2020
MIUI 11
close up
Halloween
Best Photo

Read moreGet new
Copyright©2010-2020 Xiaomi.com, All Rights Reserved
Content Policy
Quick Reply To Top Return to the list