Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4d7ce777 authored by Songchun Fan's avatar Songchun Fan Committed by Automerger Merge Worker
Browse files

Merge "[IncrementalService] fix native lib check after OTA" into rvc-dev am: 9093346b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12141813

Change-Id: I9ade88f979ccd800da6b9685757ea5daa8f0b4b7
parents e23bf501 9093346b
Loading
Loading
Loading
Loading
+12 −3
Original line number Original line Diff line number Diff line
@@ -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
// 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,
bool IncrementalService::configureNativeBinaries(StorageId storage, std::string_view apkFullPath,
                                                 std::string_view libDirRelativePath,
                                                 std::string_view libDirRelativePath,
                                                 std::string_view abi, bool extractNativeLibs) {
                                                 std::string_view abi, bool extractNativeLibs) {
@@ -1433,9 +1438,13 @@ bool IncrementalService::configureNativeBinaries(StorageId storage, std::string_
        return false;
        return false;
    }
    }


    const auto targetLibPathRelativeToStorage =
            path::join(path::dirname(normalizePathToStorage(*ifs, storage, apkFullPath)),
                       libDirRelativePath);

    // First prepare target directories if they don't exist yet
    // First prepare target directories if they don't exist yet
    if (auto res = makeDirs(*ifs, storage, libDirRelativePath, 0755)) {
    if (auto res = makeDirs(*ifs, storage, targetLibPathRelativeToStorage, 0755)) {
        LOG(ERROR) << "Failed to prepare target lib directory " << libDirRelativePath
        LOG(ERROR) << "Failed to prepare target lib directory " << targetLibPathRelativeToStorage
                   << " errno: " << res;
                   << " errno: " << res;
        return false;
        return false;
    }
    }
@@ -1486,7 +1495,7 @@ bool IncrementalService::configureNativeBinaries(StorageId storage, std::string_
        auto startFileTs = Clock::now();
        auto startFileTs = Clock::now();


        const auto libName = path::basename(fileName);
        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);
        const auto targetLibPathAbsolute = normalizePathToStorage(*ifs, storage, targetLibPath);
        // If the extract file already exists, skip
        // If the extract file already exists, skip
        if (access(targetLibPathAbsolute.c_str(), F_OK) == 0) {
        if (access(targetLibPathAbsolute.c_str(), F_OK) == 0) {