diff --git a/src/anbox/cmds/launch.cpp b/src/anbox/cmds/launch.cpp index 3e0f8851a5282bf45bc2afa242a3f12b90011bc3..ac3b2770b8384f6c2fac520d130caa8657c3e75b 100644 --- a/src/anbox/cmds/launch.cpp +++ b/src/anbox/cmds/launch.cpp @@ -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::WellKnownBus::session); + auto bus_type = core::dbus::WellKnownBus::session; + if (use_system_dbus_) + bus_type = core::dbus::WellKnownBus::system; + + auto bus = std::make_shared(bus_type); bus->install_executor(core::dbus::asio::make_executor(bus, rt->service())); const auto snap_path = utils::get_env_value("SNAP"); diff --git a/src/anbox/cmds/launch.h b/src/anbox/cmds/launch.h index 7fc71c94eb105e44a34a272a73e2d583002afc36..b555c4188e42abb77dc005dc4bf03eb397c6cc55 100644 --- a/src/anbox/cmds/launch.h +++ b/src/anbox/cmds/launch.h @@ -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