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

Commit 99016bce authored by Tom Cherry's avatar Tom Cherry Committed by Gerrit Code Review
Browse files

Merge "init: use ro.init.subcontexts_enabled to enable subcontexts"

parents 0f058759 79193a42
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@

#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android-base/strings.h>
#include <selinux/android.h>

@@ -30,6 +31,7 @@
#include "system/core/init/subcontext.pb.h"
#include "util.h"

using android::base::GetBoolProperty;
using android::base::GetExecutablePath;
using android::base::Join;
using android::base::Socketpair;
@@ -258,13 +260,14 @@ Result<Success> Subcontext::Execute(const std::vector<std::string>& args) {
static std::vector<Subcontext> subcontexts;

std::vector<Subcontext>* InitializeSubcontexts() {
    if (GetBoolProperty("ro.init.subcontexts_enabled", false)) {
        static const char* const paths_and_secontexts[][2] = {
        //  TODO: Enable this once the SEPolicy is in place.
        //  {"/vendor", kVendorContext.c_str()},
            {"/vendor", kVendorContext.c_str()},
        };
        for (const auto& [path_prefix, secontext] : paths_and_secontexts) {
            subcontexts.emplace_back(path_prefix, secontext);
        }
    }
    return &subcontexts;
}