Merge pull request #6 from morphis/fixes

Fixes
This commit is contained in:
Simon Fels 2016-11-29 06:18:42 +01:00 committed by GitHub
commit 801b725fd5
11 changed files with 17 additions and 36 deletions

View file

@ -1,5 +1,5 @@
service anboxd /system/bin/anboxd
class boot
class core
# We will ever only have a single network interface we need to care
# about so we can add static setup for this one here.

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

@ -54,15 +54,12 @@ LocalSocketConnection::~LocalSocketConnection() {
ssize_t LocalSocketConnection::read_all(std::uint8_t *buffer, const size_t &size) {
ssize_t bytes_read = ::recv(fd_, reinterpret_cast<void*>(buffer), size, 0);
ALOGI("Read %d bytes", bytes_read);
return bytes_read;
}
void LocalSocketConnection::send(char const* data, size_t length) {
size_t bytes_written{0};
ALOGI("Writing %d bytes", length);
while(bytes_written < length) {
ssize_t const result = ::send(fd_,
data + bytes_written,

View file

@ -50,10 +50,6 @@ anbox::PlatformApiStub::WindowStateUpdate::Window PlatformService::unpack_window
auto task_id = data.readInt32();
auto stack_id = data.readInt32();
ALOGI(" Window: package=%s frame={%d,%d,%d,%d} task=%d stack=%d",
package_name.string(), frame_left, frame_top, frame_right, frame_bottom,
task_id, stack_id);
return anbox::PlatformApiStub::WindowStateUpdate::Window{
-1, // Display id will be added by the caller
has_surface,
@ -67,13 +63,10 @@ anbox::PlatformApiStub::WindowStateUpdate::Window PlatformService::unpack_window
status_t PlatformService::update_window_state(const Parcel &data) {
anbox::PlatformApiStub::WindowStateUpdate state;
ALOGI("Udated windows:");
const auto num_displays = data.readInt32();
for (auto n = 0; n < num_displays; n++) {
const auto display_id = data.readInt32();
const auto num_windows = data.readInt32();
ALOGI(" Display: id=%d", display_id);
for (auto m = 0; m < num_windows; m++) {
auto window = unpack_window_state(data);
window.display_id = display_id;
@ -81,7 +74,6 @@ status_t PlatformService::update_window_state(const Parcel &data) {
}
}
ALOGI("Removed windows:");
const auto num_removed_windows = data.readInt32();
for (auto n = 0; n < num_removed_windows; n++) {
auto window = unpack_window_state(data);

5
scripts/load-kmods.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh -ex
sudo rmmod binder_linux || true
sudo rmmod ashmem_linux || true
(cd kernel/binder ; make clean && make -j4 ; sudo insmod binder_linux.ko; sudo chmod 666 /dev/binder)
(cd kernel/ashmem ; make clean && make -j4 ; sudo insmod ashmem_linux.ko; sudo chmod 666 /dev/ashmem)

View file

@ -14,8 +14,6 @@ apps:
container-manager:
command: bin/container-manager.sh
daemon: simple
shell:
command: bin/container-shell.sh
bridge:
command: bin/anbox-bridge.sh start
stop-command: bin/anbox-bridge.sh stop
@ -38,17 +36,6 @@ parts:
- bin/anbox-bridge.sh
- bin/anbox-wrapper.sh
- bin/container-manager.sh
- bin/container-shell.sh
kernel-module-binder:
plugin: make
source: kernel/binder
snap:
- binder_linux.ko
kernel-module-ashmem:
plugin: make
source: kernel/ashmem
snap:
- ashmem_linux.ko
lxc:
source: git://github.com/morphis/lxc
source-branch: snappy-support

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);
});

View file

@ -72,7 +72,7 @@ void SocketConnection::on_read_size(const boost::system::error_code& error, std:
if (connections_)
connections_->remove(id());
BOOST_THROW_EXCEPTION(std::runtime_error(error.message()));
return;
}
std::vector<std::uint8_t> data(bytes_read);

View file

@ -20,7 +20,6 @@
#include "anbox/rpc/make_protobuf_object.h"
#include "anbox/rpc/constants.h"
#include "anbox/common/variable_length_array.h"
#include "anbox/utils.h"
#include "anbox_rpc.pb.h"