diff options
| author | 2024-04-11 17:28:35 +0000 | |
|---|---|---|
| committer | 2024-04-11 17:28:35 +0000 | |
| commit | f647719c2c04cbaeda5229bbe65b8a73030f7a94 (patch) | |
| tree | 6da573c54135c7b50f2181c6ceea74fb3e93cd0e | |
| parent | a484783a0a8fa3b13b11e17417c94d28e091667f (diff) | |
| parent | 8948d071a20f45b2d70be88e1af7602f2e5d78c5 (diff) | |
Merge "Flag punch hole changes with build time flag" into main
| -rw-r--r-- | core/jni/Android.bp | 4 | ||||
| -rw-r--r-- | core/jni/com_android_internal_content_NativeLibraryHelper.cpp | 10 |
2 files changed, 14 insertions, 0 deletions
diff --git a/core/jni/Android.bp b/core/jni/Android.bp index 305809b973bf..6412ddb3f6a7 100644 --- a/core/jni/Android.bp +++ b/core/jni/Android.bp @@ -21,6 +21,7 @@ soong_config_module_type { config_namespace: "ANDROID", bool_variables: [ "release_binder_death_recipient_weak_from_jni", + "release_package_libandroid_runtime_punch_holes", ], properties: [ "cflags", @@ -63,6 +64,9 @@ cc_library_shared_for_libandroid_runtime { release_binder_death_recipient_weak_from_jni: { cflags: ["-DBINDER_DEATH_RECIPIENT_WEAK_FROM_JNI"], }, + release_package_libandroid_runtime_punch_holes: { + cflags: ["-DENABLE_PUNCH_HOLES"], + }, }, cpp_std: "gnu++20", diff --git a/core/jni/com_android_internal_content_NativeLibraryHelper.cpp b/core/jni/com_android_internal_content_NativeLibraryHelper.cpp index 149e57a6f5e1..faa83f8017f7 100644 --- a/core/jni/com_android_internal_content_NativeLibraryHelper.cpp +++ b/core/jni/com_android_internal_content_NativeLibraryHelper.cpp @@ -36,6 +36,7 @@ #include <memory> +#include "com_android_internal_content_FileSystemUtils.h" #include "core_jni_helpers.h" #define RS_BITCODE_SUFFIX ".bc" @@ -169,6 +170,15 @@ copyFileIfChanged(JNIEnv *env, void* arg, ZipFileRO* zipFile, ZipEntryRO zipEntr return INSTALL_FAILED_INVALID_APK; } +#ifdef ENABLE_PUNCH_HOLES + // if library is uncompressed, punch hole in it in place + if (!punchHolesInElf64(zipFile->getZipFileName(), offset)) { + ALOGW("Failed to punch uncompressed elf file :%s inside apk : %s at offset: " + "%" PRIu64 "", + fileName, zipFile->getZipFileName(), offset); + } +#endif // ENABLE_PUNCH_HOLES + return INSTALL_SUCCEEDED; } |