Create a marker to indicate that first boot has happened
This commit is contained in:
parent
69631a1bfc
commit
fc7049b27b
3 changed files with 18 additions and 4 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue