提交 fc7049b2 编写于 作者: S Simon Fels

Create a marker to indicate that first boot has happened

上级 69631a1b
......@@ -21,9 +21,17 @@
#include "anbox_rpc.pb.h"
#include "anbox_bridge.pb.h"
#include <fstream>
#include <sys/stat.h>
#define LOG_TAG "Anboxd"
#include <cutils/log.h>
namespace {
constexpr const char *first_boot_marker_path{"/data/.anbox_initialized"};
}
namespace anbox {
PlatformApiStub::PlatformApiStub(const std::shared_ptr<rpc::Channel> &rpc_channel) :
rpc_channel_(rpc_channel) {
......@@ -32,7 +40,13 @@ PlatformApiStub::PlatformApiStub(const std::shared_ptr<rpc::Channel> &rpc_channe
void PlatformApiStub::boot_finished() {
protobuf::bridge::EventSequence seq;
auto event = seq.mutable_boot_finished();
(void) event;
struct stat st;
if (stat(first_boot_marker_path, &st) != 0) {
event->set_first_boot_done(true);
std::ofstream marker(first_boot_marker_path);
}
rpc_channel_->send_event(seq);
}
......
......@@ -63,9 +63,8 @@ void PlatformApiSkeleton::get_clipboard_data(anbox::protobuf::rpc::Void const *r
}
void PlatformApiSkeleton::handle_boot_finished_event(const anbox::protobuf::bridge::BootFinishedEvent &event) {
(void)event;
if (boot_finished_handler_) boot_finished_handler_();
if (boot_finished_handler_)
boot_finished_handler_();
}
void PlatformApiSkeleton::handle_window_state_update_event(const anbox::protobuf::bridge::WindowStateUpdateEvent &event) {
......
......@@ -58,6 +58,7 @@ message ClipboardData {
}
message BootFinishedEvent {
optional bool first_boot_done = 1;
}
message WindowStateUpdateEvent {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册