Enable hwcomposer support only conditionally

This commit is contained in:
Simon Fels 2016-09-30 08:46:11 +02:00
commit bd9a859d61
3 changed files with 11 additions and 4 deletions

View file

@ -64,15 +64,17 @@ void BootPropertiesMessageProcessor::list_properties() {
// Disable on-screen virtual keys as we can use the hardware keyboard
"qemu.hw.mainkeys=1",
// To let surfaceflinger load our hwcomposer implementation we specify
// the correct subkey of the module here.
// "ro.hardware.hwcomposer=anbox",
// Android has builtin detection (inside Zygote) for proper container
// detection support
"ro.boot.container=1",
};
if (utils::is_env_set("USE_HWCOMPOSER")) {
// To let surfaceflinger load our hwcomposer implementation we specify
// the correct subkey of the module here.
properties.push_back("ro.hardware.hwcomposer=anbox");
}
for (const auto &prop : properties) {
send_header(prop.length());
messenger_->send(prop.c_str(), prop.length());

View file

@ -141,6 +141,10 @@ std::string get_env_value(const std::string &name, const std::string &default_va
return std::string(value);
}
bool is_env_set(const std::string &name) {
return getenv(name.c_str()) != nullptr;
}
void ensure_paths(const std::vector<std::string> &paths) {
for (const auto &path: paths) {
if (!fs::is_directory(fs::path(path)))

View file

@ -39,6 +39,7 @@ bool string_starts_with(const std::string &text, const std::string &prefix);
std::string hex_dump(const uint8_t *data, uint32_t size);
std::string get_env_value(const std::string &name, const std::string &default_value = "");
bool is_env_set(const std::string &name);
void ensure_paths(const std::vector<std::string> &paths);