• 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_stub.h"
17 
18 #include "ans_log_wrapper.h"
19 
20 namespace OHOS::Notification {
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)21 int32_t AnsDialogCallbackStub::OnRemoteRequest(uint32_t code, MessageParcel& data,
22     MessageParcel& reply, MessageOption& option)
23 {
24     if (code != AnsDialogCallback::ON_DIALOG_STATUS_CHANGED ||
25         data.ReadInterfaceToken() != AnsDialogCallback::GetDescriptor()) {
26         ANS_LOGE("Invalid request.");
27         return ERR_INVALID_STATE;
28     }
29 
30     std::unique_ptr<DialogStatusData> result(data.ReadParcelable<DialogStatusData>());
31     if (result == nullptr) {
32         ANS_LOGE("DialogStatusData is nullptr");
33         return ERR_INVALID_STATE;
34     }
35     OnDialogStatusChanged(*result);
36     return ERR_NONE;
37 }
38 } // namespace OHOS::Notification
39