diff options
Diffstat (limited to 'services/incremental')
-rw-r--r-- | services/incremental/BinderIncrementalService.cpp | 5 | ||||
-rw-r--r-- | services/incremental/BinderIncrementalService.h | 3 | ||||
-rw-r--r-- | services/incremental/IncrementalService.cpp | 17 | ||||
-rw-r--r-- | services/incremental/IncrementalService.h | 3 |
4 files changed, 23 insertions, 5 deletions
diff --git a/services/incremental/BinderIncrementalService.cpp b/services/incremental/BinderIncrementalService.cpp index 0355b399dcef..8d2afc1bea37 100644 --- a/services/incremental/BinderIncrementalService.cpp +++ b/services/incremental/BinderIncrementalService.cpp @@ -279,8 +279,9 @@ binder::Status BinderIncrementalService::startLoading(int32_t storageId, bool* _ binder::Status BinderIncrementalService::configureNativeBinaries( int32_t storageId, const std::string& apkFullPath, const std::string& libDirRelativePath, - const std::string& abi, bool* _aidl_return) { - *_aidl_return = mImpl.configureNativeBinaries(storageId, apkFullPath, libDirRelativePath, abi); + const std::string& abi, bool extractNativeLibs, bool* _aidl_return) { + *_aidl_return = mImpl.configureNativeBinaries(storageId, apkFullPath, libDirRelativePath, abi, + extractNativeLibs); return ok(); } diff --git a/services/incremental/BinderIncrementalService.h b/services/incremental/BinderIncrementalService.h index af1136344246..68549f5a8ff8 100644 --- a/services/incremental/BinderIncrementalService.h +++ b/services/incremental/BinderIncrementalService.h @@ -77,7 +77,8 @@ public: binder::Status configureNativeBinaries(int32_t storageId, const std::string& apkFullPath, const std::string& libDirRelativePath, - const std::string& abi, bool* _aidl_return) final; + const std::string& abi, bool extractNativeLibs, + bool* _aidl_return) final; binder::Status waitForNativeBinariesExtraction(int storageId, bool* _aidl_return) final; private: diff --git a/services/incremental/IncrementalService.cpp b/services/incremental/IncrementalService.cpp index b03d1eae8ca0..66c7717d7987 100644 --- a/services/incremental/IncrementalService.cpp +++ b/services/incremental/IncrementalService.cpp @@ -1379,7 +1379,7 @@ static long elapsedMcs(Duration start, Duration end) { // Extract lib files from zip, create new files in incfs and write data to them bool IncrementalService::configureNativeBinaries(StorageId storage, std::string_view apkFullPath, std::string_view libDirRelativePath, - std::string_view abi) { + std::string_view abi, bool extractNativeLibs) { auto start = Clock::now(); const auto ifs = getIfs(storage); @@ -1423,6 +1423,21 @@ bool IncrementalService::configureNativeBinaries(StorageId storage, std::string_ continue; } + if (!extractNativeLibs) { + // ensure the file is properly aligned and unpacked + if (entry.method != kCompressStored) { + LOG(WARNING) << "Library " << fileName << " must be uncompressed to mmap it"; + return false; + } + if ((entry.offset & (constants().blockSize - 1)) != 0) { + LOG(WARNING) << "Library " << fileName + << " must be page-aligned to mmap it, offset = 0x" << std::hex + << entry.offset; + return false; + } + continue; + } + auto startFileTs = Clock::now(); const auto libName = path::basename(fileName); diff --git a/services/incremental/IncrementalService.h b/services/incremental/IncrementalService.h index bde4ef68d2a7..05f62b977a85 100644 --- a/services/incremental/IncrementalService.h +++ b/services/incremental/IncrementalService.h @@ -138,7 +138,8 @@ public: bool startLoading(StorageId storage) const; bool configureNativeBinaries(StorageId storage, std::string_view apkFullPath, - std::string_view libDirRelativePath, std::string_view abi); + std::string_view libDirRelativePath, std::string_view abi, + bool extractNativeLibs); bool waitForNativeBinariesExtraction(StorageId storage); class AppOpsListener : public android::BnAppOpsCallback { |