X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fandroid%2Fservice%2Fplatform_api_stub.h;fp=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fandroid%2Fservice%2Fplatform_api_stub.h;h=7ddfb880874d2ff035e7132d752c96ded2665004;hb=e26c1ec581be598521517829adba8c8dd23a768f;hp=0000000000000000000000000000000000000000;hpb=6699c1aea74eeb0eb400e6299079f0c7576f716f;p=iec.git diff --git a/src/type3_AndroidCloud/anbox-master/android/service/platform_api_stub.h b/src/type3_AndroidCloud/anbox-master/android/service/platform_api_stub.h new file mode 100644 index 0000000..7ddfb88 --- /dev/null +++ b/src/type3_AndroidCloud/anbox-master/android/service/platform_api_stub.h @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2016 Simon Fels + * + * 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 . + * + */ + +#ifndef ANBOX_ANDROID_PLATFORM_API_STUB_H_ +#define ANBOX_ANDROID_PLATFORM_API_STUB_H_ + +#include "anbox/common/wait_handle.h" + +#include +#include +#include + +namespace anbox { +namespace protobuf { +namespace rpc { +class Void; +} // namespace rpc +namespace bridge { +class ClipboardData; +} // namespace bridge +} // namespace protobuf +namespace rpc { +class Channel; +} // namespace rpc +class PlatformApiStub { +public: + PlatformApiStub(const std::shared_ptr &rpc_channel); + + void boot_finished(); + + struct WindowStateUpdate { + struct Window { + int display_id; + bool has_surface; + std::string package_name; + struct Frame { + int left; + int top; + int right; + int bottom; + }; + Frame frame; + int task_id; + int stack_id; + }; + std::vector updated_windows; + std::vector removed_windows; + }; + + void update_window_state(const WindowStateUpdate &state); + + struct ApplicationListUpdate { + struct Application { + std::string name; + std::string package; + struct Intent { + std::string action; + std::string uri; + std::string type; + std::string package; + std::string component; + std::vector categories; + }; + Intent launch_intent; + std::vector icon; + }; + std::vector applications; + std::vector removed_applications; + }; + + void update_application_list(const ApplicationListUpdate &update); + + struct ClipboardData { + std::string text; + }; + + void set_clipboard_data(const ClipboardData &data); + ClipboardData get_clipboard_data(); + +private: + template + struct Request { + Request() : response(std::make_shared()), success(true) { } + std::shared_ptr response; + bool success; + common::WaitHandle wh; + }; + + void on_clipboard_data_set(Request *request); + void on_clipboard_data_get(Request *request); + + mutable std::mutex mutex_; + std::shared_ptr rpc_channel_; + + ClipboardData received_clipboard_data_; +}; +} // namespace anbox + +#endif