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

Commit 35d7d4ca authored by Nikita Ioffe's avatar Nikita Ioffe Committed by Alex Light
Browse files

Populate ApexFileRepository before activating apexes

Test: presubmit
Test: Manual OTA of cuttlefish
Bug: 181182967
Change-Id: Icedec8cc45a20c5eb7c33fffec50b8887b9b7735
parent e9b81a40
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include <libdm/dm.h>
#include <selinux/android.h>

#include <apex_file_repository.h>
#include <apexd.h>

#include "installd_constants.h"
@@ -64,11 +65,14 @@ static std::vector<apex::ApexFile> ActivateApexPackages() {
    // system/apex/apexd/apexd.cpp.
    //
    // Only scan the APEX directory under /system, /system_ext and /vendor (within the chroot dir).
    std::vector<const char*> apex_dirs{apex::kApexPackageSystemDir, apex::kApexPackageSystemExtDir,
    std::vector<std::string> apex_dirs{apex::kApexPackageSystemDir, apex::kApexPackageSystemExtDir,
                                       apex::kApexPackageVendorDir};
    // Initialize ApexFileRepository used internally in ScanPackagesDirAndActivate.
    // This is a quick fix to fix apex activation in otapreopt_chroot.
    apex::ApexFileRepository::GetInstance().AddPreInstalledApex(apex_dirs);
    for (const auto& dir : apex_dirs) {
        // Cast call to void to suppress warn_unused_result.
        static_cast<void>(apex::ScanPackagesDirAndActivate(dir));
        static_cast<void>(apex::ScanPackagesDirAndActivate(dir.c_str()));
    }
    return apex::GetActivePackages();
}