Add argument for launch command to use system dbus

This commit is contained in:
Simon Fels 2017-07-09 21:22:21 +02:00
commit 43244baa11
2 changed files with 9 additions and 1 deletions

View file

@ -77,6 +77,9 @@ anbox::cmds::Launch::Launch()
flag(cli::make_flag(cli::Name{"stack"},
cli::Description{"Which window stack the activity should be started on. Possible: default, fullscreen, freeform"},
stack_));
flag(cli::make_flag(cli::Name{"use-system-dbus"},
cli::Description{"Use system instead of session DBus"},
use_system_dbus_));
action([this](const cli::Command::Context&) {
if (!intent_.valid()) {
@ -92,7 +95,11 @@ anbox::cmds::Launch::Launch()
auto rt = Runtime::create();
auto bus = std::make_shared<core::dbus::Bus>(core::dbus::WellKnownBus::session);
auto bus_type = core::dbus::WellKnownBus::session;
if (use_system_dbus_)
bus_type = core::dbus::WellKnownBus::system;
auto bus = std::make_shared<core::dbus::Bus>(bus_type);
bus->install_executor(core::dbus::asio::make_executor(bus, rt->service()));
const auto snap_path = utils::get_env_value("SNAP");

View file

@ -38,6 +38,7 @@ class Launch : public cli::CommandWithFlagsAndAction {
android::Intent intent_;
wm::Stack::Id stack_;
bool use_system_dbus_ = false;
};
} // namespace cmds
} // namespace anbox