1 /*
2 * Copyright (c) 2025 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 #include "rs_transaction_data_callback_proxy.h"
17 #include <message_option.h>
18 #include <message_parcel.h>
19 #include "platform/common/rs_log.h"
20 #include "rs_trace.h"
21 #include "ipc_callbacks/rs_ipc_callbacks_check.h"
22
23 namespace OHOS {
24 namespace Rosen {
RSTransactionDataCallbackProxy(const sptr<IRemoteObject> & impl)25 RSTransactionDataCallbackProxy::RSTransactionDataCallbackProxy(const sptr<IRemoteObject>& impl)
26 : IRemoteProxy<RSITransactionDataCallback>(impl)
27 {
28 }
29
OnAfterProcess(uint64_t token,uint64_t timeStamp)30 void RSTransactionDataCallbackProxy::OnAfterProcess(uint64_t token, uint64_t timeStamp)
31 {
32 MessageParcel data;
33 MessageParcel reply;
34 MessageOption option;
35 if (!data.WriteInterfaceToken(RSITransactionDataCallback::GetDescriptor())) {
36 ROSEN_LOGE("RSTransactionDataCallbackProxy: OnAfterProcess writeInterfaceToken error");
37 return;
38 }
39 if (!data.WriteUint64(token)) {
40 ROSEN_LOGE("RSTransactionDataCallbackProxy: OnAfterProcess write multi token error");
41 return;
42 }
43 if (!data.WriteUint64(timeStamp)) {
44 ROSEN_LOGE("RSTransactionDataCallbackProxy: OnAfterProcess write timeStamp error");
45 return;
46 }
47 option.SetFlags(MessageOption::TF_ASYNC);
48 uint32_t code = static_cast<uint32_t>(RSITransactionDataCallbackInterfaceCode::ON_AFTER_PROCESS);
49 RS_LOGD("RSTransactionDataCallbackProxy: OnAfterProcess send data, timeStamp: %{public}"
50 PRIu64 " token: %{public}" PRIu64, timeStamp, token);
51 int32_t err = SendRequestRemote::SendRequest(Remote(), code, data, reply, option);
52 if (err != NO_ERROR) {
53 ROSEN_LOGE("RSTransactionDataCallbackProxy: SendRequest() error");
54 }
55 }
56 } // namespace Rosen
57 } // namespace OHOS