summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorTom Cherry <tomcherry@google.com>2017-10-06 20:43:37 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-10-06 20:43:37 +0000
commit3bcda2413cd8230154a371cc68c97c0a188741b3 (patch)
tree91cfb86be63e80bda74ee32cb18fdddbc5e9ceea /init
parentdc73f5a66942e0d3f3a6ac1b2d3c750d9e94b796 (diff)
parent16d14886148266ccf0655566715beb72a4c4ef31 (diff)
downloadcore-3bcda2413cd8230154a371cc68c97c0a188741b3.tar.gz
core-3bcda2413cd8230154a371cc68c97c0a188741b3.tar.bz2
core-3bcda2413cd8230154a371cc68c97c0a188741b3.zip
Merge "init: use ro.init.subcontexts_enabled to enable subcontexts" am: 99016bce92 am: 2f5b8bb3f0
am: 16d1488614 Change-Id: I7afef0bf95ca413593e6bf36f07432af3fa41614
Diffstat (limited to 'init')
-rw-r--r--init/subcontext.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/init/subcontext.cpp b/init/subcontext.cpp
index 85da23734..927953d67 100644
--- a/init/subcontext.cpp
+++ b/init/subcontext.cpp
@@ -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;
}