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_stub.h"
17 
18 namespace OHOS {
19 namespace Rosen {
20 
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)21 int PatternDetachCallbackStub::OnRemoteRequest(uint32_t code, MessageParcel& data,
22     MessageParcel& reply, MessageOption& option)
23 {
24     TLOGD(WmsLogTag::WMS_LIFE, "OnRemoteRequest code is %{public}u", code);
25     if (data.ReadInterfaceToken() != GetDescriptor()) {
26         TLOGE(WmsLogTag::WMS_LIFE, "InterfaceToken check failed");
27         return ERR_TRANSACTION_FAILED;
28     }
29     PatternDetachCallbackMessage msgId = static_cast<PatternDetachCallbackMessage>(code);
30     switch (msgId) {
31         case PatternDetachCallbackMessage::TRANS_ID_PATTERN_ON_DETACH: {
32             auto persisitentId = data.ReadInt32();
33             OnPatternDetach(persisitentId);
34             break;
35         }
36         default:
37             TLOGW(WmsLogTag::WMS_LIFE, "Unknown transaction code %{public}d", code);
38             return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
39     }
40     return ERR_NONE;
41 }
42 } // namespace Rosen
43 } // namespace OHOS
44