Rework some of the RPC service bits and add boot support
This commit is contained in:
parent
e664839b14
commit
1879e634c5
39 changed files with 746 additions and 106 deletions
57
android/service/platform_api_stub.cpp
Normal file
57
android/service/platform_api_stub.cpp
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 3, as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "android/service/platform_api_stub.h"
|
||||
#include "anbox/bridge/rpc_channel.h"
|
||||
|
||||
#include "anbox_bridge.pb.h"
|
||||
|
||||
#define LOG_TAG "Anbox"
|
||||
#include <cutils/log.h>
|
||||
|
||||
namespace anbox {
|
||||
PlatformApiStub::PlatformApiStub(const std::shared_ptr<bridge::RpcChannel> &rpc_channel) :
|
||||
rpc_channel_(rpc_channel) {
|
||||
}
|
||||
|
||||
void PlatformApiStub::boot_finished() {
|
||||
auto c = std::make_shared<Request<protobuf::bridge::Void>>();
|
||||
|
||||
ALOGI("Boot finished");
|
||||
|
||||
{
|
||||
std::lock_guard<decltype(mutex_)> lock(mutex_);
|
||||
boot_finished_wait_handle_.expect_result();
|
||||
}
|
||||
|
||||
protobuf::bridge::Void message;
|
||||
|
||||
rpc_channel_->call_method(
|
||||
"boot_finished",
|
||||
&message, c->response.get(),
|
||||
google::protobuf::NewCallback(this, &PlatformApiStub::handle_boot_finished_response, c.get()));
|
||||
|
||||
boot_finished_wait_handle_.wait_for_all();
|
||||
|
||||
ALOGI("Boot finished sent successfully!");
|
||||
}
|
||||
|
||||
void PlatformApiStub::handle_boot_finished_response(Request<protobuf::bridge::Void>*) {
|
||||
ALOGI("handle_boot_finished_response");
|
||||
boot_finished_wait_handle_.result_received();
|
||||
}
|
||||
} // namespace anbox
|
||||
Loading…
Add table
Add a link
Reference in a new issue