1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef TRANSACT_SURFACE_DELEGATOR_STUB 17 #define TRANSACT_SURFACE_DELEGATOR_STUB 18 19 #include <map> 20 #include <iremote_stub.h> 21 #include "surface.h" 22 #include "itransact_surface_delegator.h" 23 24 namespace OHOS { 25 typedef struct NativeHandle { 26 int version; 27 int numFds; 28 int numInts; 29 int data[0]; 30 }NativeHandleT; 31 32 class TransactSurfaceDelegatorStub : public IRemoteStub<ITransactSurfaceDelegator> { 33 public: 34 ~TransactSurfaceDelegatorStub() = default; 35 void SetSurface(sptr<Surface> surface); 36 bool SetClient(sptr<IRemoteObject> client); 37 38 protected: 39 TransactSurfaceDelegatorStub() = default; 40 NativeHandleT *ReadNativeHandle(MessageParcel &input); 41 NativeHandleT *ReadNativeHandleWithoutVersion(MessageParcel &input); 42 int32_t SendMessage(int32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); 43 sptr<Surface> surface_ = nullptr; 44 45 private: 46 int32_t SendSelfProxy(); 47 sptr<IRemoteObject> client_ = nullptr; 48 }; 49 } // namespace OHOS 50 51 #endif //TRANSACT_SURFACE_DELEGATOR_STUB 52