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

Commit b870254c authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge changes Iebdb112c,I8203868b,Icedec8cc am: 9a8bd42d

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1618639

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I53201583201a5d1b3d412c89ef9e090ab8cb6ca6
parents 6ea66e43 9a8bd42d
Loading
Loading
Loading
Loading
+29 −17
Original line number Diff line number Diff line
@@ -175,8 +175,10 @@ class OTAPreoptService {
private:

    bool ReadSystemProperties() {
        // TODO This file does not have a stable format. It should be read by
        // code shared by init and otapreopt. See b/181182967#comment80
        static constexpr const char* kPropertyFiles[] = {
                "/default.prop", "/system/build.prop"
                "/system/build.prop"
        };

        for (size_t i = 0; i < arraysize(kPropertyFiles); ++i) {
@@ -193,8 +195,18 @@ private:
        //   export NAME VALUE
        // For simplicity, don't respect string quotation. The values we are interested in can be
        // encoded without them.
        // init.environ.rc and etc/classpath have the same format for
        // environment variable exports and can be matched by the same regex.
        // TODO Just like with the system-properties above we really should have
        // common code between init and otapreopt to deal with reading these
        // things. See b/181182967
        static constexpr const char* kEnvironmentVariableSources[] = {
                "/init.environ.rc", "/etc/classpath"
        };

        std::regex export_regex("\\s*export\\s+(\\S+)\\s+(\\S+)");
        bool parse_result = ParseFile("/init.environ.rc", [&](const std::string& line) {
        for (const char* env_vars_file : kEnvironmentVariableSources) {
            bool parse_result = ParseFile(env_vars_file, [&](const std::string& line) {
                std::smatch export_match;
                if (!std::regex_match(line, export_match, export_regex)) {
                    return true;
@@ -214,7 +226,7 @@ private:
            if (!parse_result) {
                return false;
            }

        }
        if (system_properties_.GetProperty(kAndroidDataPathPropertyName) == nullptr) {
            return false;
        }
+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();
}