Implement RPC for window state synchronization

This commit is contained in:
Simon Fels 2016-11-15 07:54:19 +01:00
commit 0f5006493b
11 changed files with 89 additions and 78 deletions

View file

@ -33,6 +33,7 @@ class Void;
} // namespace rpc
namespace bridge {
class Notification;
class WindowStateUpdate;
} // namespace bridge
} // namespace protobuf
namespace rpc {
@ -48,14 +49,10 @@ public:
anbox::protobuf::rpc::Void *response,
google::protobuf::Closure *done) = 0;
virtual void update_window_state(anbox::protobuf::rpc::Void const *request,
virtual void update_window_state(anbox::protobuf::bridge::WindowStateUpdate const *request,
anbox::protobuf::rpc::Void *response,
google::protobuf::Closure *done) = 0;
virtual void remove_window(anbox::protobuf::rpc::Void const *request,
anbox::protobuf::rpc::Void *response,
google::protobuf::Closure *done) = 0;
private:
std::shared_ptr<rpc::PendingCallCache> pending_calls_;
};

View file

@ -38,8 +38,6 @@ void PlatformMessageProcessor::dispatch(rpc::Invocation const& invocation) {
invoke(this, server_.get(), &PlatformApiSkeleton::boot_finished, invocation);
else if (invocation.method_name() == "update_window_state")
invoke(this, server_.get(), &PlatformApiSkeleton::update_window_state, invocation);
else if (invocation.method_name() == "remove_window")
invoke(this, server_.get(), &PlatformApiSkeleton::remove_window, invocation);
}
void PlatformMessageProcessor::process_event_sequence(const std::string&) {

View file

@ -26,3 +26,19 @@ message SetDnsServers {
}
repeated Server servers = 2;
}
message WindowStateUpdate {
message WindowState {
required int32 display_id = 1;
required bool has_surface = 2;
required string package_name = 3;
required int32 frame_left = 4;
required int32 frame_top = 5;
required int32 frame_right = 6;
required int32 frame_bottom = 7;
required int32 task_id = 8;
required int32 stack_id = 9;
}
repeated WindowState windows = 1;
repeated WindowState removed_windows = 2;
}

View file

@ -45,7 +45,7 @@ void PlatformApiSekeleton::boot_finished(anbox::protobuf::rpc::Void const *reque
done->Run();
}
void PlatformApiSekeleton::update_window_state(anbox::protobuf::rpc::Void const *request,
void PlatformApiSekeleton::update_window_state(anbox::protobuf::bridge::WindowStateUpdate const *request,
anbox::protobuf::rpc::Void *response,
google::protobuf::Closure *done) {
(void) request;
@ -53,16 +53,6 @@ void PlatformApiSekeleton::update_window_state(anbox::protobuf::rpc::Void const
DEBUG("");
done->Run();
}
void PlatformApiSekeleton::remove_window(anbox::protobuf::rpc::Void const *request,
anbox::protobuf::rpc::Void *response,
google::protobuf::Closure *done) {
(void) request;
(void) response;
DEBUG("");
done->Run();
}

View file

@ -26,6 +26,7 @@ class Dispatcher;
} // namespace common
namespace bridge {
class AndroidApiStub;
class WindowStateUpdate;
} // namespace bridge
namespace rpc {
class PendingCallCache;
@ -40,14 +41,10 @@ public:
anbox::protobuf::rpc::Void *response,
google::protobuf::Closure *done) override;
void update_window_state(anbox::protobuf::rpc::Void const *request,
void update_window_state(anbox::protobuf::bridge::WindowStateUpdate const *request,
anbox::protobuf::rpc::Void *response,
google::protobuf::Closure *done) override;
void remove_window(anbox::protobuf::rpc::Void const *request,
anbox::protobuf::rpc::Void *response,
google::protobuf::Closure *done) override;
void on_boot_finished(const std::function<void()> &action);
private: