Don't write nonexistent DEX file paths to dexpreopt.config files.
A path to an nonexistent file caused dex2oat to write an empty path in the class loader context stored inside of the OAT/ODEX file, which resulted in class loader context mistmatch and a failure to load dexpreopt code on device. An example of a faulty class loader context for GoogleDialer, can be seen either with oatdump or by grepping logcat for class loader context mimatch messages (the first empty PCL[] is expected, note the second empty PCL[] in the subcontext for shared libraries): PCL[]{PCL[]#PCL[/system/framework/org.apache.http.legacy.jar*22205474] This CL removes the nonexistent path from the generated dexpreopt.config file, which works in conjunction with a change in makefiles that stops using the removed config field. This is possible because makefiles can access DEX files using a module name and "intermediates-dir-for" macro. Bug: 132357300 Test: lunch cf_x86_64_phone-userdebug && m && launch_cvd \ adb wait-for-device && adb root && adb logcat \ | grep -E 'ClassLoaderContext [a-z ]+ mismatch' # empty grep output, no errors Change-Id: I8d16f77c6f76ad6234cc4114ad3545cbe572ef13
This commit is contained in:
@@ -129,8 +129,6 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr
|
||||
|
||||
dexLocation := android.InstallPathToOnDevicePath(ctx, d.installPath)
|
||||
|
||||
buildPath := android.PathForModuleOut(ctx, "dexpreopt", ctx.ModuleName()+".jar").OutputPath
|
||||
|
||||
providesUsesLib := ctx.ModuleName()
|
||||
if ulib, ok := ctx.Module().(ProvidesUsesLib); ok {
|
||||
name := ulib.ProvidesUsesLib()
|
||||
@@ -146,7 +144,6 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr
|
||||
slimDexpreoptConfig := &dexpreopt.ModuleConfig{
|
||||
Name: ctx.ModuleName(),
|
||||
DexLocation: dexLocation,
|
||||
BuildPath: buildPath,
|
||||
EnforceUsesLibraries: d.enforceUsesLibs,
|
||||
ProvidesUsesLibrary: providesUsesLib,
|
||||
ClassLoaderContexts: d.classLoaderContexts,
|
||||
@@ -218,7 +215,7 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr
|
||||
dexpreoptConfig := &dexpreopt.ModuleConfig{
|
||||
Name: ctx.ModuleName(),
|
||||
DexLocation: dexLocation,
|
||||
BuildPath: buildPath,
|
||||
BuildPath: android.PathForModuleOut(ctx, "dexpreopt", ctx.ModuleName()+".jar").OutputPath,
|
||||
DexPath: dexJarFile,
|
||||
ManifestPath: d.manifestFile,
|
||||
UncompressedDex: d.uncompressedDex,
|
||||
|
Reference in New Issue
Block a user