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