• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 "ans_dialog_callback_proxy.h"
17 
18 #include "ans_log_wrapper.h"
19 
20 namespace OHOS::Notification {
OnDialogStatusChanged(const DialogStatusData & statusData)21 void AnsDialogCallbackProxy::OnDialogStatusChanged(const DialogStatusData& statusData)
22 {
23     ANS_LOGD("enter");
24     MessageParcel data;
25     if (!data.WriteInterfaceToken(AnsDialogCallback::GetDescriptor())) {
26         ANS_LOGE("Write interface token failed.");
27         return;
28     }
29     if (!data.WriteParcelable(&statusData)) {
30         ANS_LOGE("Write statusData failed.");
31         return;
32     }
33 
34     sptr<IRemoteObject> remote = Remote();
35     if (remote == nullptr) {
36         ANS_LOGE("Remote is NULL");
37         return;
38     }
39 
40     MessageParcel reply;
41     MessageOption option;
42     int error = remote->SendRequest(ON_DIALOG_STATUS_CHANGED, data, reply, option);
43     if (error != ERR_OK) {
44         ANS_LOGE("SendRequest fail, error: %{public}d", error);
45     }
46 }
47 } // namespace OHOS::Notification
48