Correctly serialize class loader context for "any" SDK version to JSON.

Previously "any" was serialized as its numeric value, 10000. But other
code in makefiles and scripts expects string "any", and dexpreopt.config
files generated by Make (for Android.mk modules) have "any" not 10000.

Bug: 214255490
Test: lunch aosp_cf_x86_64_phone-userdebug && m && launch_cvd \
    && adb wait-for-device && adb root \
    && adb logcat | grep -E 'ClassLoaderContext [a-z ]+ mismatch'
    # empty output, no errors at boot
Change-Id: Id5e80eb8a90d9786b5cb999c172aaecb44952f76
This commit is contained in:
Ulya Trafimovich
2022-04-27 17:51:49 +01:00
parent a465e28bcb
commit 91f015e73e
2 changed files with 35 additions and 0 deletions

View File

@@ -678,6 +678,9 @@ func toJsonClassLoaderContext(clcMap ClassLoaderContextMap) jsonClassLoaderConte
jClcMap := make(jsonClassLoaderContextMap)
for sdkVer, clcs := range clcMap {
sdkVerStr := fmt.Sprintf("%d", sdkVer)
if sdkVer == AnySdkVersion {
sdkVerStr = "any"
}
jClcMap[sdkVerStr] = toJsonClassLoaderContextRec(clcs)
}
return jClcMap