Notes

Notes


So just a quick note to 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?). 

What I found fixed the issue was to 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, 
so it's causing huge idle drain usage)

How to:

# If you have root/magisk:
1. Open terminal and enter the following commands (allow the terminal for root in magisk when it asked):

su -c "cmd package bg-dexopt-job"

2. Just wait until it completed by itself (on Android 10 will display "Success", on Nougat-Pie it just a new prompt line)


# If you don't have root:
1. On your computer, enter the following commands in a console/terminal window:
adb shell
cmd package bg-dexopt-job


Disconnecting your phone will abort the process, it is completely safe to interrupt the process.
On non-rooted devices you might see an error like this "user 2000 nor current process has Android.permission.Update_Device_Stats"

The solution? The error is safe to ignore and you don't need to worry. 
If you're concerned you can run that command a second time and the error should not occur during the second run

Note : You can also do this after clean flash, after complete restore app from titanium backup/migrate or from Google (Play Store)


Curious what the code does? See here : 
https://android.googlesource.com/platform/frameworks/base.git/+/f7edab63d9358b9a4e0dbec3243f6db9f50a2bbe

credit : 
- tomascus @ xda-developers
- anupritaisno1 @ https://forums.oneplus.com/threads/charging-battery-performance-caches-and-battery-calibration-myths-busted.993896/


Report Page