summaryrefslogtreecommitdiff
path: root/services/incremental
diff options
context:
space:
mode:
authorSongchun Fan <schfan@google.com>2020-07-13 12:14:37 -0700
committerSongchun Fan <schfan@google.com>2020-07-13 12:14:37 -0700
commitc8975312c573a2a75030b85be1f3d81e121b3618 (patch)
treeeca2eeb333d80808e7e629206f6e563aeaa21580 /services/incremental
parent42ef19d57c91227e987ec7a9945a66d8c8aa533e (diff)
[IncrementalService] fix native lib check after OTA
The lib dir should always be at the same dir level as the APK file. Test: manual with OTA Test: atest CtsExtractNativeLibsHostTestCases BUG: 160826412 Change-Id: I87d715c4739c78bb56b85d375838db08bafa1594
Diffstat (limited to 'services/incremental')
-rw-r--r--services/incremental/IncrementalService.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/services/incremental/IncrementalService.cpp b/services/incremental/IncrementalService.cpp
index 3450c3ae9fb3..a5f0d045948c 100644
--- a/services/incremental/IncrementalService.cpp
+++ b/services/incremental/IncrementalService.cpp
@@ -1422,6 +1422,11 @@ static long elapsedMcs(Duration start, Duration end) {
}
// Extract lib files from zip, create new files in incfs and write data to them
+// Lib files should be placed next to the APK file in the following matter:
+// Example:
+// /path/to/base.apk
+// /path/to/lib/arm/first.so
+// /path/to/lib/arm/second.so
bool IncrementalService::configureNativeBinaries(StorageId storage, std::string_view apkFullPath,
std::string_view libDirRelativePath,
std::string_view abi, bool extractNativeLibs) {
@@ -1433,9 +1438,13 @@ bool IncrementalService::configureNativeBinaries(StorageId storage, std::string_
return false;
}
+ const auto targetLibPathRelativeToStorage =
+ path::join(path::dirname(normalizePathToStorage(*ifs, storage, apkFullPath)),
+ libDirRelativePath);
+
// First prepare target directories if they don't exist yet
- if (auto res = makeDirs(*ifs, storage, libDirRelativePath, 0755)) {
- LOG(ERROR) << "Failed to prepare target lib directory " << libDirRelativePath
+ if (auto res = makeDirs(*ifs, storage, targetLibPathRelativeToStorage, 0755)) {
+ LOG(ERROR) << "Failed to prepare target lib directory " << targetLibPathRelativeToStorage
<< " errno: " << res;
return false;
}
@@ -1486,7 +1495,7 @@ bool IncrementalService::configureNativeBinaries(StorageId storage, std::string_
auto startFileTs = Clock::now();
const auto libName = path::basename(fileName);
- auto targetLibPath = path::join(libDirRelativePath, libName);
+ auto targetLibPath = path::join(targetLibPathRelativeToStorage, libName);
const auto targetLibPathAbsolute = normalizePathToStorage(*ifs, storage, targetLibPath);
// If the extract file already exists, skip
if (access(targetLibPathAbsolute.c_str(), F_OK) == 0) {