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 #include "ui_effect_controller_client_stub.h"
16 #include "ui_effect_controller_common.h"
17
18 namespace OHOS::Rosen {
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)19 int32_t UIEffectControllerClientStub::OnRemoteRequest(uint32_t code, MessageParcel& data,
20 MessageParcel& reply, MessageOption& option)
21 {
22 if (data.ReadInterfaceToken() != GetDescriptor()) {
23 TLOGE(WmsLogTag::WMS_ANIMATION, "Failed to check interface token!");
24 return ERR_TRANSACTION_FAILED;
25 }
26 switch (code) {
27 case static_cast<uint32_t>(UIEffectControllerClientMessage::TRANS_ID_UIEFFECT_SET_PARAM):
28 return HandleSetParams(data, reply);
29 default:
30 TLOGE(WmsLogTag::WMS_ANIMATION, "Failed to find function handler!");
31 return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
32 }
33 }
34
HandleSetParams(MessageParcel & data,MessageParcel & reply)35 int32_t UIEffectControllerClientStub::HandleSetParams(MessageParcel& data, MessageParcel& reply)
36 {
37 sptr<UIEffectParams> params = data.ReadStrongParcelable<UIEffectParams>();
38 if (params == nullptr) {
39 TLOGE(WmsLogTag::WMS_ANIMATION, "read ui effect params failed");
40 return ERR_INVALID_DATA;
41 }
42 SetParams(params);
43 return ERR_NONE;
44 }
45 } // namespace OHOS::Rosen