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 #include "zidl/pattern_detach_callback_proxy.h"
17
18 namespace OHOS {
19 namespace Rosen {
20
OnPatternDetach(int32_t persisitentId)21 void PatternDetachCallbackProxy::OnPatternDetach(int32_t persisitentId)
22 {
23 MessageParcel data;
24 MessageParcel reply;
25 MessageOption option(MessageOption::TF_ASYNC);
26 if (!data.WriteInterfaceToken(GetDescriptor())) {
27 TLOGE(WmsLogTag::WMS_LIFE, "WriteInterfaceToken failed");
28 return;
29 }
30 if (!data.WriteInt32(persisitentId)) {
31 TLOGE(WmsLogTag::WMS_LIFE, "Write persisitentId failed");
32 return;
33 }
34 sptr<IRemoteObject> remote = Remote();
35 if (remote == nullptr) {
36 TLOGE(WmsLogTag::WMS_LIFE, "remote is null");
37 return;
38 }
39 if (remote->SendRequest(static_cast<uint32_t>(PatternDetachCallbackMessage::TRANS_ID_PATTERN_ON_DETACH),
40 data, reply, option) != ERR_NONE) {
41 TLOGE(WmsLogTag::WMS_LIFE, "SendRequest failed");
42 }
43 }
44
45 } // namespace Rosen
46 } // namespace OHOS
47
48