Check whether the APK has code before recording JIT profile information.
In the past, Package Manager created empty profile files for APKs that
have code, and the runtime did a file existence check (removed by
aosp/2407152). With ART Service, no empty profile files are created, so
we have no clue whether the APK has code or not.
After this change, the runtime opens the APK to check whether the APK
has code or not.
This change prevents the runtime from writing bootclasspath profiling
info to profile files for APKs that have no code. Such files are not
suitable for bootclasspath profiling because ART Service has a file GC
that cleans them up during daily bg dexopt.
This change admittedly makes `Runtime::RegisterAppInfo` slower because
it takes some time to open the APK, but in practice, it's okay because
Framework creates a classloader for the APK right after calling
`Runtime::RegisterAppInfo`, which also involves opening the APK, and
that open will be faster after this change.
Bug: 282191456
Test: art/test.py -b --host -r -t 595-profile-saving
Change-Id: If6ed139dcb7993402ded60a3bbd8fc0530a9c20e
3 files changed