Always start new applications on the freeform stack

This commit is contained in:
Simon Fels 2016-11-29 06:18:01 +01:00
commit e75940711b
4 changed files with 10 additions and 9 deletions

View file

@ -83,12 +83,16 @@ void AndroidApiSkeleton::launch_application(anbox::protobuf::bridge::LaunchAppli
(void) response;
std::string intent = request->package_name();
intent += "/";
intent += request->activity();
if (request->has_activity()) {
intent += "/";
intent += request->activity();
}
std::vector<std::string> argv = {
"/system/bin/am",
"start",
// Launch any applications always in freeform stack
"--stack", "2",
intent,
};

View file

@ -92,7 +92,8 @@ void AndroidApiStub::launch(const std::string &package, const std::string &activ
auto c = std::make_shared<Request<protobuf::rpc::Void>>();
protobuf::bridge::LaunchApplication message;
message.set_package_name(package);
message.set_activity(activity);
if (activity.length() > 0)
message.set_activity(activity);
{
std::lock_guard<decltype(mutex_)> lock(mutex_);

View file

@ -30,8 +30,8 @@ anbox::cmds::Launch::Launch()
flag(cli::make_flag(cli::Name{"package"}, cli::Description{"Package the application is part of"}, package_));
flag(cli::make_flag(cli::Name{"activity"}, cli::Description{"Activity of the application to start"}, activity_));
action([this](const cli::Command::Context&) {
if (package_.empty() || activity_.empty())
BOOST_THROW_EXCEPTION(std::runtime_error("No package or activity specified"));
if (package_.empty() && activity_.empty())
BOOST_THROW_EXCEPTION(std::runtime_error("Package or activity name not specified"));
auto bus = std::make_shared<core::dbus::Bus>(core::dbus::WellKnownBus::session);
bus->install_executor(core::dbus::asio::make_executor(bus));

View file

@ -35,8 +35,6 @@ ApplicationManager::ApplicationManager(const core::dbus::Bus::Ptr &bus,
auto reader = msg->reader();
reader >> path;
DEBUG("path %s", path);
core::dbus::Message::Ptr reply;
try {
@ -52,8 +50,6 @@ ApplicationManager::ApplicationManager(const core::dbus::Bus::Ptr &bus,
err.what());
}
DEBUG("Sending reply");
bus_->send(reply);
});