FORUMS
Remove All Ads from XDA

[MOD][XPOSED][7.0+][N] OOS Background DEX Optimization Fix 0.1

622 posts
Thanks Meter: 383
 
By Fif_, Senior Member on 12th October 2017, 06:24 AM
Post Reply Email Thread
Warning
This module fixes a problem on OOS 4.5 devices that crash when Xposed 87.3, 88 or 88.1 is active.
The root cause of the problem has been fixed in Xposed 88.2, so you do not need this module with Xposed 88.2 or later.
If you are experiencing soft-reboots and/or crashes without Xposed installed, this module cannot help you.

Requirements
  • An OOS Device.running Nougat
  • Xposed (Official @rovo89 or systemless Magisk)

Description
If you're trying to run Xposed on OOS Devices, you may notice that every time your phone is left charging for a while, Android crashes with:
Code:
OPConfig:ConfigProvider: Module:BackgroundOptConfig
BackgroundDexOptService: blacklist add : com.chinamworld.main
BackgroundDexOptService: blacklist add : cn.kidyn.qdmedical160
BackgroundDexOptService: blacklist add : com.paic.zhifu.wallet.activity
BackgroundDexOptService: blacklist add : com.pingan.paces.ccms
BackgroundDexOptService: blacklist add : cn.damai
BackgroundDexOptService: blacklist add : com.baidu.carlife
BackgroundDexOptService: [OnlineConfig] BackgroundOpt updated complete
art : No implementation found for java.lang.String dalvik.system.DexFile.getOatFileCompilerFilter(java.lang.String, java.lang.String) (tried Java_dalvik_system_DexFile_getOatFileCompilerFilter and Java_dalvik_system_DexFile_getOatFileCompilerFilter__Ljava_lang_String_2Ljava_lang_String_2)
AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: BackgroundDexOptService_IdleOptimization
AndroidRuntime: java.lang.UnsatisfiedLinkError: No implementation found for java.lang.String dalvik.system.DexFile.getOatFileCompilerFilter(java.lang.String, java.lang.String) (tried Java_dalvik_system_DexFile_getOatFileCompilerFilter and Java_dalvik_system_DexFile_getOatFileCompilerFilter__Ljava_lang_String_2Ljava_lang_String_2)
AndroidRuntime: at dalvik.system.DexFile.getOatFileCompilerFilter(Native Method)
AndroidRuntime: at com.android.server.pm.PackageDexOptimizer.getOatFileCompilerFilter(PackageDexOptimizer.java:167)
AndroidRuntime: at com.android.server.pm.PackageManagerService.getOatFileCompilerFilter(PackageManagerService.java:19879)
AndroidRuntime: at com.android.server.pm.BackgroundDexOptService$3.run(BackgroundDexOptService.java:373)
DownloadManager: Removed 0 stale downloads
MDM_DropBox: record:system_server_crash
OSTracker: OS Event: system_server_crash
Then this module is for you.
Install, activate, reboot and crashes be gone.
This module has no UI.

Technical explanation
For some reason OnePlus has patched the Background Dex Optimization service. I think it's related to the aggressive optimization OOS 4.5 pushes (it uses the "speed" compiler filter everywhere) and also implements some filtering of some apps (see the blacklist add lines in the backtrace).
Note that the Background Dex Optimizer as shipped by OOS will not obey the pm.dexopt.bg-dexopt property and will always use "speed" irrespective of the pm.dexopt.bg-dexopt setting. Gah...
In their patching, OnePlus made the com.android.server.pm.PackageDexOptimizer.getOatFi leCompilerFilter() framework function call the dalvik.system.DexFile.getOatFileCompilerFilter() native function.
dalvik.system.DexFile.getOatFileCompilerFilter() is implemented in OOS by /system/lib64/libart.so.
And Xposed replaces /system/lib64/libart.so with its own version, which does not contain dalvik.system.DexFile.getOatFileCompilerFilter().
When the OOS phone is left charging and reaches 100% battery, a timer starts. 1h after reaching 100% battery, the Background Dex Optimization runs, and promptly crashes. Since this is in the Android system, the whole phone soft-reboots.

The module works by hooking com.android.server.pm.PackageDexOptimizer.getOatFi leCompilerFilter() and having it return null instead of calling the native method dalvik.system.DexFile.getOatFileCompilerFilter(). That's what the native method returns anyways, so no functionality should be lost.

