Merge "init: use ro.init.subcontexts_enabled to enable subcontexts" am: 99016bce92
am: 2f5b8bb3f0
Change-Id: I5c0ab48cd1ad208b2eb3d499d7f1b4473417b6c4
This commit is contained in:
commit
16d1488614
1 changed files with 9 additions and 6 deletions
|
|
@ -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,12 +260,13 @@ Result<Success> Subcontext::Execute(const std::vector<std::string>& args) {
|
|||
static std::vector<Subcontext> subcontexts;
|
||||
|
||||
std::vector<Subcontext>* InitializeSubcontexts() {
|
||||
static const char* const paths_and_secontexts[][2] = {
|
||||
// TODO: Enable this once the SEPolicy is in place.
|
||||
// {"/vendor", kVendorContext.c_str()},
|
||||
};
|
||||
for (const auto& [path_prefix, secontext] : paths_and_secontexts) {
|
||||
subcontexts.emplace_back(path_prefix, secontext);
|
||||
if (GetBoolProperty("ro.init.subcontexts_enabled", false)) {
|
||||
static const char* const paths_and_secontexts[][2] = {
|
||||
{"/vendor", kVendorContext.c_str()},
|
||||
};
|
||||
for (const auto& [path_prefix, secontext] : paths_and_secontexts) {
|
||||
subcontexts.emplace_back(path_prefix, secontext);
|
||||
}
|
||||
}
|
||||
return &subcontexts;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue