dbus: make launch of application with package+component work

This commit is contained in:
Simon Fels 2018-05-23 14:26:47 +02:00
commit 198015c314
3 changed files with 12 additions and 4 deletions

View file

@ -38,7 +38,7 @@ class Launch : public cli::CommandWithFlagsAndAction {
bool try_launch_activity(const std::shared_ptr<dbus::stub::ApplicationManager> &stub);
android::Intent intent_;
wm::Stack::Id stack_;
wm::Stack::Id stack_ = wm::Stack::Id::Default;
bool use_system_dbus_ = false;
};
} // namespace cmds

View file

@ -92,6 +92,10 @@ int ApplicationManager::method_launch(sd_bus_message *m, void *userdata, sd_bus_
if (r < 0)
return r;
}
r = sd_bus_message_exit_container(m);
if (r < 0)
return r;
}
r = sd_bus_message_exit_container(m);

View file

@ -114,9 +114,13 @@ void ApplicationManager::launch(const android::Intent &intent,
if (r < 0)
throw std::runtime_error("Failed to construct DBus message");
r = sd_bus_call(bus_->raw(), m, 0, nullptr, nullptr);
if (r < 0)
throw std::runtime_error("Failed to call Anbox application manager");
sd_bus_error error = SD_BUS_ERROR_NULL;
r = sd_bus_call(bus_->raw(), m, 0, &error, nullptr);
if (r < 0) {
const auto msg = utils::string_format("%s", error.message);
sd_bus_error_free(&error);
throw std::runtime_error(msg);
}
}
core::Property<bool>& ApplicationManager::ready() {