2 * Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef ANBOX_ANDROID_PLATFORM_API_STUB_H_
19 #define ANBOX_ANDROID_PLATFORM_API_STUB_H_
21 #include "anbox/common/wait_handle.h"
35 } // namespace protobuf
39 class PlatformApiStub {
41 PlatformApiStub(const std::shared_ptr<rpc::Channel> &rpc_channel);
45 struct WindowStateUpdate {
49 std::string package_name;
60 std::vector<Window> updated_windows;
61 std::vector<Window> removed_windows;
64 void update_window_state(const WindowStateUpdate &state);
66 struct ApplicationListUpdate {
75 std::string component;
76 std::vector<std::string> categories;
79 std::vector<int8_t> icon;
81 std::vector<Application> applications;
82 std::vector<std::string> removed_applications;
85 void update_application_list(const ApplicationListUpdate &update);
87 struct ClipboardData {
91 void set_clipboard_data(const ClipboardData &data);
92 ClipboardData get_clipboard_data();
95 template<typename Response>
97 Request() : response(std::make_shared<Response>()), success(true) { }
98 std::shared_ptr<Response> response;
100 common::WaitHandle wh;
103 void on_clipboard_data_set(Request<protobuf::rpc::Void> *request);
104 void on_clipboard_data_get(Request<protobuf::bridge::ClipboardData> *request);
106 mutable std::mutex mutex_;
107 std::shared_ptr<rpc::Channel> rpc_channel_;
109 ClipboardData received_clipboard_data_;