Device Status
Working and tested on:
  • OnePlus 5 running OOS 4.5.12, Magisk 14.2 and Xposed 88.0.

Changelog
  • Release 0.1 on October 11, 2017
    • Initial release.

Download
httphttp://dl-xda.xposed.info/modules/com.fifsource.android.oosbackgroupdexcompilationfi x_v1_830eb4.apk (on Xposed Module Repository)

XDA:DevDB Information
OOS Background DEX Optimization Fix, Xposed for all devices (see above for details)

Contributors
Fif_
Xposed Package Name:

Version Information
Status: Beta
Current Beta Version: 0.1
Beta Release Date: 2016-10-11

Created 2017-10-12
Last Updated 2017-10-12
The Following 26 Users Say Thank You to Fif_ For This Useful Post: [ View ] Gift Fif_ Ad-Free
 
 
12th October 2017, 06:26 AM |#2  
OP Senior Member
Thanks Meter: 383
 
More
Attention beta testers:
Please let your device run on power overnight and send me the Xposed log file.
You should see many lines with the "OOSDEX" prefix.
12th October 2017, 09:44 AM |#3  
Senior Member
Thanks Meter: 96
 
More
Trying it now, thanks very much!
12th October 2017, 03:05 PM |#4  
steve51184's Avatar
Senior Member
Thanks Meter: 85
 
More
Does this effect mm at all or simply n?
12th October 2017, 04:08 PM |#5  
OP Senior Member
Thanks Meter: 383
 
More
I only found this problem on OOS 4.5.x, which is Nougat. The package won't install on anything but N or above. Did you experience a similar crash on a MM OOS ROM?
12th October 2017, 08:25 PM |#6  
gohan040's Avatar
Senior Member
Flag Eindhoven
Thanks Meter: 91
 
Donate to Me
More
Thank you!!! Really hope this works! Noticed this when my alarm didn't go off 2 days ago.. Last night I woke up a few times and when i looked at my phone it asked asked my code. This happened 3 times , so at least 3 reboots while on charger.
12th October 2017, 10:04 PM |#7  
HampTheToker's Avatar
Senior Member
Flag Murfreesboro
Thanks Meter: 449
 
Donate to Me
More
My 3T (running OB 15) charged just fine without crashing last night.

I guess it's a good thing that I'm sticking with it for now. OxygenOS open beta roms are about as close to perfect as it gets when you add magisk, xposed, and substratum. I love custom roms as much as anyone else, but OOS is hands down the best stock ROM. Remaining close to AOSP gives it the versatility that other stock roms lack.
12th October 2017, 10:28 PM |#8  
OP Senior Member
Thanks Meter: 383
 
More
Quote:
Originally Posted by HampTheToker

My 3T (running OB 15) charged just fine without crashing last night.

I guess it's a good thing that I'm sticking with it for now. OxygenOS open beta roms are about as close to perfect as it gets when you add magisk, xposed, and substratum. I love custom roms as much as anyone else, but OOS is hands down the best stock ROM. Remaining close to AOSP gives it the versatility that other stock roms lack.

I'm happy to hear that your phone didn't crash overnight. Did you have the module enabled?
If so, can you share your Xposed log from that night? Right now the module has lots of logging, which I will pare down later, but I'd like to check everything is working fine.
12th October 2017, 10:33 PM |#9  
dragoi90's Avatar
Senior Member
Flag Elbasan
Thanks Meter: 264
 
More
@Fif_ does your module work on v88.1?

Sent from my ONEPLUS A5000 using Tapatalk
12th October 2017, 10:46 PM |#10  
OP Senior Member
Thanks Meter: 383
 
More
Haven't tried, waiting for the systemless update for 88.1.
Given that the module is very simple, if Xposed 88.1 works for you, the module should work. Please report back and share your Xposed log in any case. Thanks.
12th October 2017, 11:33 PM |#11  
OP Senior Member
Thanks Meter: 383
 
More
I added a technical explanation to the project description, in case anyone's interested in understanding what happens.
Still no reports of success of failures, with 219 downloads so far. It's working fine for everyone I guess, or I'd hear more complaints...
The Following User Says Thank You to Fif_ For This Useful Post: [ View ] Gift Fif_ Ad-Free
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes