Now let us talk about how to force the optimisation to occur
Rooted users: run su -c "cmd package bg-dexopt-job" in a terminal emulator app.
The quotes are part of the command so do NOT remove them.
Non-rooted users: this should work
View attachment 966018
I believe an image is worth a thousand words
The command can take anywhere from 20 minutes to 3 hours to complete
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
Curious what this command does? Read the code
https://android.googlesource.com/platform/frameworks/base.git/ /f7edab63d9358b9a4e0dbec3243f6db9f50a2bbe
If you have at least 50% of storage free and have lots of time
adb shell cmd package compile -m everything -f -a
Be warned that this will compile everything as AOT, potentially using a lot of storage and any benefit from this will only be seen from P onwards
"cmd package" can be replaced by "pm"
"pm bg-dexopt-job" is the same as "cmd package bg-dexopt-job" and "pm compile -m everything -f -a" is the same as "cmd package compile -m everything -f -a"
Click to expand...