1 /*
2 * Copyright (c) 2022 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_window_animation_finished_callback_proxy.h"
17
18 #include "rs_window_animation_log.h"
19
20 namespace OHOS {
21 namespace Rosen {
RSWindowAnimationFinishedCallbackProxy(const sptr<IRemoteObject> & impl)22 RSWindowAnimationFinishedCallbackProxy::RSWindowAnimationFinishedCallbackProxy(const sptr<IRemoteObject>& impl)
23 : IRemoteProxy<RSIWindowAnimationFinishedCallback>(impl)
24 {
25 }
26
WriteInterfaceToken(MessageParcel & data)27 bool RSWindowAnimationFinishedCallbackProxy::WriteInterfaceToken(MessageParcel& data)
28 {
29 if (!data.WriteInterfaceToken(RSWindowAnimationFinishedCallbackProxy::GetDescriptor())) {
30 WALOGE("Failed to write interface token!");
31 return false;
32 }
33
34 return true;
35 }
36
OnAnimationFinished()37 void RSWindowAnimationFinishedCallbackProxy::OnAnimationFinished()
38 {
39 MessageParcel data;
40 MessageParcel reply;
41 MessageOption option(MessageOption::TF_ASYNC);
42
43 WALOGD("Window animation finished callback proxy on transition!");
44 if (!WriteInterfaceToken(data)) {
45 return;
46 }
47
48 auto remote = Remote();
49 if (remote == nullptr) {
50 WALOGE("remote is null!");
51 return;
52 }
53
54 auto ret = remote->SendRequest(RSWindowAnimationFinishedCallbackProxy::ON_ANIMATION_FINISHED, data, reply, option);
55 if (ret != NO_ERROR) {
56 WALOGE("Failed to send animation finished callback request, error code:%d", ret);
57 }
58 }
59 } // namespace Rosen
60 } // namespace OHOS
61