1 /* 2 * Copyright (C) 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #include "host-common/AndroidAsyncMessagePipe.h" 20 #include "host-common/window_agent.h" 21 22 namespace android { 23 class MultiDisplayPipe : public AndroidAsyncMessagePipe { 24 public: 25 class Service : public AndroidAsyncMessagePipe::Service<MultiDisplayPipe> { 26 public: Service(const char * serviceName)27 Service(const char* serviceName) 28 : AndroidAsyncMessagePipe::Service<MultiDisplayPipe>(serviceName) 29 {} 30 }; 31 32 MultiDisplayPipe(AndroidPipe::Service* service, PipeArgs&& pipeArgs); 33 virtual ~MultiDisplayPipe(); 34 35 void onMessage(const std::vector<uint8_t>& data) override; 36 void fillData(std::vector<uint8_t>& data, uint32_t id, uint32_t w, uint32_t h, 37 uint32_t dpi, uint32_t flag, bool add); 38 void fillData(std::vector<uint8_t>& data, uint32_t id, uint32_t w, uint32_t h, 39 uint32_t dpi, uint32_t flag, int mode); 40 virtual void onSave(base::Stream* stream) override; 41 virtual void onLoad(base::Stream* stream) override; 42 43 static MultiDisplayPipe* getInstance(); 44 const static uint8_t ADD; 45 const static uint8_t DEL; 46 const static uint8_t QUERY; 47 const static uint8_t BIND; 48 const static uint8_t SET_DISPLAY; 49 const static uint8_t MAX_DISPLAYS; 50 51 private: 52 Service* const mService; 53 }; 54 } 55 56 void android_init_multi_display_pipe(); 57