1 /*
2 * Copyright (c) 2021-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 "ans_manager_stub.h"
17 #include "ans_const_define.h"
18 #include "ans_inner_errors.h"
19 #include "ans_log_wrapper.h"
20 #include "message_option.h"
21 #include "message_parcel.h"
22 #include "parcel.h"
23 #include "reminder_request_alarm.h"
24 #include "reminder_request_calendar.h"
25 #include "reminder_request_timer.h"
26
27 namespace OHOS {
28 namespace Notification {
29 const std::map<uint32_t, std::function<ErrCode(AnsManagerStub *, MessageParcel &, MessageParcel &)>>
30 AnsManagerStub::interfaces_ = {
31 {AnsManagerStub::PUBLISH_NOTIFICATION,
32 std::bind(
33 &AnsManagerStub::HandlePublish, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)},
34 {AnsManagerStub::PUBLISH_NOTIFICATION_TO_DEVICE,
35 std::bind(&AnsManagerStub::HandlePublishToDevice, std::placeholders::_1, std::placeholders::_2,
36 std::placeholders::_3)},
37 {AnsManagerStub::CANCEL_NOTIFICATION,
38 std::bind(
39 &AnsManagerStub::HandleCancel, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)},
40 {AnsManagerStub::CANCEL_ALL_NOTIFICATIONS,
41 std::bind(
42 &AnsManagerStub::HandleCancelAll, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)},
43 {AnsManagerStub::CANCEL_AS_BUNDLE,
44 std::bind(&AnsManagerStub::HandleCancelAsBundle, std::placeholders::_1, std::placeholders::_2,
45 std::placeholders::_3)},
46 {AnsManagerStub::ADD_SLOT_BY_TYPE,
47 std::bind(&AnsManagerStub::HandleAddSlotByType, std::placeholders::_1, std::placeholders::_2,
48 std::placeholders::_3)},
49 {AnsManagerStub::ADD_SLOTS,
50 std::bind(
51 &AnsManagerStub::HandleAddSlots, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)},
52 {AnsManagerStub::REMOVE_SLOT_BY_TYPE,
53 std::bind(&AnsManagerStub::HandleRemoveSlotByType, std::placeholders::_1, std::placeholders::_2,
54 std::placeholders::_3)},
55 {AnsManagerStub::REMOVE_ALL_SLOTS,
56 std::bind(&AnsManagerStub::HandleRemoveAllSlots, std::placeholders::_1, std::placeholders::_2,
57 std::placeholders::_3)},
58 {AnsManagerStub::GET_SLOT_BY_TYPE,
59 std::bind(&AnsManagerStub::HandleGetSlotByType, std::placeholders::_1, std::placeholders::_2,
60 std::placeholders::_3)},
61 {AnsManagerStub::GET_SLOTS,
62 std::bind(
63 &AnsManagerStub::HandleGetSlots, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)},
64 {AnsManagerStub::GET_SLOT_NUM_AS_BUNDLE,
65 std::bind(&AnsManagerStub::HandleGetSlotNumAsBundle, std::placeholders::_1, std::placeholders::_2,
66 std::placeholders::_3)},
67 {AnsManagerStub::GET_ACTIVE_NOTIFICATIONS,
68 std::bind(&AnsManagerStub::HandleGetActiveNotifications, std::placeholders::_1, std::placeholders::_2,
69 std::placeholders::_3)},
70 {AnsManagerStub::GET_ACTIVE_NOTIFICATION_NUMS,
71 std::bind(&AnsManagerStub::HandleGetActiveNotificationNums, std::placeholders::_1, std::placeholders::_2,
72 std::placeholders::_3)},
73 {AnsManagerStub::GET_ALL_ACTIVE_NOTIFICATIONS,
74 std::bind(&AnsManagerStub::HandleGetAllActiveNotifications, std::placeholders::_1, std::placeholders::_2,
75 std::placeholders::_3)},
76 {AnsManagerStub::GET_SPECIAL_ACTIVE_NOTIFICATIONS,
77 std::bind(&AnsManagerStub::HandleGetSpecialActiveNotifications, std::placeholders::_1,
78 std::placeholders::_2, std::placeholders::_3)},
79 {AnsManagerStub::SET_NOTIFICATION_AGENT,
80 std::bind(&AnsManagerStub::HandleSetNotificationAgent, std::placeholders::_1, std::placeholders::_2,
81 std::placeholders::_3)},
82 {AnsManagerStub::GET_NOTIFICATION_AGENT,
83 std::bind(&AnsManagerStub::HandleGetNotificationAgent, std::placeholders::_1, std::placeholders::_2,
84 std::placeholders::_3)},
85 {AnsManagerStub::CAN_PUBLISH_AS_BUNDLE,
86 std::bind(&AnsManagerStub::HandleCanPublishAsBundle, std::placeholders::_1, std::placeholders::_2,
87 std::placeholders::_3)},
88 {AnsManagerStub::PUBLISH_AS_BUNDLE,
89 std::bind(&AnsManagerStub::HandlePublishAsBundle, std::placeholders::_1, std::placeholders::_2,
90 std::placeholders::_3)},
91 {AnsManagerStub::SET_NOTIFICATION_BADGE_NUM,
92 std::bind(&AnsManagerStub::HandleSetNotificationBadgeNum, std::placeholders::_1, std::placeholders::_2,
93 std::placeholders::_3)},
94 {AnsManagerStub::GET_BUNDLE_IMPORTANCE,
95 std::bind(&AnsManagerStub::HandleGetBundleImportance, std::placeholders::_1, std::placeholders::_2,
96 std::placeholders::_3)},
97 {AnsManagerStub::IS_NOTIFICATION_POLICY_ACCESS_GRANTED,
98 std::bind(&AnsManagerStub::HandleIsNotificationPolicyAccessGranted, std::placeholders::_1,
99 std::placeholders::_2, std::placeholders::_3)},
100 {AnsManagerStub::SET_PRIVATIVE_NOTIFICATIONS_ALLOWED,
101 std::bind(&AnsManagerStub::HandleSetPrivateNotificationsAllowed, std::placeholders::_1,
102 std::placeholders::_2, std::placeholders::_3)},
103 {AnsManagerStub::GET_PRIVATIVE_NOTIFICATIONS_ALLOWED,
104 std::bind(&AnsManagerStub::HandleGetPrivateNotificationsAllowed, std::placeholders::_1,
105 std::placeholders::_2, std::placeholders::_3)},
106 {AnsManagerStub::REMOVE_NOTIFICATION,
107 std::bind(&AnsManagerStub::HandleRemoveNotification, std::placeholders::_1, std::placeholders::_2,
108 std::placeholders::_3)},
109 {AnsManagerStub::REMOVE_ALL_NOTIFICATIONS,
110 std::bind(&AnsManagerStub::HandleRemoveAllNotifications, std::placeholders::_1, std::placeholders::_2,
111 std::placeholders::_3)},
112 {AnsManagerStub::DELETE_NOTIFICATION,
113 std::bind(
114 &AnsManagerStub::HandleDelete, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)},
115 {AnsManagerStub::DELETE_NOTIFICATION_BY_BUNDLE,
116 std::bind(&AnsManagerStub::HandleDeleteByBundle, std::placeholders::_1, std::placeholders::_2,
117 std::placeholders::_3)},
118 {AnsManagerStub::DELETE_ALL_NOTIFICATIONS,
119 std::bind(
120 &AnsManagerStub::HandleDeleteAll, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)},
121 {AnsManagerStub::GET_SLOTS_BY_BUNDLE,
122 std::bind(&AnsManagerStub::HandleGetSlotsByBundle, std::placeholders::_1, std::placeholders::_2,
123 std::placeholders::_3)},
124 {AnsManagerStub::UPDATE_SLOTS,
125 std::bind(&AnsManagerStub::HandleUpdateSlots, std::placeholders::_1, std::placeholders::_2,
126 std::placeholders::_3)},
127 {AnsManagerStub::REQUEST_ENABLE_NOTIFICATION,
128 std::bind(&AnsManagerStub::HandleRequestEnableNotification, std::placeholders::_1, std::placeholders::_2,
129 std::placeholders::_3)},
130 {AnsManagerStub::SET_NOTIFICATION_ENABLED_FOR_BUNDLE,
131 std::bind(&AnsManagerStub::HandleSetNotificationsEnabledForBundle, std::placeholders::_1,
132 std::placeholders::_2, std::placeholders::_3)},
133 {AnsManagerStub::SET_NOTIFICATION_ENABLED_FOR_ALL_BUNDLE,
134 std::bind(&AnsManagerStub::HandleSetNotificationsEnabledForAllBundles, std::placeholders::_1,
135 std::placeholders::_2, std::placeholders::_3)},
136 {AnsManagerStub::SET_NOTIFICATION_ENABLED_FOR_SPECIAL_BUNDLE,
137 std::bind(&AnsManagerStub::HandleSetNotificationsEnabledForSpecialBundle, std::placeholders::_1,
138 std::placeholders::_2, std::placeholders::_3)},
139 {AnsManagerStub::SET_SHOW_BADGE_ENABLED_FOR_BUNDLE,
140 std::bind(&AnsManagerStub::HandleSetShowBadgeEnabledForBundle, std::placeholders::_1, std::placeholders::_2,
141 std::placeholders::_3)},
142 {AnsManagerStub::GET_SHOW_BADGE_ENABLED_FOR_BUNDLE,
143 std::bind(&AnsManagerStub::HandleGetShowBadgeEnabledForBundle, std::placeholders::_1, std::placeholders::_2,
144 std::placeholders::_3)},
145 {AnsManagerStub::GET_SHOW_BADGE_ENABLED,
146 std::bind(&AnsManagerStub::HandleGetShowBadgeEnabled, std::placeholders::_1, std::placeholders::_2,
147 std::placeholders::_3)},
148 {AnsManagerStub::SUBSCRIBE_NOTIFICATION,
149 std::bind(
150 &AnsManagerStub::HandleSubscribe, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)},
151 {AnsManagerStub::UNSUBSCRIBE_NOTIFICATION,
152 std::bind(&AnsManagerStub::HandleUnsubscribe, std::placeholders::_1, std::placeholders::_2,
153 std::placeholders::_3)},
154 {AnsManagerStub::ARE_NOTIFICATION_SUSPENDED,
155 std::bind(&AnsManagerStub::HandleAreNotificationsSuspended, std::placeholders::_1, std::placeholders::_2,
156 std::placeholders::_3)},
157 {AnsManagerStub::GET_CURRENT_APP_SORTING,
158 std::bind(&AnsManagerStub::HandleGetCurrentAppSorting, std::placeholders::_1, std::placeholders::_2,
159 std::placeholders::_3)},
160 {AnsManagerStub::IS_ALLOWED_NOTIFY,
161 std::bind(&AnsManagerStub::HandleIsAllowedNotify, std::placeholders::_1, std::placeholders::_2,
162 std::placeholders::_3)},
163 {AnsManagerStub::IS_ALLOWED_NOTIFY_SELF,
164 std::bind(&AnsManagerStub::HandleIsAllowedNotifySelf, std::placeholders::_1, std::placeholders::_2,
165 std::placeholders::_3)},
166 {AnsManagerStub::IS_SPECIAL_BUNDLE_ALLOWED_NOTIFY,
167 std::bind(&AnsManagerStub::HandleIsSpecialBundleAllowedNotify, std::placeholders::_1, std::placeholders::_2,
168 std::placeholders::_3)},
169 {AnsManagerStub::SET_DO_NOT_DISTURB_DATE,
170 std::bind(&AnsManagerStub::HandleSetDoNotDisturbDate, std::placeholders::_1, std::placeholders::_2,
171 std::placeholders::_3)},
172 {AnsManagerStub::GET_DO_NOT_DISTURB_DATE,
173 std::bind(&AnsManagerStub::HandleGetDoNotDisturbDate, std::placeholders::_1, std::placeholders::_2,
174 std::placeholders::_3)},
175 {AnsManagerStub::DOES_SUPPORT_DO_NOT_DISTURB_MODE,
176 std::bind(&AnsManagerStub::HandleDoesSupportDoNotDisturbMode, std::placeholders::_1, std::placeholders::_2,
177 std::placeholders::_3)},
178 {AnsManagerStub::CANCEL_GROUP,
179 std::bind(&AnsManagerStub::HandleCancelGroup, std::placeholders::_1, std::placeholders::_2,
180 std::placeholders::_3)},
181 {AnsManagerStub::REMOVE_GROUP_BY_BUNDLE,
182 std::bind(&AnsManagerStub::HandleRemoveGroupByBundle, std::placeholders::_1, std::placeholders::_2,
183 std::placeholders::_3)},
184 {AnsManagerStub::IS_DISTRIBUTED_ENABLED,
185 std::bind(&AnsManagerStub::HandleIsDistributedEnabled, std::placeholders::_1, std::placeholders::_2,
186 std::placeholders::_3)},
187 {AnsManagerStub::ENABLE_DISTRIBUTED,
188 std::bind(&AnsManagerStub::HandleEnableDistributed, std::placeholders::_1, std::placeholders::_2,
189 std::placeholders::_3)},
190 {AnsManagerStub::ENABLE_DISTRIBUTED_BY_BUNDLE,
191 std::bind(&AnsManagerStub::HandleEnableDistributedByBundle, std::placeholders::_1, std::placeholders::_2,
192 std::placeholders::_3)},
193 {AnsManagerStub::ENABLE_DISTRIBUTED_SELF,
194 std::bind(&AnsManagerStub::HandleEnableDistributedSelf, std::placeholders::_1, std::placeholders::_2,
195 std::placeholders::_3)},
196 {AnsManagerStub::IS_DISTRIBUTED_ENABLED_BY_BUNDLE,
197 std::bind(&AnsManagerStub::HandleIsDistributedEnableByBundle, std::placeholders::_1, std::placeholders::_2,
198 std::placeholders::_3)},
199 {AnsManagerStub::GET_DEVICE_REMIND_TYPE,
200 std::bind(&AnsManagerStub::HandleGetDeviceRemindType, std::placeholders::_1, std::placeholders::_2,
201 std::placeholders::_3)},
202 {AnsManagerStub::SHELL_DUMP,
203 std::bind(
204 &AnsManagerStub::HandleShellDump, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)},
205 {AnsManagerStub::PUBLISH_CONTINUOUS_TASK_NOTIFICATION,
206 std::bind(
207 &AnsManagerStub::HandlePublishContinuousTaskNotification, std::placeholders::_1, std::placeholders::_2,
208 std::placeholders::_3)},
209 {AnsManagerStub::CANCEL_CONTINUOUS_TASK_NOTIFICATION,
210 std::bind(
211 &AnsManagerStub::HandleCancelContinuousTaskNotification, std::placeholders::_1, std::placeholders::_2,
212 std::placeholders::_3)},
213 {AnsManagerStub::PUBLISH_REMINDER,
214 std::bind(&AnsManagerStub::HandlePublishReminder, std::placeholders::_1, std::placeholders::_2,
215 std::placeholders::_3)},
216 {AnsManagerStub::CANCEL_REMINDER,
217 std::bind(&AnsManagerStub::HandleCancelReminder, std::placeholders::_1, std::placeholders::_2,
218 std::placeholders::_3)},
219 {AnsManagerStub::CANCEL_ALL_REMINDERS,
220 std::bind(
221 &AnsManagerStub::HandleCancelAllReminders, std::placeholders::_1, std::placeholders::_2,
222 std::placeholders::_3)},
223 {AnsManagerStub::GET_ALL_VALID_REMINDERS,
224 std::bind(&AnsManagerStub::HandleGetValidReminders, std::placeholders::_1, std::placeholders::_2,
225 std::placeholders::_3)},
226 {AnsManagerStub::IS_SUPPORT_TEMPLATE,
227 std::bind(
228 &AnsManagerStub::HandleIsSupportTemplate, std::placeholders::_1, std::placeholders::_2,
229 std::placeholders::_3)},
230 {AnsManagerStub::IS_SPECIAL_USER_ALLOWED_NOTIFY,
231 std::bind(&AnsManagerStub::HandleIsSpecialUserAllowedNotifyByUser, std::placeholders::_1,
232 std::placeholders::_2, std::placeholders::_3)},
233 {AnsManagerStub::SET_NOTIFICATION_ENABLED_BY_USER,
234 std::bind(&AnsManagerStub::HandleSetNotificationsEnabledByUser, std::placeholders::_1,
235 std::placeholders::_2, std::placeholders::_3)},
236 {AnsManagerStub::DELETE_ALL_NOTIFICATIONS_BY_USER,
237 std::bind(&AnsManagerStub::HandleDeleteAllByUser, std::placeholders::_1, std::placeholders::_2,
238 std::placeholders::_3)},
239 {AnsManagerStub::SET_DO_NOT_DISTURB_DATE_BY_USER,
240 std::bind(&AnsManagerStub::HandleSetDoNotDisturbDateByUser, std::placeholders::_1, std::placeholders::_2,
241 std::placeholders::_3)},
242 {AnsManagerStub::GET_DO_NOT_DISTURB_DATE_BY_USER,
243 std::bind(&AnsManagerStub::HandleGetDoNotDisturbDateByUser, std::placeholders::_1, std::placeholders::_2,
244 std::placeholders::_3)},
245 {AnsManagerStub::SET_ENABLED_FOR_BUNDLE_SLOT,
246 std::bind(&AnsManagerStub::HandleSetEnabledForBundleSlot, std::placeholders::_1, std::placeholders::_2,
247 std::placeholders::_3)},
248 {AnsManagerStub::GET_ENABLED_FOR_BUNDLE_SLOT,
249 std::bind(&AnsManagerStub::HandleGetEnabledForBundleSlot, std::placeholders::_1, std::placeholders::_2,
250 std::placeholders::_3)},
251 {AnsManagerStub::SET_SYNC_NOTIFICATION_ENABLED_WITHOUT_APP,
252 std::bind(&AnsManagerStub::HandleDistributedSetEnabledWithoutApp, std::placeholders::_1,
253 std::placeholders::_2, std::placeholders::_3)},
254 {AnsManagerStub::GET_SYNC_NOTIFICATION_ENABLED_WITHOUT_APP,
255 std::bind(&AnsManagerStub::HandleDistributedGetEnabledWithoutApp, std::placeholders::_1,
256 std::placeholders::_2, std::placeholders::_3)},
257 };
258
AnsManagerStub()259 AnsManagerStub::AnsManagerStub()
260 {}
261
~AnsManagerStub()262 AnsManagerStub::~AnsManagerStub()
263 {}
264
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & flags)265 int32_t AnsManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &flags)
266 {
267 std::u16string descriptor = AnsManagerStub::GetDescriptor();
268 std::u16string remoteDescriptor = data.ReadInterfaceToken();
269 if (descriptor != remoteDescriptor) {
270 ANS_LOGE("[OnRemoteRequest] fail: invalid interface token!");
271 return OBJECT_NULL;
272 }
273
274 auto it = interfaces_.find(code);
275 if (it == interfaces_.end()) {
276 ANS_LOGE("[OnRemoteRequest] fail: unknown code!");
277 return IRemoteStub<AnsManagerInterface>::OnRemoteRequest(code, data, reply, flags);
278 }
279
280 auto fun = it->second;
281 if (fun == nullptr) {
282 ANS_LOGE("[OnRemoteRequest] fail: not find function!");
283 return IRemoteStub<AnsManagerInterface>::OnRemoteRequest(code, data, reply, flags);
284 }
285
286 ErrCode result = fun(this, data, reply);
287 if (SUCCEEDED(result)) {
288 return NO_ERROR;
289 }
290
291 ANS_LOGE("[OnRemoteRequest] fail: Failed to call interface %{public}u, err:%{public}d", code, result);
292 return result;
293 }
294
HandlePublish(MessageParcel & data,MessageParcel & reply)295 ErrCode AnsManagerStub::HandlePublish(MessageParcel &data, MessageParcel &reply)
296 {
297 std::string label;
298 if (!data.ReadString(label)) {
299 ANS_LOGE("[HandlePublish] fail: read label failed");
300 return ERR_ANS_PARCELABLE_FAILED;
301 }
302
303 sptr<NotificationRequest> notification = data.ReadParcelable<NotificationRequest>();
304 if (!notification) {
305 ANS_LOGE("[HandlePublish] fail: notification ReadParcelable failed");
306 return ERR_ANS_PARCELABLE_FAILED;
307 }
308
309 ErrCode result = Publish(label, notification);
310 if (!reply.WriteInt32(result)) {
311 ANS_LOGE("[HandlePublish] fail: write result failed, ErrCode=%{public}d", result);
312 return ERR_ANS_PARCELABLE_FAILED;
313 }
314 return ERR_OK;
315 }
316
HandlePublishToDevice(MessageParcel & data,MessageParcel & reply)317 ErrCode AnsManagerStub::HandlePublishToDevice(MessageParcel &data, MessageParcel &reply)
318 {
319 sptr<NotificationRequest> notification = data.ReadParcelable<NotificationRequest>();
320 if (!notification) {
321 ANS_LOGE("[HandlePublishToDevice] fail: notification ReadParcelable failed");
322 return ERR_ANS_PARCELABLE_FAILED;
323 }
324
325 std::string deviceId;
326 if (!data.ReadString(deviceId)) {
327 ANS_LOGE("[HandlePublishToDevice] fail: read deviceId failed");
328 return ERR_ANS_PARCELABLE_FAILED;
329 }
330
331 ErrCode result = PublishToDevice(notification, deviceId);
332 if (!reply.WriteInt32(result)) {
333 ANS_LOGE("[HandlePublishToDevice] fail: write result failed, ErrCode=%{public}d", result);
334 return ERR_ANS_PARCELABLE_FAILED;
335 }
336 return ERR_OK;
337 }
338
HandleCancel(MessageParcel & data,MessageParcel & reply)339 ErrCode AnsManagerStub::HandleCancel(MessageParcel &data, MessageParcel &reply)
340 {
341 int32_t notificationId = 0;
342 if (!data.ReadInt32(notificationId)) {
343 ANS_LOGE("[HandleCancel] fail: read notificationId failed");
344 return ERR_ANS_PARCELABLE_FAILED;
345 }
346
347 std::string label;
348 if (!data.ReadString(label)) {
349 ANS_LOGE("[HandleCancel] fail: read label failed");
350 return ERR_ANS_PARCELABLE_FAILED;
351 }
352
353 ErrCode result = Cancel(notificationId, label);
354 if (!reply.WriteInt32(result)) {
355 ANS_LOGE("[HandleCancel] fail: write result failed, ErrCode=%{public}d", result);
356 return ERR_ANS_PARCELABLE_FAILED;
357 }
358 return ERR_OK;
359 }
360
HandleCancelAll(MessageParcel & data,MessageParcel & reply)361 ErrCode AnsManagerStub::HandleCancelAll(MessageParcel &data, MessageParcel &reply)
362 {
363 ErrCode result = CancelAll();
364 if (!reply.WriteInt32(result)) {
365 ANS_LOGE("[HandleCancelAll] fail: write result failed, ErrCode=%{public}d", result);
366 return ERR_ANS_PARCELABLE_FAILED;
367 }
368 return ERR_OK;
369 }
370
HandleCancelAsBundle(MessageParcel & data,MessageParcel & reply)371 ErrCode AnsManagerStub::HandleCancelAsBundle(MessageParcel &data, MessageParcel &reply)
372 {
373 int32_t notificationId = 0;
374 if (!data.ReadInt32(notificationId)) {
375 ANS_LOGE("[HandleCancelAsBundle] fail: read notificationId failed");
376 return ERR_ANS_PARCELABLE_FAILED;
377 }
378
379 std::string representativeBundle;
380 if (!data.ReadString(representativeBundle)) {
381 ANS_LOGE("[HandleCancelAsBundle] fail: read representativeBundle failed");
382 return ERR_ANS_PARCELABLE_FAILED;
383 }
384
385 int32_t userId = 0;
386 if (!data.ReadInt32(userId)) {
387 ANS_LOGE("[HandleCancelAsBundle] fail: read userId failed");
388 return ERR_ANS_PARCELABLE_FAILED;
389 }
390
391 ErrCode result = CancelAsBundle(notificationId, representativeBundle, userId);
392 if (!reply.WriteInt32(result)) {
393 ANS_LOGE("[HandleCancelAsBundle] fail: write result failed, ErrCode=%{public}d", result);
394 return ERR_ANS_PARCELABLE_FAILED;
395 }
396 return ERR_OK;
397 }
398
HandleAddSlotByType(MessageParcel & data,MessageParcel & reply)399 ErrCode AnsManagerStub::HandleAddSlotByType(MessageParcel &data, MessageParcel &reply)
400 {
401 NotificationConstant::SlotType slotType = static_cast<NotificationConstant::SlotType>(data.ReadInt32());
402 ErrCode result = AddSlotByType(slotType);
403 if (!reply.WriteInt32(result)) {
404 ANS_LOGE("[HandleAddSlotByType] fail: write result failed, ErrCode=%{public}d", result);
405 return ERR_ANS_PARCELABLE_FAILED;
406 }
407 return ERR_OK;
408 }
409
HandleAddSlots(MessageParcel & data,MessageParcel & reply)410 ErrCode AnsManagerStub::HandleAddSlots(MessageParcel &data, MessageParcel &reply)
411 {
412 std::vector<sptr<NotificationSlot>> slots;
413 if (!ReadParcelableVector(slots, data)) {
414 ANS_LOGE("[HandleAddSlots] fail: read slotsSize failed");
415 return ERR_ANS_PARCELABLE_FAILED;
416 }
417 ErrCode result = AddSlots(slots);
418 if (!reply.WriteInt32(result)) {
419 ANS_LOGE("[HandleAddSlots] fail: write result failed, ErrCode=%{public}d", result);
420 return ERR_ANS_PARCELABLE_FAILED;
421 }
422 return ERR_OK;
423 }
424
HandleRemoveSlotByType(MessageParcel & data,MessageParcel & reply)425 ErrCode AnsManagerStub::HandleRemoveSlotByType(MessageParcel &data, MessageParcel &reply)
426 {
427 NotificationConstant::SlotType slotType = static_cast<NotificationConstant::SlotType>(data.ReadInt32());
428
429 ErrCode result = RemoveSlotByType(slotType);
430 if (!reply.WriteInt32(result)) {
431 ANS_LOGE("[HandleRemoveSlotByType] fail: write result failed, ErrCode=%{public}d", result);
432 return ERR_ANS_PARCELABLE_FAILED;
433 }
434 return ERR_OK;
435 }
436
HandleRemoveAllSlots(MessageParcel & data,MessageParcel & reply)437 ErrCode AnsManagerStub::HandleRemoveAllSlots(MessageParcel &data, MessageParcel &reply)
438 {
439 ErrCode result = RemoveAllSlots();
440 if (!reply.WriteInt32(result)) {
441 ANS_LOGE("[HandleRemoveAllSlots] fail: write result failed, ErrCode=%{public}d", result);
442 return ERR_ANS_PARCELABLE_FAILED;
443 }
444 return ERR_OK;
445 }
446
HandleGetSlots(MessageParcel & data,MessageParcel & reply)447 ErrCode AnsManagerStub::HandleGetSlots(MessageParcel &data, MessageParcel &reply)
448 {
449 std::vector<sptr<NotificationSlot>> slots;
450 ErrCode result = GetSlots(slots);
451 if (!WriteParcelableVector(slots, reply, result)) {
452 ANS_LOGE("[HandleGetSlots] fail: write slots failed");
453 return ERR_ANS_PARCELABLE_FAILED;
454 }
455
456 return ERR_OK;
457 }
458
HandleGetSlotByType(MessageParcel & data,MessageParcel & reply)459 ErrCode AnsManagerStub::HandleGetSlotByType(MessageParcel &data, MessageParcel &reply)
460 {
461 NotificationConstant::SlotType slotType = static_cast<NotificationConstant::SlotType>(data.ReadInt32());
462
463 sptr<NotificationSlot> slot = nullptr;
464 ErrCode result = GetSlotByType(slotType, slot);
465 if (!reply.WriteInt32(result)) {
466 ANS_LOGE("[HandleGetSlotByType] fail: write result failed, ErrCode=%{public}d", result);
467 return ERR_ANS_PARCELABLE_FAILED;
468 }
469
470 if (!reply.WriteParcelable(slot)) {
471 ANS_LOGE("[HandleGetSlotByType] fail: write slot failed.");
472 return ERR_ANS_PARCELABLE_FAILED;
473 }
474 return ERR_OK;
475 }
476
HandleGetSlotNumAsBundle(MessageParcel & data,MessageParcel & reply)477 ErrCode AnsManagerStub::HandleGetSlotNumAsBundle(MessageParcel &data, MessageParcel &reply)
478 {
479 sptr<NotificationBundleOption> bundleOption = data.ReadStrongParcelable<NotificationBundleOption>();
480 if (bundleOption == nullptr) {
481 ANS_LOGE("[HandleGetSlotNumAsBundle] fail: read bundle failed.");
482 return ERR_ANS_PARCELABLE_FAILED;
483 }
484
485 uint64_t num = 0;
486 ErrCode result = GetSlotNumAsBundle(bundleOption, num);
487 if (!reply.WriteInt32(result)) {
488 ANS_LOGE("[HandleGetSlotNumAsBundle] fail: write result failed, ErrCode=%{public}d", result);
489 return ERR_ANS_PARCELABLE_FAILED;
490 }
491
492 if (!reply.WriteUint64(num)) {
493 ANS_LOGE("[HandleGetSlotNumAsBundle] fail: write enabled failed, ErrCode=%{public}d", result);
494 return ERR_ANS_PARCELABLE_FAILED;
495 }
496 return ERR_OK;
497 }
498
HandleGetActiveNotifications(MessageParcel & data,MessageParcel & reply)499 ErrCode AnsManagerStub::HandleGetActiveNotifications(MessageParcel &data, MessageParcel &reply)
500 {
501 std::vector<sptr<NotificationRequest>> notifications;
502 ErrCode result = GetActiveNotifications(notifications);
503 if (!WriteParcelableVector(notifications, reply, result)) {
504 ANS_LOGE("[HandleGetActiveNotifications] fail: write notifications failed");
505 return ERR_ANS_PARCELABLE_FAILED;
506 }
507 return ERR_OK;
508 }
509
HandleGetActiveNotificationNums(MessageParcel & data,MessageParcel & reply)510 ErrCode AnsManagerStub::HandleGetActiveNotificationNums(MessageParcel &data, MessageParcel &reply)
511 {
512 uint64_t num = 0;
513 ErrCode result = GetActiveNotificationNums(num);
514 if (!reply.WriteInt32(result)) {
515 ANS_LOGE("[HandleGetActiveNotificationNums] fail: write result failed, ErrCode=%{public}d", result);
516 return ERR_ANS_PARCELABLE_FAILED;
517 }
518
519 if (!reply.WriteUint64(num)) {
520 ANS_LOGE("[HandleGetActiveNotificationNums] fail: write num failed");
521 return ERR_ANS_PARCELABLE_FAILED;
522 }
523 return ERR_OK;
524 }
525
HandleGetAllActiveNotifications(MessageParcel & data,MessageParcel & reply)526 ErrCode AnsManagerStub::HandleGetAllActiveNotifications(MessageParcel &data, MessageParcel &reply)
527 {
528 std::vector<sptr<Notification>> notifications;
529 ErrCode result = GetAllActiveNotifications(notifications);
530 if (!WriteParcelableVector(notifications, reply, result)) {
531 ANS_LOGE("[HandleGetAllActiveNotifications] fail: write notifications failed");
532 return ERR_ANS_PARCELABLE_FAILED;
533 }
534 return ERR_OK;
535 }
536
HandleGetSpecialActiveNotifications(MessageParcel & data,MessageParcel & reply)537 ErrCode AnsManagerStub::HandleGetSpecialActiveNotifications(MessageParcel &data, MessageParcel &reply)
538 {
539 std::vector<std::string> key;
540 if (!data.ReadStringVector(&key)) {
541 ANS_LOGE("[HandleGetSpecialActiveNotifications] fail: read key failed");
542 return ERR_ANS_PARCELABLE_FAILED;
543 }
544
545 std::vector<sptr<Notification>> notifications;
546 ErrCode result = GetSpecialActiveNotifications(key, notifications);
547 if (!WriteParcelableVector(notifications, reply, result)) {
548 ANS_LOGE("[HandleGetSpecialActiveNotifications] fail: write notifications failed");
549 return ERR_ANS_PARCELABLE_FAILED;
550 }
551 return ERR_OK;
552 }
553
HandleSetNotificationAgent(MessageParcel & data,MessageParcel & reply)554 ErrCode AnsManagerStub::HandleSetNotificationAgent(MessageParcel &data, MessageParcel &reply)
555 {
556 std::string agent;
557 if (!data.ReadString(agent)) {
558 ANS_LOGE("[HandleSetNotificationAgent] fail: read agent failed");
559 return ERR_ANS_PARCELABLE_FAILED;
560 }
561
562 ErrCode result = SetNotificationAgent(agent);
563 if (!reply.WriteInt32(result)) {
564 ANS_LOGE("[HandleSetNotificationAgent] fail: write result failed, ErrCode=%{public}d", result);
565 return ERR_ANS_PARCELABLE_FAILED;
566 }
567 return ERR_OK;
568 }
569
HandleGetNotificationAgent(MessageParcel & data,MessageParcel & reply)570 ErrCode AnsManagerStub::HandleGetNotificationAgent(MessageParcel &data, MessageParcel &reply)
571 {
572 std::string agent;
573 ErrCode result = GetNotificationAgent(agent);
574 if (!reply.WriteInt32(result)) {
575 ANS_LOGE("[HandleGetNotificationAgent] fail: write result failed, ErrCode=%{public}d", result);
576 return ERR_ANS_PARCELABLE_FAILED;
577 }
578
579 if (!reply.WriteString(agent)) {
580 ANS_LOGE("[HandleGetNotificationAgent] fail: write agent failed");
581 return ERR_ANS_PARCELABLE_FAILED;
582 }
583
584 return ERR_OK;
585 }
586
HandleCanPublishAsBundle(MessageParcel & data,MessageParcel & reply)587 ErrCode AnsManagerStub::HandleCanPublishAsBundle(MessageParcel &data, MessageParcel &reply)
588 {
589 std::string representativeBundle;
590 if (!data.ReadString(representativeBundle)) {
591 ANS_LOGE("[HandleCanPublishAsBundle] fail: read representativeBundle failed");
592 return ERR_ANS_PARCELABLE_FAILED;
593 }
594
595 bool canPublish = false;
596 ErrCode result = CanPublishAsBundle(representativeBundle, canPublish);
597 if (!reply.WriteInt32(result)) {
598 ANS_LOGE("[HandleCanPublishAsBundle] fail: write result failed, ErrCode=%{public}d", result);
599 return ERR_ANS_PARCELABLE_FAILED;
600 }
601
602 if (!reply.WriteBool(canPublish)) {
603 ANS_LOGE("[HandleCanPublishAsBundle] fail: write canPublish failed");
604 return ERR_ANS_PARCELABLE_FAILED;
605 }
606
607 return ERR_OK;
608 }
609
HandlePublishAsBundle(MessageParcel & data,MessageParcel & reply)610 ErrCode AnsManagerStub::HandlePublishAsBundle(MessageParcel &data, MessageParcel &reply)
611 {
612 sptr<NotificationRequest> notification = data.ReadParcelable<NotificationRequest>();
613 if (!notification) {
614 ANS_LOGE("[HandlePublishAsBundle] fail: read notification failed");
615 return ERR_ANS_PARCELABLE_FAILED;
616 }
617
618 std::string representativeBundle;
619 if (!data.ReadString(representativeBundle)) {
620 ANS_LOGE("[HandlePublishAsBundle] fail: read representativeBundle failed.");
621 return ERR_ANS_PARCELABLE_FAILED;
622 }
623
624 ErrCode result = PublishAsBundle(notification, representativeBundle);
625 if (!reply.WriteInt32(result)) {
626 ANS_LOGE("[HandlePublishAsBundle] fail: write result failed, ErrCode=%{public}d", result);
627 return ERR_ANS_PARCELABLE_FAILED;
628 }
629 return ERR_OK;
630 }
631
HandleSetNotificationBadgeNum(MessageParcel & data,MessageParcel & reply)632 ErrCode AnsManagerStub::HandleSetNotificationBadgeNum(MessageParcel &data, MessageParcel &reply)
633 {
634 int32_t num = 0;
635 if (!data.ReadInt32(num)) {
636 ANS_LOGE("[HandleSetNotificationBadgeNum] fail: read notification failed");
637 return ERR_ANS_PARCELABLE_FAILED;
638 }
639
640 ErrCode result = SetNotificationBadgeNum(num);
641 if (!reply.WriteInt32(result)) {
642 ANS_LOGE("[HandleSetNotificationBadgeNum] fail: write result failed, ErrCode=%{public}d", result);
643 return ERR_ANS_PARCELABLE_FAILED;
644 }
645 return ERR_OK;
646 }
647
HandleGetBundleImportance(MessageParcel & data,MessageParcel & reply)648 ErrCode AnsManagerStub::HandleGetBundleImportance(MessageParcel &data, MessageParcel &reply)
649 {
650 int32_t importance = 0;
651 ErrCode result = GetBundleImportance(importance);
652 if (!reply.WriteInt32(result)) {
653 ANS_LOGE("[HandleGetBundleImportance] fail: write result failed, ErrCode=%{public}d", result);
654 return ERR_ANS_PARCELABLE_FAILED;
655 }
656
657 if (!reply.WriteInt32(importance)) {
658 ANS_LOGE("[HandleGetBundleImportance] fail: write importance failed.");
659 return ERR_ANS_PARCELABLE_FAILED;
660 }
661 return ERR_OK;
662 }
663
HandleSetDoNotDisturbDate(MessageParcel & data,MessageParcel & reply)664 ErrCode AnsManagerStub::HandleSetDoNotDisturbDate(MessageParcel &data, MessageParcel &reply)
665 {
666 sptr<NotificationDoNotDisturbDate> date = data.ReadParcelable<NotificationDoNotDisturbDate>();
667 if (date == nullptr) {
668 ANS_LOGE("[HandleSetDoNotDisturbDate] fail: read date failed.");
669 return ERR_ANS_PARCELABLE_FAILED;
670 }
671
672 ErrCode result = SetDoNotDisturbDate(date);
673 if (!reply.WriteInt32(result)) {
674 ANS_LOGE("[HandleSetDoNotDisturbDate] fail: write result failed, ErrCode=%{public}d", result);
675 return ERR_ANS_PARCELABLE_FAILED;
676 }
677
678 return ERR_OK;
679 }
680
HandleGetDoNotDisturbDate(MessageParcel & data,MessageParcel & reply)681 ErrCode AnsManagerStub::HandleGetDoNotDisturbDate(MessageParcel &data, MessageParcel &reply)
682 {
683 sptr<NotificationDoNotDisturbDate> date = nullptr;
684
685 ErrCode result = GetDoNotDisturbDate(date);
686 if (!reply.WriteInt32(result)) {
687 ANS_LOGE("[HandleSetDoNotDisturbDate] fail: write result failed, ErrCode=%{public}d", result);
688 return ERR_ANS_PARCELABLE_FAILED;
689 }
690
691 if (result == ERR_OK) {
692 if (!reply.WriteParcelable(date)) {
693 ANS_LOGE("[HandleSetDoNotDisturbDate] fail: write date failed.");
694 return ERR_ANS_PARCELABLE_FAILED;
695 }
696 }
697
698 return ERR_OK;
699 }
700
HandleDoesSupportDoNotDisturbMode(MessageParcel & data,MessageParcel & reply)701 ErrCode AnsManagerStub::HandleDoesSupportDoNotDisturbMode(MessageParcel &data, MessageParcel &reply)
702 {
703 bool support = false;
704
705 ErrCode result = DoesSupportDoNotDisturbMode(support);
706 if (!reply.WriteInt32(result)) {
707 ANS_LOGE("[HandleDoesSupportDoNotDisturbMode] fail: write result failed, ErrCode=%{public}d", result);
708 return ERR_ANS_PARCELABLE_FAILED;
709 }
710
711 if (!reply.WriteBool(support)) {
712 ANS_LOGE("[HandleDoesSupportDoNotDisturbMode] fail: write doesSupport failed.");
713 return ERR_ANS_PARCELABLE_FAILED;
714 }
715
716 return ERR_OK;
717 }
718
HandlePublishContinuousTaskNotification(MessageParcel & data,MessageParcel & reply)719 ErrCode AnsManagerStub::HandlePublishContinuousTaskNotification(MessageParcel &data, MessageParcel &reply)
720 {
721 sptr<NotificationRequest> request = data.ReadParcelable<NotificationRequest>();
722 if (!request) {
723 ANS_LOGE("[HandlePublishContinuousTaskNotification] fail: notification ReadParcelable failed");
724 return ERR_ANS_PARCELABLE_FAILED;
725 }
726
727 ErrCode result = PublishContinuousTaskNotification(request);
728 if (!reply.WriteInt32(result)) {
729 ANS_LOGE("[HandlePublishContinuousTaskNotification] fail: write result failed, ErrCode=%{public}d", result);
730 return ERR_ANS_PARCELABLE_FAILED;
731 }
732 return ERR_OK;
733 }
734
HandleCancelContinuousTaskNotification(MessageParcel & data,MessageParcel & reply)735 ErrCode AnsManagerStub::HandleCancelContinuousTaskNotification(MessageParcel &data, MessageParcel &reply)
736 {
737 std::string label;
738 if (!data.ReadString(label)) {
739 ANS_LOGE("[HandleCancelContinuousTaskNotification] fail: read label failed");
740 return ERR_ANS_PARCELABLE_FAILED;
741 }
742
743 int32_t notificationId = 0;
744 if (!data.ReadInt32(notificationId)) {
745 ANS_LOGE("[HandleCancelContinuousTaskNotification] fail: read notificationId failed");
746 return ERR_ANS_PARCELABLE_FAILED;
747 }
748
749 ErrCode result = CancelContinuousTaskNotification(label, notificationId);
750 if (!reply.WriteInt32(result)) {
751 ANS_LOGE("[HandleCancelContinuousTaskNotification] fail: write result failed, ErrCode=%{public}d", result);
752 return ERR_ANS_PARCELABLE_FAILED;
753 }
754 return ERR_OK;
755 }
756
HandleIsNotificationPolicyAccessGranted(MessageParcel & data,MessageParcel & reply)757 ErrCode AnsManagerStub::HandleIsNotificationPolicyAccessGranted(MessageParcel &data, MessageParcel &reply)
758 {
759 bool granted = false;
760 ErrCode result = HasNotificationPolicyAccessPermission(granted);
761 if (!reply.WriteInt32(result)) {
762 ANS_LOGE("[HandleIsNotificationPolicyAccessGranted] fail: write result failed, ErrCode=%{public}d", result);
763 return ERR_ANS_PARCELABLE_FAILED;
764 }
765
766 if (!reply.WriteBool(granted)) {
767 ANS_LOGE("[HandleIsNotificationPolicyAccessGranted] fail: write granted failed.");
768 return ERR_ANS_PARCELABLE_FAILED;
769 }
770 return ERR_OK;
771 }
772
HandleSetPrivateNotificationsAllowed(MessageParcel & data,MessageParcel & reply)773 ErrCode AnsManagerStub::HandleSetPrivateNotificationsAllowed(MessageParcel &data, MessageParcel &reply)
774 {
775 bool allow = false;
776 if (!reply.ReadBool(allow)) {
777 ANS_LOGE("[HandleSetPrivateNotificationsAllowed] fail: read allow failed.");
778 return ERR_ANS_PARCELABLE_FAILED;
779 }
780
781 ErrCode result = SetPrivateNotificationsAllowed(allow);
782 if (!reply.WriteInt32(result)) {
783 ANS_LOGE("[HandleSetPrivateNotificationsAllowed] fail: write result failed, ErrCode=%{public}d", result);
784 return ERR_ANS_PARCELABLE_FAILED;
785 }
786 return ERR_OK;
787 }
788
HandleGetPrivateNotificationsAllowed(MessageParcel & data,MessageParcel & reply)789 ErrCode AnsManagerStub::HandleGetPrivateNotificationsAllowed(MessageParcel &data, MessageParcel &reply)
790 {
791 bool allow = false;
792 ErrCode result = GetPrivateNotificationsAllowed(allow);
793 if (!reply.WriteInt32(result)) {
794 ANS_LOGE("[HandleGetPrivateNotificationsAllowed] fail: write result failed, ErrCode=%{public}d", result);
795 return ERR_ANS_PARCELABLE_FAILED;
796 }
797 return ERR_OK;
798 }
799
HandleRemoveNotification(MessageParcel & data,MessageParcel & reply)800 ErrCode AnsManagerStub::HandleRemoveNotification(MessageParcel &data, MessageParcel &reply)
801 {
802 sptr<NotificationBundleOption> bundleOption = data.ReadStrongParcelable<NotificationBundleOption>();
803 if (bundleOption == nullptr) {
804 ANS_LOGE("[HandleRemoveNotification] fail: read bundle failed.");
805 return ERR_ANS_PARCELABLE_FAILED;
806 }
807
808 int32_t notificationId = 0;
809 if (!data.ReadInt32(notificationId)) {
810 ANS_LOGE("[HandleRemoveNotification] fail: read notificationId failed");
811 return ERR_ANS_PARCELABLE_FAILED;
812 }
813
814 std::string label;
815 if (!data.ReadString(label)) {
816 ANS_LOGE("[HandleRemoveNotification] fail: read label failed");
817 return ERR_ANS_PARCELABLE_FAILED;
818 }
819
820 int32_t removeReason = 0;
821 if (!data.ReadInt32(removeReason)) {
822 ANS_LOGE("[HandleRemoveNotification] fail: read removeReason failed");
823 return ERR_ANS_PARCELABLE_FAILED;
824 }
825
826 ErrCode result = RemoveNotification(bundleOption, notificationId, label, removeReason);
827 if (!reply.WriteInt32(result)) {
828 ANS_LOGE("[HandleRemoveNotification] fail: write result failed, ErrCode=%{public}d", result);
829 return ERR_ANS_PARCELABLE_FAILED;
830 }
831 return ERR_OK;
832 }
833
HandleRemoveAllNotifications(MessageParcel & data,MessageParcel & reply)834 ErrCode AnsManagerStub::HandleRemoveAllNotifications(MessageParcel &data, MessageParcel &reply)
835 {
836 sptr<NotificationBundleOption> bundleOption = data.ReadStrongParcelable<NotificationBundleOption>();
837 if (bundleOption == nullptr) {
838 ANS_LOGE("[HandleRemoveAllNotifications] fail: read bundle failed.");
839 return ERR_ANS_PARCELABLE_FAILED;
840 }
841
842 ErrCode result = RemoveAllNotifications(bundleOption);
843 if (!reply.WriteInt32(result)) {
844 ANS_LOGE("[HandleRemoveAllNotifications] fail: write result failed, ErrCode=%{public}d", result);
845 return ERR_ANS_PARCELABLE_FAILED;
846 }
847 return ERR_OK;
848 }
849
HandleDelete(MessageParcel & data,MessageParcel & reply)850 ErrCode AnsManagerStub::HandleDelete(MessageParcel &data, MessageParcel &reply)
851 {
852 std::string key;
853 if (!data.ReadString(key)) {
854 ANS_LOGE("[HandleDelete] fail: read key failed.");
855 return ERR_ANS_PARCELABLE_FAILED;
856 }
857
858 int32_t removeReason = 0;
859 if (!data.ReadInt32(removeReason)) {
860 ANS_LOGE("[HandleDelete] fail: read removeReason failed");
861 return ERR_ANS_PARCELABLE_FAILED;
862 }
863
864 ErrCode result = Delete(key, removeReason);
865 if (!reply.WriteInt32(result)) {
866 ANS_LOGE("[HandleDelete] fail: write result failed, ErrCode=%{public}d", result);
867 return ERR_ANS_PARCELABLE_FAILED;
868 }
869 return ERR_OK;
870 }
871
HandleDeleteByBundle(MessageParcel & data,MessageParcel & reply)872 ErrCode AnsManagerStub::HandleDeleteByBundle(MessageParcel &data, MessageParcel &reply)
873 {
874 sptr<NotificationBundleOption> bundleOption = data.ReadStrongParcelable<NotificationBundleOption>();
875 if (bundleOption == nullptr) {
876 ANS_LOGE("[HandleDeleteByBundle] fail: read bundle failed.");
877 return ERR_ANS_PARCELABLE_FAILED;
878 }
879
880 ErrCode result = DeleteByBundle(bundleOption);
881 if (!reply.WriteInt32(result)) {
882 ANS_LOGE("[HandleDeleteByBundle] fail: write result failed, ErrCode=%{public}d", result);
883 return ERR_ANS_PARCELABLE_FAILED;
884 }
885 return ERR_OK;
886 }
887
HandleDeleteAll(MessageParcel & data,MessageParcel & reply)888 ErrCode AnsManagerStub::HandleDeleteAll(MessageParcel &data, MessageParcel &reply)
889 {
890 ErrCode result = DeleteAll();
891 if (!reply.WriteInt32(result)) {
892 ANS_LOGE("[HandleDeleteAll] fail: write result failed, ErrCode=%{public}d", result);
893 return ERR_ANS_PARCELABLE_FAILED;
894 }
895 return ERR_OK;
896 }
897
HandleGetSlotsByBundle(MessageParcel & data,MessageParcel & reply)898 ErrCode AnsManagerStub::HandleGetSlotsByBundle(MessageParcel &data, MessageParcel &reply)
899 {
900 sptr<NotificationBundleOption> bundleOption = data.ReadParcelable<NotificationBundleOption>();
901 if (bundleOption == nullptr) {
902 ANS_LOGE("[HandleGetSlotsByBundle] fail: read bundleOption failed.");
903 return ERR_ANS_PARCELABLE_FAILED;
904 }
905
906 std::vector<sptr<NotificationSlot>> slots;
907 ErrCode result = GetSlotsByBundle(bundleOption, slots);
908 if (!WriteParcelableVector(slots, reply, result)) {
909 ANS_LOGE("[HandleGetSlotsByBundle] fail: write slots failed.");
910 return ERR_ANS_PARCELABLE_FAILED;
911 }
912 return ERR_OK;
913 }
914
HandleUpdateSlots(MessageParcel & data,MessageParcel & reply)915 ErrCode AnsManagerStub::HandleUpdateSlots(MessageParcel &data, MessageParcel &reply)
916 {
917 sptr<NotificationBundleOption> bundleOption = data.ReadParcelable<NotificationBundleOption>();
918 if (bundleOption == nullptr) {
919 ANS_LOGE("[HandleUpdateSlots] fail: read bundleOption failed.");
920 return ERR_ANS_PARCELABLE_FAILED;
921 }
922
923 std::vector<sptr<NotificationSlot>> slots;
924 if (!ReadParcelableVector(slots, data)) {
925 ANS_LOGE("[HandleUpdateSlots] fail: read slots failed");
926 return ERR_ANS_PARCELABLE_FAILED;
927 }
928
929 ErrCode result = UpdateSlots(bundleOption, slots);
930 if (!reply.WriteInt32(result)) {
931 ANS_LOGE("[HandleUpdateSlots] fail: write result failed, ErrCode=%{public}d", result);
932 return ERR_ANS_PARCELABLE_FAILED;
933 }
934 return ERR_OK;
935 }
936
HandleRequestEnableNotification(MessageParcel & data,MessageParcel & reply)937 ErrCode AnsManagerStub::HandleRequestEnableNotification(MessageParcel &data, MessageParcel &reply)
938 {
939 ANS_LOGI("enter");
940 std::string deviceId;
941 if (!data.ReadString(deviceId)) {
942 ANS_LOGE("[HandleRequestEnableNotification] fail: read deviceId failed.");
943 return ERR_ANS_PARCELABLE_FAILED;
944 }
945 ErrCode result = RequestEnableNotification(deviceId);
946 if (!reply.WriteInt32(result)) {
947 ANS_LOGE("[HandleRequestEnableNotification] fail: write result failed, ErrCode=%{public}d", result);
948 return ERR_ANS_PARCELABLE_FAILED;
949 }
950 return ERR_OK;
951 }
952
HandleSetNotificationsEnabledForBundle(MessageParcel & data,MessageParcel & reply)953 ErrCode AnsManagerStub::HandleSetNotificationsEnabledForBundle(MessageParcel &data, MessageParcel &reply)
954 {
955 std::string deviceId;
956 if (!data.ReadString(deviceId)) {
957 ANS_LOGE("[HandleSetNotificationsEnabledForBundle] fail: read deviceId failed.");
958 return ERR_ANS_PARCELABLE_FAILED;
959 }
960
961 bool enabled = false;
962 if (!data.ReadBool(enabled)) {
963 ANS_LOGE("[HandleSetNotificationsEnabledForBundle] fail: read enabled failed.");
964 return ERR_ANS_PARCELABLE_FAILED;
965 }
966
967 ErrCode result = SetNotificationsEnabledForBundle(deviceId, enabled);
968 if (!reply.WriteInt32(result)) {
969 ANS_LOGE("[HandleSetNotificationsEnabledForBundle] fail: write result failed, ErrCode=%{public}d", result);
970 return ERR_ANS_PARCELABLE_FAILED;
971 }
972 return ERR_OK;
973 }
974
HandleSetNotificationsEnabledForAllBundles(MessageParcel & data,MessageParcel & reply)975 ErrCode AnsManagerStub::HandleSetNotificationsEnabledForAllBundles(MessageParcel &data, MessageParcel &reply)
976 {
977 std::string deviceId;
978 if (!data.ReadString(deviceId)) {
979 ANS_LOGE("[HandleSetNotificationsEnabledForAllBundles] fail: read deviceId failed.");
980 return ERR_ANS_PARCELABLE_FAILED;
981 }
982
983 bool enabled = false;
984 if (!data.ReadBool(enabled)) {
985 ANS_LOGE("[HandleSetNotificationsEnabledForAllBundles] fail: read enabled failed.");
986 return ERR_ANS_PARCELABLE_FAILED;
987 }
988
989 ErrCode result = SetNotificationsEnabledForAllBundles(deviceId, enabled);
990 if (!reply.WriteInt32(result)) {
991 ANS_LOGE("[HandleSetNotificationsEnabledForAllBundles] fail: write result failed, ErrCode=%{public}d", result);
992 return ERR_ANS_PARCELABLE_FAILED;
993 }
994 return ERR_OK;
995 }
996
HandleSetNotificationsEnabledForSpecialBundle(MessageParcel & data,MessageParcel & reply)997 ErrCode AnsManagerStub::HandleSetNotificationsEnabledForSpecialBundle(MessageParcel &data, MessageParcel &reply)
998 {
999 std::string deviceId;
1000 if (!data.ReadString(deviceId)) {
1001 ANS_LOGE("[HandleSetNotificationsEnabledForSpecialBundle] fail: read deviceId failed.");
1002 return ERR_ANS_PARCELABLE_FAILED;
1003 }
1004
1005 sptr<NotificationBundleOption> bundleOption = data.ReadParcelable<NotificationBundleOption>();
1006 if (bundleOption == nullptr) {
1007 ANS_LOGE("[HandleSetNotificationsEnabledForSpecialBundle] fail: read bundleOption failed.");
1008 return ERR_ANS_PARCELABLE_FAILED;
1009 }
1010
1011 bool enabled = false;
1012 if (!data.ReadBool(enabled)) {
1013 ANS_LOGE("[HandleSetNotificationsEnabledForSpecialBundle] fail: read enabled failed.");
1014 return ERR_ANS_PARCELABLE_FAILED;
1015 }
1016
1017 ErrCode result = SetNotificationsEnabledForSpecialBundle(deviceId, bundleOption, enabled);
1018 if (!reply.WriteInt32(result)) {
1019 ANS_LOGE(
1020 "[HandleSetNotificationsEnabledForSpecialBundle] fail: write result failed, ErrCode=%{public}d", result);
1021 return ERR_ANS_PARCELABLE_FAILED;
1022 }
1023 return ERR_OK;
1024 }
1025
HandleSetShowBadgeEnabledForBundle(MessageParcel & data,MessageParcel & reply)1026 ErrCode AnsManagerStub::HandleSetShowBadgeEnabledForBundle(MessageParcel &data, MessageParcel &reply)
1027 {
1028 sptr<NotificationBundleOption> bundleOption = data.ReadParcelable<NotificationBundleOption>();
1029 if (bundleOption == nullptr) {
1030 ANS_LOGE("[HandleSetShowBadgeEnabledForBundle] fail: read bundle failed.");
1031 return ERR_ANS_PARCELABLE_FAILED;
1032 }
1033
1034 bool enabled = false;
1035 if (!data.ReadBool(enabled)) {
1036 ANS_LOGE("[HandleSetShowBadgeEnabledForBundle] fail: read enabled failed.");
1037 return ERR_ANS_PARCELABLE_FAILED;
1038 }
1039
1040 ErrCode result = SetShowBadgeEnabledForBundle(bundleOption, enabled);
1041 if (!reply.WriteInt32(result)) {
1042 ANS_LOGE("[HandleSetShowBadgeEnabledForBundle] fail: write result failed, ErrCode=%{public}d", result);
1043 return ERR_ANS_PARCELABLE_FAILED;
1044 }
1045 return ERR_OK;
1046 }
1047
HandleGetShowBadgeEnabledForBundle(MessageParcel & data,MessageParcel & reply)1048 ErrCode AnsManagerStub::HandleGetShowBadgeEnabledForBundle(MessageParcel &data, MessageParcel &reply)
1049 {
1050 sptr<NotificationBundleOption> bundleOption = data.ReadParcelable<NotificationBundleOption>();
1051 if (bundleOption == nullptr) {
1052 ANS_LOGE("[HandleGetShowBadgeEnabledForBundle] fail: read bundle failed.");
1053 return ERR_ANS_PARCELABLE_FAILED;
1054 }
1055
1056 bool enabled = false;
1057 ErrCode result = GetShowBadgeEnabledForBundle(bundleOption, enabled);
1058 if (!reply.WriteInt32(result)) {
1059 ANS_LOGE("[HandleGetShowBadgeEnabledForBundle] fail: write result failed, ErrCode=%{public}d", result);
1060 return ERR_ANS_PARCELABLE_FAILED;
1061 }
1062
1063 if (!reply.WriteBool(enabled)) {
1064 ANS_LOGE("[HandleGetShowBadgeEnabledForBundle] fail: write enabled failed, ErrCode=%{public}d", result);
1065 return ERR_ANS_PARCELABLE_FAILED;
1066 }
1067 return ERR_OK;
1068 }
1069
HandleGetShowBadgeEnabled(MessageParcel & data,MessageParcel & reply)1070 ErrCode AnsManagerStub::HandleGetShowBadgeEnabled(MessageParcel &data, MessageParcel &reply)
1071 {
1072 bool enabled = false;
1073 ErrCode result = GetShowBadgeEnabled(enabled);
1074 if (!reply.WriteInt32(result)) {
1075 ANS_LOGE("[HandleGetShowBadgeEnabled] fail: write result failed, ErrCode=%{public}d", result);
1076 return ERR_ANS_PARCELABLE_FAILED;
1077 }
1078
1079 if (!reply.WriteBool(enabled)) {
1080 ANS_LOGE("[HandleGetShowBadgeEnabled] fail: write enabled failed, ErrCode=%{public}d", result);
1081 return ERR_ANS_PARCELABLE_FAILED;
1082 }
1083 return ERR_OK;
1084 }
1085
HandleSubscribe(MessageParcel & data,MessageParcel & reply)1086 ErrCode AnsManagerStub::HandleSubscribe(MessageParcel &data, MessageParcel &reply)
1087 {
1088 sptr<IRemoteObject> subscriber = data.ReadRemoteObject();
1089 if (subscriber == nullptr) {
1090 ANS_LOGE("[HandleSubscribe] fail: read subscriber failed");
1091 return ERR_ANS_PARCELABLE_FAILED;
1092 }
1093
1094 bool subcribeInfo = false;
1095 if (!data.ReadBool(subcribeInfo)) {
1096 ANS_LOGE("[HandleSubscribe] fail: read isSubcribeInfo failed");
1097 return ERR_ANS_PARCELABLE_FAILED;
1098 }
1099
1100 sptr<NotificationSubscribeInfo> info = nullptr;
1101 if (subcribeInfo) {
1102 info = data.ReadParcelable<NotificationSubscribeInfo>();
1103 if (info == nullptr) {
1104 ANS_LOGE("[HandleSubscribe] fail: read info failed");
1105 return ERR_ANS_PARCELABLE_FAILED;
1106 }
1107 }
1108
1109 ErrCode result = Subscribe(iface_cast<AnsSubscriberInterface>(subscriber), info);
1110 if (!reply.WriteInt32(result)) {
1111 ANS_LOGE("[HandleSubscribe] fail: write result failed, ErrCode=%{public}d", result);
1112 return ERR_ANS_PARCELABLE_FAILED;
1113 }
1114 return ERR_OK;
1115 }
1116
HandleUnsubscribe(MessageParcel & data,MessageParcel & reply)1117 ErrCode AnsManagerStub::HandleUnsubscribe(MessageParcel &data, MessageParcel &reply)
1118 {
1119 sptr<IRemoteObject> subscriber = data.ReadRemoteObject();
1120 if (subscriber == nullptr) {
1121 ANS_LOGE("[HandleUnsubscribe] fail: read subscriber failed");
1122 return ERR_ANS_PARCELABLE_FAILED;
1123 }
1124
1125 bool subcribeInfo = false;
1126 if (!data.ReadBool(subcribeInfo)) {
1127 ANS_LOGE("[HandleUnsubscribe] fail: read isSubcribeInfo failed");
1128 return ERR_ANS_PARCELABLE_FAILED;
1129 }
1130
1131 sptr<NotificationSubscribeInfo> info = nullptr;
1132 if (subcribeInfo) {
1133 info = data.ReadParcelable<NotificationSubscribeInfo>();
1134 if (info == nullptr) {
1135 ANS_LOGE("[HandleUnsubscribe] fail: read info failed");
1136 return ERR_ANS_PARCELABLE_FAILED;
1137 }
1138 }
1139
1140 ErrCode result = Unsubscribe(iface_cast<AnsSubscriberInterface>(subscriber), info);
1141 if (!reply.WriteInt32(result)) {
1142 ANS_LOGE("[HandleUnsubscribe] fail: write result failed, ErrCode=%{public}d", result);
1143 return ERR_ANS_PARCELABLE_FAILED;
1144 }
1145 return ERR_OK;
1146 }
1147
HandleAreNotificationsSuspended(MessageParcel & data,MessageParcel & reply)1148 ErrCode AnsManagerStub::HandleAreNotificationsSuspended(MessageParcel &data, MessageParcel &reply)
1149 {
1150 bool suspended = false;
1151 ErrCode result = AreNotificationsSuspended(suspended);
1152 if (!reply.WriteInt32(result)) {
1153 ANS_LOGE("[HandleAreNotificationsSuspended] fail: write result failed, ErrCode=%{public}d", result);
1154 return ERR_ANS_PARCELABLE_FAILED;
1155 }
1156
1157 if (!reply.WriteBool(suspended)) {
1158 ANS_LOGE("[HandleAreNotificationsSuspended] fail: write suspended failed.");
1159 return ERR_ANS_PARCELABLE_FAILED;
1160 }
1161 return ERR_OK;
1162 }
1163
HandleGetCurrentAppSorting(MessageParcel & data,MessageParcel & reply)1164 ErrCode AnsManagerStub::HandleGetCurrentAppSorting(MessageParcel &data, MessageParcel &reply)
1165 {
1166 sptr<NotificationSortingMap> sortingMap;
1167 ErrCode result = GetCurrentAppSorting(sortingMap);
1168 if (!reply.WriteInt32(result)) {
1169 ANS_LOGE("[HandleGetCurrentAppSorting] fail: write result failed, ErrCode=%{public}d", result);
1170 return ERR_ANS_PARCELABLE_FAILED;
1171 }
1172
1173 if (!reply.WriteParcelable(sortingMap)) {
1174 ANS_LOGE("[HandleGetCurrentAppSorting] fail: write sortingMap failed.");
1175 return ERR_ANS_PARCELABLE_FAILED;
1176 }
1177 return ERR_OK;
1178 }
1179
HandleIsAllowedNotify(MessageParcel & data,MessageParcel & reply)1180 ErrCode AnsManagerStub::HandleIsAllowedNotify(MessageParcel &data, MessageParcel &reply)
1181 {
1182 bool allowed = false;
1183 ErrCode result = IsAllowedNotify(allowed);
1184 if (!reply.WriteInt32(result)) {
1185 ANS_LOGE("[HandleIsAllowedNotify] fail: write result failed, ErrCode=%{public}d", result);
1186 return ERR_ANS_PARCELABLE_FAILED;
1187 }
1188
1189 if (!reply.WriteBool(allowed)) {
1190 ANS_LOGE("[HandleIsAllowedNotify] fail: write allowed failed.");
1191 return ERR_ANS_PARCELABLE_FAILED;
1192 }
1193 return ERR_OK;
1194 }
1195
HandleIsAllowedNotifySelf(MessageParcel & data,MessageParcel & reply)1196 ErrCode AnsManagerStub::HandleIsAllowedNotifySelf(MessageParcel &data, MessageParcel &reply)
1197 {
1198 bool allowed = false;
1199 ErrCode result = IsAllowedNotifySelf(allowed);
1200 if (!reply.WriteInt32(result)) {
1201 ANS_LOGE("[HandleIsAllowedNotifySelf] fail: write result failed, ErrCode=%{public}d", result);
1202 return ERR_ANS_PARCELABLE_FAILED;
1203 }
1204
1205 if (!reply.WriteBool(allowed)) {
1206 ANS_LOGE("[HandleIsAllowedNotifySelf] fail: write allowed failed.");
1207 return ERR_ANS_PARCELABLE_FAILED;
1208 }
1209 return ERR_OK;
1210 }
1211
HandleIsSpecialBundleAllowedNotify(MessageParcel & data,MessageParcel & reply)1212 ErrCode AnsManagerStub::HandleIsSpecialBundleAllowedNotify(MessageParcel &data, MessageParcel &reply)
1213 {
1214 sptr<NotificationBundleOption> bundleOption = data.ReadParcelable<NotificationBundleOption>();
1215 if (bundleOption == nullptr) {
1216 ANS_LOGE("[IsSpecialBundleAllowedNotify] fail: read bundle failed.");
1217 return ERR_ANS_PARCELABLE_FAILED;
1218 }
1219
1220 bool allowed = false;
1221 ErrCode result = IsSpecialBundleAllowedNotify(bundleOption, allowed);
1222 if (!reply.WriteInt32(result)) {
1223 ANS_LOGE("[IsSpecialBundleAllowedNotify] fail: write result failed, ErrCode=%{public}d", result);
1224 return ERR_ANS_PARCELABLE_FAILED;
1225 }
1226
1227 if (!reply.WriteBool(allowed)) {
1228 ANS_LOGE("[IsSpecialBundleAllowedNotify] fail: write allowed failed.");
1229 return ERR_ANS_PARCELABLE_FAILED;
1230 }
1231 return ERR_OK;
1232 }
1233
HandleCancelGroup(MessageParcel & data,MessageParcel & reply)1234 ErrCode AnsManagerStub::HandleCancelGroup(MessageParcel &data, MessageParcel &reply)
1235 {
1236 std::string groupName;
1237 if (!data.ReadString(groupName)) {
1238 ANS_LOGE("[HandleCancelGroup] fail: read groupName failed.");
1239 return ERR_ANS_PARCELABLE_FAILED;
1240 }
1241
1242 ErrCode result = CancelGroup(groupName);
1243 if (!reply.WriteInt32(result)) {
1244 ANS_LOGE("[HandleCancelGroup] fail: write result failed, ErrCode=%{public}d", result);
1245 return ERR_ANS_PARCELABLE_FAILED;
1246 }
1247 return ERR_OK;
1248 }
1249
HandleRemoveGroupByBundle(MessageParcel & data,MessageParcel & reply)1250 ErrCode AnsManagerStub::HandleRemoveGroupByBundle(MessageParcel &data, MessageParcel &reply)
1251 {
1252 sptr<NotificationBundleOption> bundleOption = data.ReadParcelable<NotificationBundleOption>();
1253 if (bundleOption == nullptr) {
1254 ANS_LOGE("[HandleRemoveGroupByBundle] fail: read bundleOption failed.");
1255 return ERR_ANS_PARCELABLE_FAILED;
1256 }
1257
1258 std::string groupName;
1259 if (!data.ReadString(groupName)) {
1260 ANS_LOGE("[HandleRemoveGroupByBundle] fail: read groupName failed.");
1261 return ERR_ANS_PARCELABLE_FAILED;
1262 }
1263
1264 ErrCode result = RemoveGroupByBundle(bundleOption, groupName);
1265 if (!reply.WriteInt32(result)) {
1266 ANS_LOGE("[HandleRemoveGroupByBundle] fail: write result failed, ErrCode=%{public}d", result);
1267 return ERR_ANS_PARCELABLE_FAILED;
1268 }
1269 return ERR_OK;
1270 }
1271
HandleIsDistributedEnabled(MessageParcel & data,MessageParcel & reply)1272 ErrCode AnsManagerStub::HandleIsDistributedEnabled(MessageParcel &data, MessageParcel &reply)
1273 {
1274 bool enabled = false;
1275 ErrCode result = IsDistributedEnabled(enabled);
1276 if (!reply.WriteInt32(result)) {
1277 ANS_LOGE("[HandleIsDistributedEnabled] fail: write result failed, ErrCode=%{public}d", result);
1278 return ERR_ANS_PARCELABLE_FAILED;
1279 }
1280
1281 if (!reply.WriteBool(enabled)) {
1282 ANS_LOGE("[HandleIsDistributedEnabled] fail: write enabled failed.");
1283 return ERR_ANS_PARCELABLE_FAILED;
1284 }
1285
1286 return ERR_OK;
1287 }
1288
HandleEnableDistributed(MessageParcel & data,MessageParcel & reply)1289 ErrCode AnsManagerStub::HandleEnableDistributed(MessageParcel &data, MessageParcel &reply)
1290 {
1291 bool enabled = false;
1292 if (!data.ReadBool(enabled)) {
1293 ANS_LOGE("[HandleEnableDistributed] fail: read enabled failed.");
1294 return ERR_ANS_PARCELABLE_FAILED;
1295 }
1296
1297 ErrCode result = EnableDistributed(enabled);
1298 if (!reply.WriteInt32(result)) {
1299 ANS_LOGE("[HandleEnableDistributed] fail: write result failed, ErrCode=%{public}d", result);
1300 return ERR_ANS_PARCELABLE_FAILED;
1301 }
1302
1303 return ERR_OK;
1304 }
1305
HandleEnableDistributedByBundle(MessageParcel & data,MessageParcel & reply)1306 ErrCode AnsManagerStub::HandleEnableDistributedByBundle(MessageParcel &data, MessageParcel &reply)
1307 {
1308 sptr<NotificationBundleOption> bundleOption = data.ReadParcelable<NotificationBundleOption>();
1309 if (bundleOption == nullptr) {
1310 ANS_LOGE("[HandleEnableDistributedByBundle] fail: read bundle failed.");
1311 return ERR_ANS_PARCELABLE_FAILED;
1312 }
1313
1314 bool enabled = false;
1315 if (!data.ReadBool(enabled)) {
1316 ANS_LOGE("[HandleEnableDistributedByBundle] fail: read enabled failed.");
1317 return ERR_ANS_PARCELABLE_FAILED;
1318 }
1319
1320 ErrCode result = EnableDistributedByBundle(bundleOption, enabled);
1321 if (!reply.WriteInt32(result)) {
1322 ANS_LOGE("[HandleEnableDistributedByBundle] fail: write result failed, ErrCode=%{public}d", result);
1323 return ERR_ANS_PARCELABLE_FAILED;
1324 }
1325
1326 return ERR_OK;
1327 }
1328
HandleEnableDistributedSelf(MessageParcel & data,MessageParcel & reply)1329 ErrCode AnsManagerStub::HandleEnableDistributedSelf(MessageParcel &data, MessageParcel &reply)
1330 {
1331 bool enabled = false;
1332 if (!data.ReadBool(enabled)) {
1333 ANS_LOGE("[HandleEnableDistributedSelf] fail: read enabled failed.");
1334 return ERR_ANS_PARCELABLE_FAILED;
1335 }
1336
1337 ErrCode result = EnableDistributedSelf(enabled);
1338 if (!reply.WriteInt32(result)) {
1339 ANS_LOGE("[HandleEnableDistributedSelf] fail: write result failed, ErrCode=%{public}d", result);
1340 return ERR_ANS_PARCELABLE_FAILED;
1341 }
1342
1343 return ERR_OK;
1344 }
1345
HandleIsDistributedEnableByBundle(MessageParcel & data,MessageParcel & reply)1346 ErrCode AnsManagerStub::HandleIsDistributedEnableByBundle(MessageParcel &data, MessageParcel &reply)
1347 {
1348 sptr<NotificationBundleOption> bundleOption = data.ReadParcelable<NotificationBundleOption>();
1349 if (bundleOption == nullptr) {
1350 ANS_LOGE("[HandleIsDistributedEnableByBundle] fail: read bundle failed.");
1351 return ERR_ANS_PARCELABLE_FAILED;
1352 }
1353
1354 bool enabled = false;
1355 ErrCode result = IsDistributedEnableByBundle(bundleOption, enabled);
1356 if (!reply.WriteInt32(result)) {
1357 ANS_LOGE("[HandleIsDistributedEnableByBundle] fail: write result failed, ErrCode=%{public}d", result);
1358 return ERR_ANS_PARCELABLE_FAILED;
1359 }
1360
1361 if (!reply.WriteBool(enabled)) {
1362 ANS_LOGE("[HandleIsDistributedEnableByBundle] fail: write enabled failed.");
1363 return ERR_ANS_PARCELABLE_FAILED;
1364 }
1365
1366 return ERR_OK;
1367 }
1368
HandleGetDeviceRemindType(MessageParcel & data,MessageParcel & reply)1369 ErrCode AnsManagerStub::HandleGetDeviceRemindType(MessageParcel &data, MessageParcel &reply)
1370 {
1371 auto rType {NotificationConstant::RemindType::NONE};
1372 ErrCode result = GetDeviceRemindType(rType);
1373 if (!reply.WriteInt32(result)) {
1374 ANS_LOGE("[HandleGetDeviceRemindType] fail: write result failed, ErrCode=%{public}d", result);
1375 return ERR_ANS_PARCELABLE_FAILED;
1376 }
1377
1378 if (!reply.WriteInt32(static_cast<int32_t>(rType))) {
1379 ANS_LOGE("[HandleGetDeviceRemindType] fail: write remind type failed.");
1380 return ERR_ANS_PARCELABLE_FAILED;
1381 }
1382
1383 return ERR_OK;
1384 }
1385
HandleShellDump(MessageParcel & data,MessageParcel & reply)1386 ErrCode AnsManagerStub::HandleShellDump(MessageParcel &data, MessageParcel &reply)
1387 {
1388 std::string cmd;
1389 if (!data.ReadString(cmd)) {
1390 ANS_LOGE("[HandleShellDump] fail: read cmd failed.");
1391 return ERR_ANS_PARCELABLE_FAILED;
1392 }
1393 std::string bundle;
1394 if (!data.ReadString(bundle)) {
1395 ANS_LOGE("[HandleShellDump] fail: read bundle failed.");
1396 return ERR_ANS_PARCELABLE_FAILED;
1397 }
1398 int32_t userId;
1399 if (!data.ReadInt32(userId)) {
1400 ANS_LOGE("[HandleShellDump] fail: read userId failed.");
1401 return ERR_ANS_PARCELABLE_FAILED;
1402 }
1403 std::vector<std::string> notificationsInfo;
1404 ErrCode result = ShellDump(cmd, bundle, userId, notificationsInfo);
1405 if (!reply.WriteInt32(result)) {
1406 ANS_LOGE("[HandleGetRecentNotificationsInfo] fail: write result failed, ErrCode=%{public}d", result);
1407 return ERR_ANS_PARCELABLE_FAILED;
1408 }
1409
1410 if (!reply.WriteStringVector(notificationsInfo)) {
1411 ANS_LOGE("[HandleGetRecentNotificationsInfo] fail: write notificationsInfo failed.");
1412 return ERR_ANS_PARCELABLE_FAILED;
1413 }
1414 return ERR_OK;
1415 }
1416
HandlePublishReminder(MessageParcel & data,MessageParcel & reply)1417 ErrCode AnsManagerStub::HandlePublishReminder(MessageParcel &data, MessageParcel &reply)
1418 {
1419 ANSR_LOGI("HandlePublishReminder");
1420 uint8_t typeInfo = static_cast<uint8_t>(ReminderRequest::ReminderType::INVALID);
1421 if (!data.ReadUint8(typeInfo)) {
1422 ANSR_LOGE("Failed to read reminder type");
1423 return ERR_ANS_PARCELABLE_FAILED;
1424 }
1425 ReminderRequest::ReminderType reminderType = static_cast<ReminderRequest::ReminderType>(typeInfo);
1426 sptr<ReminderRequest> reminder;
1427 if (ReminderRequest::ReminderType::ALARM == reminderType) {
1428 ANSR_LOGD("Publish alarm");
1429 reminder = data.ReadParcelable<ReminderRequestAlarm>();
1430 } else if (ReminderRequest::ReminderType::TIMER == reminderType) {
1431 ANSR_LOGD("Publish timer");
1432 reminder = data.ReadParcelable<ReminderRequestTimer>();
1433 } else if (ReminderRequest::ReminderType::CALENDAR == reminderType) {
1434 ANSR_LOGD("Publish calendar");
1435 reminder = data.ReadParcelable<ReminderRequestCalendar>();
1436 } else {
1437 ANSR_LOGE("Reminder type invalid");
1438 return ERR_ANS_INVALID_PARAM;
1439 }
1440 if (!reminder) {
1441 ANSR_LOGE("Reminder ReadParcelable failed");
1442 return ERR_ANS_PARCELABLE_FAILED;
1443 }
1444
1445 ErrCode result = PublishReminder(reminder);
1446
1447 if (!reply.WriteInt32(reminder->GetReminderId())) {
1448 ANSR_LOGE("Write back reminderId failed");
1449 return ERR_ANS_PARCELABLE_FAILED;
1450 }
1451 if (!reply.WriteInt32(result)) {
1452 ANSR_LOGE("Write back result failed");
1453 return ERR_ANS_PARCELABLE_FAILED;
1454 }
1455 return result;
1456 }
1457
HandleCancelReminder(MessageParcel & data,MessageParcel & reply)1458 ErrCode AnsManagerStub::HandleCancelReminder(MessageParcel &data, MessageParcel &reply)
1459 {
1460 ANSR_LOGI("HandleCancelReminder");
1461 int32_t reminderId = -1;
1462 if (!data.ReadInt32(reminderId)) {
1463 ANSR_LOGE("Read reminder id failed.");
1464 return ERR_ANS_PARCELABLE_FAILED;
1465 }
1466
1467 ErrCode result = CancelReminder(reminderId);
1468 if (!reply.WriteInt32(result)) {
1469 ANSR_LOGE("Write back result failed");
1470 return ERR_ANS_PARCELABLE_FAILED;
1471 }
1472 return result;
1473 }
1474
HandleCancelAllReminders(MessageParcel & data,MessageParcel & reply)1475 ErrCode AnsManagerStub::HandleCancelAllReminders(MessageParcel &data, MessageParcel &reply)
1476 {
1477 ErrCode result = CancelAllReminders();
1478 if (!reply.WriteInt32(result)) {
1479 ANSR_LOGE("Write back result failed");
1480 return ERR_ANS_PARCELABLE_FAILED;
1481 }
1482 return result;
1483 }
1484
HandleGetValidReminders(MessageParcel & data,MessageParcel & reply)1485 ErrCode AnsManagerStub::HandleGetValidReminders(MessageParcel &data, MessageParcel &reply)
1486 {
1487 ANSR_LOGI("HandleGetValidReminders");
1488 std::vector<sptr<ReminderRequest>> validReminders;
1489 ErrCode result = GetValidReminders(validReminders);
1490
1491 ANSR_LOGD("Write back size=%{public}zu", validReminders.size());
1492 if (!reply.WriteUint8(static_cast<uint8_t>(validReminders.size()))) {
1493 ANSR_LOGE("Write back reminder count failed");
1494 return ERR_ANS_PARCELABLE_FAILED;
1495 }
1496
1497 for (auto it = validReminders.begin(); it != validReminders.end(); ++it) {
1498 sptr<ReminderRequest> reminder = (*it);
1499 uint8_t reminderType = static_cast<uint8_t>(reminder->GetReminderType());
1500 ANSR_LOGD("ReminderType=%{public}d", reminderType);
1501 if (!reply.WriteUint8(reminderType)) {
1502 ANSR_LOGW("Write reminder type failed");
1503 return ERR_ANS_PARCELABLE_FAILED;
1504 }
1505 if (!reply.WriteParcelable(reminder)) {
1506 ANSR_LOGW("Write reminder parcelable failed");
1507 return ERR_ANS_PARCELABLE_FAILED;
1508 }
1509 }
1510 if (!reply.WriteInt32(result)) {
1511 ANSR_LOGE("Write back result failed");
1512 return ERR_ANS_PARCELABLE_FAILED;
1513 }
1514 return result;
1515 }
1516
1517 template<typename T>
WriteParcelableVector(const std::vector<sptr<T>> & parcelableVector,MessageParcel & reply,ErrCode & result)1518 bool AnsManagerStub::WriteParcelableVector(
1519 const std::vector<sptr<T>> &parcelableVector, MessageParcel &reply, ErrCode &result)
1520 {
1521 if (!reply.WriteInt32(result)) {
1522 ANS_LOGE("write result failed, ErrCode=%{public}d", result);
1523 return false;
1524 }
1525
1526 if (!reply.WriteInt32(parcelableVector.size())) {
1527 ANS_LOGE("write ParcelableVector size failed");
1528 return false;
1529 }
1530
1531 for (auto &parcelable : parcelableVector) {
1532 if (!reply.WriteStrongParcelable(parcelable)) {
1533 ANS_LOGE("write ParcelableVector failed");
1534 return false;
1535 }
1536 }
1537 return true;
1538 }
1539
1540 template<typename T>
ReadParcelableVector(std::vector<sptr<T>> & parcelableInfos,MessageParcel & data)1541 bool AnsManagerStub::ReadParcelableVector(std::vector<sptr<T>> &parcelableInfos, MessageParcel &data)
1542 {
1543 int32_t infoSize = 0;
1544 if (!data.ReadInt32(infoSize)) {
1545 ANS_LOGE("read Parcelable size failed.");
1546 return false;
1547 }
1548
1549 parcelableInfos.clear();
1550 for (int32_t index = 0; index < infoSize; index++) {
1551 sptr<T> info = data.ReadStrongParcelable<T>();
1552 if (info == nullptr) {
1553 ANS_LOGE("read Parcelable infos failed.");
1554 return false;
1555 }
1556 parcelableInfos.emplace_back(info);
1557 }
1558
1559 return true;
1560 }
1561
HandleIsSupportTemplate(MessageParcel & data,MessageParcel & reply)1562 ErrCode AnsManagerStub::HandleIsSupportTemplate(MessageParcel &data, MessageParcel &reply)
1563 {
1564 std::string templateName;
1565 if (!data.ReadString(templateName)) {
1566 ANS_LOGE("[HandleIsSupportTemplate] fail: read template name failed.");
1567 return ERR_ANS_PARCELABLE_FAILED;
1568 }
1569 bool support = false;
1570 ErrCode result = IsSupportTemplate(templateName, support);
1571 if (!reply.WriteInt32(result)) {
1572 ANS_LOGE("[HandleIsSupportTemplate] fail: write result failed, ErrCode=%{public}d", result);
1573 return ERR_ANS_PARCELABLE_FAILED;
1574 }
1575 if (!reply.WriteBool(support)) {
1576 ANS_LOGE("[HandleIsSupportTemplate] fail: write support failed.");
1577 return ERR_ANS_PARCELABLE_FAILED;
1578 }
1579 return ERR_OK;
1580 }
1581
HandleIsSpecialUserAllowedNotifyByUser(MessageParcel & data,MessageParcel & reply)1582 ErrCode AnsManagerStub::HandleIsSpecialUserAllowedNotifyByUser(MessageParcel &data, MessageParcel &reply)
1583 {
1584 int32_t userId = SUBSCRIBE_USER_INIT;
1585 if (!data.ReadInt32(userId)) {
1586 ANS_LOGE("[HandleIsSpecialUserAllowedNotifyByUser] fail: read userId failed.");
1587 return ERR_ANS_PARCELABLE_FAILED;
1588 }
1589
1590 bool allowed = false;
1591 ErrCode result = IsSpecialUserAllowedNotify(userId, allowed);
1592 if (!reply.WriteInt32(result)) {
1593 ANS_LOGE("[HandleIsSpecialUserAllowedNotifyByUser] fail: write result failed, ErrCode=%{public}d", result);
1594 return ERR_ANS_PARCELABLE_FAILED;
1595 }
1596
1597 if (!reply.WriteBool(allowed)) {
1598 ANS_LOGE("[HandleIsSpecialUserAllowedNotifyByUser] fail: write allowed failed.");
1599 return ERR_ANS_PARCELABLE_FAILED;
1600 }
1601 return ERR_OK;
1602 }
1603
HandleSetNotificationsEnabledByUser(MessageParcel & data,MessageParcel & reply)1604 ErrCode AnsManagerStub::HandleSetNotificationsEnabledByUser(MessageParcel &data, MessageParcel &reply)
1605 {
1606 int32_t userId = SUBSCRIBE_USER_INIT;
1607 if (!data.ReadInt32(userId)) {
1608 ANS_LOGE("[HandleSetNotificationsEnabledByUser] fail: read userId failed.");
1609 return ERR_ANS_PARCELABLE_FAILED;
1610 }
1611
1612 bool enabled = false;
1613 if (!data.ReadBool(enabled)) {
1614 ANS_LOGE("[HandleSetNotificationsEnabledByUser] fail: read enabled failed.");
1615 return ERR_ANS_PARCELABLE_FAILED;
1616 }
1617
1618 ErrCode result = SetNotificationsEnabledByUser(userId, enabled);
1619 if (!reply.WriteInt32(result)) {
1620 ANS_LOGE("[HandleSetNotificationsEnabledByUser] fail: write result failed, ErrCode=%{public}d", result);
1621 return ERR_ANS_PARCELABLE_FAILED;
1622 }
1623 return ERR_OK;
1624 }
1625
HandleDeleteAllByUser(MessageParcel & data,MessageParcel & reply)1626 ErrCode AnsManagerStub::HandleDeleteAllByUser(MessageParcel &data, MessageParcel &reply)
1627 {
1628 int32_t userId = SUBSCRIBE_USER_INIT;
1629 if (!data.ReadInt32(userId)) {
1630 ANS_LOGE("[HandleDeleteAllByUser] fail: read userId failed.");
1631 return ERR_ANS_PARCELABLE_FAILED;
1632 }
1633
1634 ErrCode result = DeleteAllByUser(userId);
1635 if (!reply.WriteInt32(result)) {
1636 ANS_LOGE("[HandleDeleteAllByUser] fail: write result failed, ErrCode=%{public}d", result);
1637 return ERR_ANS_PARCELABLE_FAILED;
1638 }
1639 return ERR_OK;
1640 }
1641
HandleSetDoNotDisturbDateByUser(MessageParcel & data,MessageParcel & reply)1642 ErrCode AnsManagerStub::HandleSetDoNotDisturbDateByUser(MessageParcel &data, MessageParcel &reply)
1643 {
1644 int32_t userId = SUBSCRIBE_USER_INIT;
1645 if (!data.ReadInt32(userId)) {
1646 ANS_LOGE("[HandleSetDoNotDisturbDateByUser] fail: read userId failed.");
1647 return ERR_ANS_PARCELABLE_FAILED;
1648 }
1649
1650 sptr<NotificationDoNotDisturbDate> date = data.ReadParcelable<NotificationDoNotDisturbDate>();
1651 if (date == nullptr) {
1652 ANS_LOGE("[HandleSetDoNotDisturbDateByUser] fail: read date failed.");
1653 return ERR_ANS_PARCELABLE_FAILED;
1654 }
1655
1656 ErrCode result = SetDoNotDisturbDate(userId, date);
1657 if (!reply.WriteInt32(result)) {
1658 ANS_LOGE("[HandleSetDoNotDisturbDateByUser] fail: write result failed, ErrCode=%{public}d", result);
1659 return ERR_ANS_PARCELABLE_FAILED;
1660 }
1661
1662 return ERR_OK;
1663 }
1664
HandleGetDoNotDisturbDateByUser(MessageParcel & data,MessageParcel & reply)1665 ErrCode AnsManagerStub::HandleGetDoNotDisturbDateByUser(MessageParcel &data, MessageParcel &reply)
1666 {
1667 int32_t userId = SUBSCRIBE_USER_INIT;
1668 if (!data.ReadInt32(userId)) {
1669 ANS_LOGE("[HandleGetDoNotDisturbDateByUser] fail: read userId failed.");
1670 return ERR_ANS_PARCELABLE_FAILED;
1671 }
1672
1673 sptr<NotificationDoNotDisturbDate> date = nullptr;
1674 ErrCode result = GetDoNotDisturbDate(userId, date);
1675 if (!reply.WriteInt32(result)) {
1676 ANS_LOGE("[HandleGetDoNotDisturbDateByUser] fail: write result failed, ErrCode=%{public}d", result);
1677 return ERR_ANS_PARCELABLE_FAILED;
1678 }
1679
1680 if (result == ERR_OK) {
1681 if (!reply.WriteParcelable(date)) {
1682 ANS_LOGE("[HandleGetDoNotDisturbDateByUser] fail: write date failed.");
1683 return ERR_ANS_PARCELABLE_FAILED;
1684 }
1685 }
1686
1687 return ERR_OK;
1688 }
1689
HandleSetEnabledForBundleSlot(MessageParcel & data,MessageParcel & reply)1690 ErrCode AnsManagerStub::HandleSetEnabledForBundleSlot(MessageParcel &data, MessageParcel &reply)
1691 {
1692 sptr<NotificationBundleOption> bundleOption = data.ReadStrongParcelable<NotificationBundleOption>();
1693 if (bundleOption == nullptr) {
1694 ANS_LOGE("[HandleSetEnabledForBundleSlot] fail: read bundle failed.");
1695 return ERR_ANS_PARCELABLE_FAILED;
1696 }
1697
1698 int32_t type = 0;
1699 if (!data.ReadInt32(type)) {
1700 ANS_LOGE("[HandleSetEnabledForBundleSlot] fail: read slot type failed.");
1701 return ERR_ANS_PARCELABLE_FAILED;
1702 }
1703 NotificationConstant::SlotType slotType = static_cast<NotificationConstant::SlotType>(type);
1704
1705 bool enabled = false;
1706 if (!data.ReadBool(enabled)) {
1707 ANS_LOGE("[HandleSetEnabledForBundleSlot] fail: read enabled failed.");
1708 return ERR_ANS_PARCELABLE_FAILED;
1709 }
1710
1711 ErrCode result = SetEnabledForBundleSlot(bundleOption, slotType, enabled);
1712 if (!reply.WriteInt32(result)) {
1713 ANS_LOGE("[HandleSetEnabledForBundleSlot] fail: write result failed, ErrCode=%{public}d", result);
1714 return ERR_ANS_PARCELABLE_FAILED;
1715 }
1716
1717 return ERR_OK;
1718 }
1719
HandleGetEnabledForBundleSlot(MessageParcel & data,MessageParcel & reply)1720 ErrCode AnsManagerStub::HandleGetEnabledForBundleSlot(MessageParcel &data, MessageParcel &reply)
1721 {
1722 sptr<NotificationBundleOption> bundleOption = data.ReadStrongParcelable<NotificationBundleOption>();
1723 if (bundleOption == nullptr) {
1724 ANS_LOGE("[HandleGetEnabledForBundleSlot] fail: read bundle failed.");
1725 return ERR_ANS_PARCELABLE_FAILED;
1726 }
1727
1728 int32_t type = 0;
1729 if (!data.ReadInt32(type)) {
1730 ANS_LOGE("[HandleGetEnabledForBundleSlot] fail: read slot type failed.");
1731 return ERR_ANS_PARCELABLE_FAILED;
1732 }
1733 NotificationConstant::SlotType slotType = static_cast<NotificationConstant::SlotType>(type);
1734
1735 bool enabled = false;
1736 ErrCode result = GetEnabledForBundleSlot(bundleOption, slotType, enabled);
1737 if (!reply.WriteInt32(result)) {
1738 ANS_LOGE("[HandleGetEnabledForBundleSlot] fail: write result failed, ErrCode=%{public}d", result);
1739 return ERR_ANS_PARCELABLE_FAILED;
1740 }
1741
1742 if (!reply.WriteBool(enabled)) {
1743 ANS_LOGE("[HandleGetEnabledForBundleSlot] fail: write enabled failed, ErrCode=%{public}d", result);
1744 return ERR_ANS_PARCELABLE_FAILED;
1745 }
1746
1747 return ERR_OK;
1748 }
1749
HandleDistributedSetEnabledWithoutApp(MessageParcel & data,MessageParcel & reply)1750 ErrCode AnsManagerStub::HandleDistributedSetEnabledWithoutApp(MessageParcel &data, MessageParcel &reply)
1751 {
1752 int32_t userId = SUBSCRIBE_USER_INIT;
1753 if (!data.ReadInt32(userId)) {
1754 ANS_LOGE("[HandleDistributedSetEnabledWithoutApp] fail: read userId failed.");
1755 return ERR_ANS_PARCELABLE_FAILED;
1756 }
1757
1758 bool enabled = false;
1759 if (!data.ReadBool(enabled)) {
1760 ANS_LOGE("[HandleDistributedSetEnabledWithoutApp] fail: read enabled failed.");
1761 return ERR_ANS_PARCELABLE_FAILED;
1762 }
1763
1764 ErrCode result = SetSyncNotificationEnabledWithoutApp(userId, enabled);
1765 if (!reply.WriteInt32(result)) {
1766 ANS_LOGE("[HandleDistributedSetEnabledWithoutApp] fail: write result failed, ErrCode=%{public}d",
1767 result);
1768 return ERR_ANS_PARCELABLE_FAILED;
1769 }
1770
1771 return ERR_OK;
1772 }
1773
HandleDistributedGetEnabledWithoutApp(MessageParcel & data,MessageParcel & reply)1774 ErrCode AnsManagerStub::HandleDistributedGetEnabledWithoutApp(MessageParcel &data, MessageParcel &reply)
1775 {
1776 int32_t userId = SUBSCRIBE_USER_INIT;
1777 if (!data.ReadInt32(userId)) {
1778 ANS_LOGE("[HandleDistributedGetEnabledWithoutApp] fail: read userId failed.");
1779 return ERR_ANS_PARCELABLE_FAILED;
1780 }
1781
1782 bool enabled = false;
1783 ErrCode result = GetSyncNotificationEnabledWithoutApp(userId, enabled);
1784 if (!reply.WriteInt32(result)) {
1785 ANS_LOGE("[HandleDistributedGetEnabledWithoutApp] fail: write result failed, ErrCode=%{public}d",
1786 result);
1787 return ERR_ANS_PARCELABLE_FAILED;
1788 }
1789
1790 if (!reply.WriteBool(enabled)) {
1791 ANS_LOGE("[HandleDistributedGetEnabledWithoutApp] fail: write enabled failed.");
1792 return ERR_ANS_PARCELABLE_FAILED;
1793 }
1794
1795 return ERR_OK;
1796 }
1797
Publish(const std::string & label,const sptr<NotificationRequest> & notification)1798 ErrCode AnsManagerStub::Publish(const std::string &label, const sptr<NotificationRequest> ¬ification)
1799 {
1800 ANS_LOGE("AnsManagerStub::Publish called!");
1801 return ERR_INVALID_OPERATION;
1802 }
1803
PublishToDevice(const sptr<NotificationRequest> & notification,const std::string & deviceId)1804 ErrCode AnsManagerStub::PublishToDevice(const sptr<NotificationRequest> ¬ification, const std::string &deviceId)
1805 {
1806 ANS_LOGE("AnsManagerStub::PublishToDevice called!");
1807 return ERR_INVALID_OPERATION;
1808 }
1809
Cancel(int notificationId,const std::string & label)1810 ErrCode AnsManagerStub::Cancel(int notificationId, const std::string &label)
1811 {
1812 ANS_LOGE("AnsManagerStub::Cancel called!");
1813 return ERR_INVALID_OPERATION;
1814 }
1815
CancelAll()1816 ErrCode AnsManagerStub::CancelAll()
1817 {
1818 ANS_LOGE("AnsManagerStub::CancelAll called!");
1819 return ERR_INVALID_OPERATION;
1820 }
1821
CancelAsBundle(int32_t notificationId,const std::string & representativeBundle,int32_t userId)1822 ErrCode AnsManagerStub::CancelAsBundle(int32_t notificationId, const std::string &representativeBundle, int32_t userId)
1823 {
1824 ANS_LOGE("AnsManagerStub::CancelAsBundle called!");
1825 return ERR_INVALID_OPERATION;
1826 }
1827
AddSlotByType(NotificationConstant::SlotType slotType)1828 ErrCode AnsManagerStub::AddSlotByType(NotificationConstant::SlotType slotType)
1829 {
1830 ANS_LOGE("AnsManagerStub::AddSlotByType called!");
1831 return ERR_INVALID_OPERATION;
1832 }
1833
AddSlots(const std::vector<sptr<NotificationSlot>> & slots)1834 ErrCode AnsManagerStub::AddSlots(const std::vector<sptr<NotificationSlot>> &slots)
1835 {
1836 ANS_LOGE("AnsManagerStub::AddSlots called!");
1837 return ERR_INVALID_OPERATION;
1838 }
1839
RemoveSlotByType(const NotificationConstant::SlotType & slotType)1840 ErrCode AnsManagerStub::RemoveSlotByType(const NotificationConstant::SlotType &slotType)
1841 {
1842 ANS_LOGE("AnsManagerStub::RemoveSlotByType called!");
1843 return ERR_INVALID_OPERATION;
1844 }
1845
RemoveAllSlots()1846 ErrCode AnsManagerStub::RemoveAllSlots()
1847 {
1848 ANS_LOGE("AnsManagerStub::RemoveAllSlots called!");
1849 return ERR_INVALID_OPERATION;
1850 }
1851
GetSlotByType(const NotificationConstant::SlotType & slotType,sptr<NotificationSlot> & slot)1852 ErrCode AnsManagerStub::GetSlotByType(const NotificationConstant::SlotType &slotType, sptr<NotificationSlot> &slot)
1853 {
1854 ANS_LOGE("AnsManagerStub::GetSlotByType called!");
1855 return ERR_INVALID_OPERATION;
1856 }
1857
GetSlots(std::vector<sptr<NotificationSlot>> & slots)1858 ErrCode AnsManagerStub::GetSlots(std::vector<sptr<NotificationSlot>> &slots)
1859 {
1860 ANS_LOGE("AnsManagerStub::GetSlots called!");
1861 return ERR_INVALID_OPERATION;
1862 }
1863
GetSlotNumAsBundle(const sptr<NotificationBundleOption> & bundleOption,uint64_t & num)1864 ErrCode AnsManagerStub::GetSlotNumAsBundle(const sptr<NotificationBundleOption> &bundleOption, uint64_t &num)
1865 {
1866 ANS_LOGE("AnsManagerStub::GetSlotNumAsBundle called!");
1867 return ERR_INVALID_OPERATION;
1868 }
1869
GetActiveNotifications(std::vector<sptr<NotificationRequest>> & notifications)1870 ErrCode AnsManagerStub::GetActiveNotifications(std::vector<sptr<NotificationRequest>> ¬ifications)
1871 {
1872 ANS_LOGE("AnsManagerStub::GetActiveNotifications called!");
1873 return ERR_INVALID_OPERATION;
1874 }
1875
GetActiveNotificationNums(uint64_t & num)1876 ErrCode AnsManagerStub::GetActiveNotificationNums(uint64_t &num)
1877 {
1878 ANS_LOGE("AnsManagerStub::GetActiveNotificationNums called!");
1879 return ERR_INVALID_OPERATION;
1880 }
1881
GetAllActiveNotifications(std::vector<sptr<Notification>> & notifications)1882 ErrCode AnsManagerStub::GetAllActiveNotifications(std::vector<sptr<Notification>> ¬ifications)
1883 {
1884 ANS_LOGE("AnsManagerStub::GetAllActiveNotifications called!");
1885 return ERR_INVALID_OPERATION;
1886 }
1887
GetSpecialActiveNotifications(const std::vector<std::string> & key,std::vector<sptr<Notification>> & notifications)1888 ErrCode AnsManagerStub::GetSpecialActiveNotifications(
1889 const std::vector<std::string> &key, std::vector<sptr<Notification>> ¬ifications)
1890 {
1891 ANS_LOGE("AnsManagerStub::GetSpecialActiveNotifications called!");
1892 return ERR_INVALID_OPERATION;
1893 }
1894
SetNotificationAgent(const std::string & agent)1895 ErrCode AnsManagerStub::SetNotificationAgent(const std::string &agent)
1896 {
1897 ANS_LOGE("AnsManagerStub::SetNotificationAgent called!");
1898 return ERR_INVALID_OPERATION;
1899 }
1900
GetNotificationAgent(std::string & agent)1901 ErrCode AnsManagerStub::GetNotificationAgent(std::string &agent)
1902 {
1903 ANS_LOGE("AnsManagerStub::GetNotificationAgent called!");
1904 return ERR_INVALID_OPERATION;
1905 }
1906
CanPublishAsBundle(const std::string & representativeBundle,bool & canPublish)1907 ErrCode AnsManagerStub::CanPublishAsBundle(const std::string &representativeBundle, bool &canPublish)
1908 {
1909 ANS_LOGE("AnsManagerStub::CanPublishAsBundle called!");
1910 return ERR_INVALID_OPERATION;
1911 }
1912
PublishAsBundle(const sptr<NotificationRequest> notification,const std::string & representativeBundle)1913 ErrCode AnsManagerStub::PublishAsBundle(
1914 const sptr<NotificationRequest> notification, const std::string &representativeBundle)
1915 {
1916 ANS_LOGE("AnsManagerStub::PublishAsBundle called!");
1917 return ERR_INVALID_OPERATION;
1918 }
1919
SetNotificationBadgeNum(int num)1920 ErrCode AnsManagerStub::SetNotificationBadgeNum(int num)
1921 {
1922 ANS_LOGE("AnsManagerStub::SetNotificationBadgeNum called!");
1923 return ERR_INVALID_OPERATION;
1924 }
1925
GetBundleImportance(int & importance)1926 ErrCode AnsManagerStub::GetBundleImportance(int &importance)
1927 {
1928 ANS_LOGE("AnsManagerStub::GetBundleImportance called!");
1929 return ERR_INVALID_OPERATION;
1930 }
1931
HasNotificationPolicyAccessPermission(bool & granted)1932 ErrCode AnsManagerStub::HasNotificationPolicyAccessPermission(bool &granted)
1933 {
1934 ANS_LOGE("AnsManagerStub::HasNotificationPolicyAccessPermission called!");
1935 return ERR_INVALID_OPERATION;
1936 }
1937
SetPrivateNotificationsAllowed(bool allow)1938 ErrCode AnsManagerStub::SetPrivateNotificationsAllowed(bool allow)
1939 {
1940 ANS_LOGE("AnsManagerStub::SetPrivateNotificationsAllowed called!");
1941 return ERR_INVALID_OPERATION;
1942 }
1943
GetPrivateNotificationsAllowed(bool & allow)1944 ErrCode AnsManagerStub::GetPrivateNotificationsAllowed(bool &allow)
1945 {
1946 ANS_LOGE("AnsManagerStub::GetPrivateNotificationsAllowed called!");
1947 return ERR_INVALID_OPERATION;
1948 }
1949
RemoveNotification(const sptr<NotificationBundleOption> & bundleOption,int notificationId,const std::string & label,int32_t removeReason)1950 ErrCode AnsManagerStub::RemoveNotification(const sptr<NotificationBundleOption> &bundleOption,
1951 int notificationId, const std::string &label, int32_t removeReason)
1952 {
1953 ANS_LOGE("AnsManagerStub::RemoveNotification called!");
1954 return ERR_INVALID_OPERATION;
1955 }
1956
RemoveAllNotifications(const sptr<NotificationBundleOption> & bundleOption)1957 ErrCode AnsManagerStub::RemoveAllNotifications(const sptr<NotificationBundleOption> &bundleOption)
1958 {
1959 ANS_LOGE("AnsManagerStub::RemoveAllNotifications called!");
1960 return ERR_INVALID_OPERATION;
1961 }
1962
Delete(const std::string & key,int32_t removeReason)1963 ErrCode AnsManagerStub::Delete(const std::string &key, int32_t removeReason)
1964 {
1965 ANS_LOGE("AnsManagerStub::Delete called!");
1966 return ERR_INVALID_OPERATION;
1967 }
1968
DeleteByBundle(const sptr<NotificationBundleOption> & bundleOption)1969 ErrCode AnsManagerStub::DeleteByBundle(const sptr<NotificationBundleOption> &bundleOption)
1970 {
1971 ANS_LOGE("AnsManagerStub::DeleteByBundle called!");
1972 return ERR_INVALID_OPERATION;
1973 }
1974
DeleteAll()1975 ErrCode AnsManagerStub::DeleteAll()
1976 {
1977 ANS_LOGE("AnsManagerStub::DeleteAll called!");
1978 return ERR_INVALID_OPERATION;
1979 }
1980
GetSlotsByBundle(const sptr<NotificationBundleOption> & bundleOption,std::vector<sptr<NotificationSlot>> & slots)1981 ErrCode AnsManagerStub::GetSlotsByBundle(
1982 const sptr<NotificationBundleOption> &bundleOption, std::vector<sptr<NotificationSlot>> &slots)
1983 {
1984 ANS_LOGE("AnsManagerStub::GetSlotsByBundle called!");
1985 return ERR_INVALID_OPERATION;
1986 }
1987
UpdateSlots(const sptr<NotificationBundleOption> & bundleOption,const std::vector<sptr<NotificationSlot>> & slots)1988 ErrCode AnsManagerStub::UpdateSlots(
1989 const sptr<NotificationBundleOption> &bundleOption, const std::vector<sptr<NotificationSlot>> &slots)
1990 {
1991 ANS_LOGE("AnsManagerStub::UpdateSlots called!");
1992 return ERR_INVALID_OPERATION;
1993 }
1994
RequestEnableNotification(const std::string & deviceId)1995 ErrCode AnsManagerStub::RequestEnableNotification(const std::string &deviceId)
1996 {
1997 ANS_LOGE("AnsManagerStub::RequestEnableNotification called!");
1998 return ERR_INVALID_OPERATION;
1999 }
2000
SetNotificationsEnabledForBundle(const std::string & bundle,bool enabled)2001 ErrCode AnsManagerStub::SetNotificationsEnabledForBundle(const std::string &bundle, bool enabled)
2002 {
2003 ANS_LOGE("AnsManagerStub::SetNotificationsEnabledForBundle called!");
2004 return ERR_INVALID_OPERATION;
2005 }
2006
SetNotificationsEnabledForAllBundles(const std::string & deviceId,bool enabled)2007 ErrCode AnsManagerStub::SetNotificationsEnabledForAllBundles(const std::string &deviceId, bool enabled)
2008 {
2009 ANS_LOGE("AnsManagerStub::SetNotificationsEnabledForAllBundles called!");
2010 return ERR_INVALID_OPERATION;
2011 }
2012
SetNotificationsEnabledForSpecialBundle(const std::string & deviceId,const sptr<NotificationBundleOption> & bundleOption,bool enabled)2013 ErrCode AnsManagerStub::SetNotificationsEnabledForSpecialBundle(
2014 const std::string &deviceId, const sptr<NotificationBundleOption> &bundleOption, bool enabled)
2015 {
2016 ANS_LOGE("AnsManagerStub::SetNotificationsEnabledForSpecialBundle called!");
2017 return ERR_INVALID_OPERATION;
2018 }
2019
SetShowBadgeEnabledForBundle(const sptr<NotificationBundleOption> & bundleOption,bool enabled)2020 ErrCode AnsManagerStub::SetShowBadgeEnabledForBundle(const sptr<NotificationBundleOption> &bundleOption, bool enabled)
2021 {
2022 ANS_LOGE("AnsManagerStub::SetShowBadgeEnabledForBundle called!");
2023 return ERR_INVALID_OPERATION;
2024 }
2025
GetShowBadgeEnabledForBundle(const sptr<NotificationBundleOption> & bundleOption,bool & enabled)2026 ErrCode AnsManagerStub::GetShowBadgeEnabledForBundle(const sptr<NotificationBundleOption> &bundleOption, bool &enabled)
2027 {
2028 ANS_LOGE("AnsManagerStub::GetShowBadgeEnabledForBundle called!");
2029 return ERR_INVALID_OPERATION;
2030 }
2031
GetShowBadgeEnabled(bool & enabled)2032 ErrCode AnsManagerStub::GetShowBadgeEnabled(bool &enabled)
2033 {
2034 ANS_LOGE("AnsManagerStub::GetShowBadgeEnabled called!");
2035 return ERR_INVALID_OPERATION;
2036 }
2037
Subscribe(const sptr<AnsSubscriberInterface> & subscriber,const sptr<NotificationSubscribeInfo> & info)2038 ErrCode AnsManagerStub::Subscribe(const sptr<AnsSubscriberInterface> &subscriber,
2039 const sptr<NotificationSubscribeInfo> &info)
2040 {
2041 ANS_LOGE("AnsManagerStub::Subscribe called!");
2042 return ERR_INVALID_OPERATION;
2043 }
2044
Unsubscribe(const sptr<AnsSubscriberInterface> & subscriber,const sptr<NotificationSubscribeInfo> & info)2045 ErrCode AnsManagerStub::Unsubscribe(const sptr<AnsSubscriberInterface> &subscriber,
2046 const sptr<NotificationSubscribeInfo> &info)
2047 {
2048 ANS_LOGE("AnsManagerStub::Unsubscribe called!");
2049 return ERR_INVALID_OPERATION;
2050 }
2051
AreNotificationsSuspended(bool & suspended)2052 ErrCode AnsManagerStub::AreNotificationsSuspended(bool &suspended)
2053 {
2054 ANS_LOGE("AnsManagerStub::AreNotificationsSuspended called!");
2055 return ERR_INVALID_OPERATION;
2056 }
2057
GetCurrentAppSorting(sptr<NotificationSortingMap> & sortingMap)2058 ErrCode AnsManagerStub::GetCurrentAppSorting(sptr<NotificationSortingMap> &sortingMap)
2059 {
2060 ANS_LOGE("AnsManagerStub::GetCurrentAppSorting called!");
2061 return ERR_INVALID_OPERATION;
2062 }
2063
IsAllowedNotify(bool & allowed)2064 ErrCode AnsManagerStub::IsAllowedNotify(bool &allowed)
2065 {
2066 ANS_LOGE("AnsManagerStub::IsAllowedNotify called!");
2067 return ERR_INVALID_OPERATION;
2068 }
2069
IsAllowedNotifySelf(bool & allowed)2070 ErrCode AnsManagerStub::IsAllowedNotifySelf(bool &allowed)
2071 {
2072 ANS_LOGE("AnsManagerStub::IsAllowedNotifySelf called!");
2073 return ERR_INVALID_OPERATION;
2074 }
2075
IsSpecialBundleAllowedNotify(const sptr<NotificationBundleOption> & bundleOption,bool & allowed)2076 ErrCode AnsManagerStub::IsSpecialBundleAllowedNotify(const sptr<NotificationBundleOption> &bundleOption, bool &allowed)
2077 {
2078 ANS_LOGE("AnsManagerStub::IsSpecialBundleAllowedNotify called!");
2079 return ERR_INVALID_OPERATION;
2080 }
2081
CancelGroup(const std::string & groupName)2082 ErrCode AnsManagerStub::CancelGroup(const std::string &groupName)
2083 {
2084 ANS_LOGE("AnsManagerStub::CancelGroup called!");
2085 return ERR_INVALID_OPERATION;
2086 }
2087
RemoveGroupByBundle(const sptr<NotificationBundleOption> & bundleOption,const std::string & groupName)2088 ErrCode AnsManagerStub::RemoveGroupByBundle(
2089 const sptr<NotificationBundleOption> &bundleOption, const std::string &groupName)
2090 {
2091 ANS_LOGE("AnsManagerStub::RemoveGroupByBundle called!");
2092 return ERR_INVALID_OPERATION;
2093 }
2094
SetDoNotDisturbDate(const sptr<NotificationDoNotDisturbDate> & date)2095 ErrCode AnsManagerStub::SetDoNotDisturbDate(const sptr<NotificationDoNotDisturbDate> &date)
2096 {
2097 ANS_LOGE("AnsManagerStub::SetDoNotDisturbDate called!");
2098 return ERR_INVALID_OPERATION;
2099 }
2100
GetDoNotDisturbDate(sptr<NotificationDoNotDisturbDate> & date)2101 ErrCode AnsManagerStub::GetDoNotDisturbDate(sptr<NotificationDoNotDisturbDate> &date)
2102 {
2103 ANS_LOGE("AnsManagerStub::GetDoNotDisturbDate called!");
2104 return ERR_INVALID_OPERATION;
2105 }
2106
DoesSupportDoNotDisturbMode(bool & doesSupport)2107 ErrCode AnsManagerStub::DoesSupportDoNotDisturbMode(bool &doesSupport)
2108 {
2109 ANS_LOGE("AnsManagerStub::DoesSupportDoNotDisturbMode called!");
2110 return ERR_INVALID_OPERATION;
2111 }
2112
IsDistributedEnabled(bool & enabled)2113 ErrCode AnsManagerStub::IsDistributedEnabled(bool &enabled)
2114 {
2115 ANS_LOGE("AnsManagerStub::IsDistributedEnabled called!");
2116 return ERR_INVALID_OPERATION;
2117 }
2118
EnableDistributed(bool enabled)2119 ErrCode AnsManagerStub::EnableDistributed(bool enabled)
2120 {
2121 ANS_LOGE("AnsManagerStub::EnableDistributed called!");
2122 return ERR_INVALID_OPERATION;
2123 }
2124
EnableDistributedByBundle(const sptr<NotificationBundleOption> & bundleOption,bool enabled)2125 ErrCode AnsManagerStub::EnableDistributedByBundle(const sptr<NotificationBundleOption> &bundleOption, bool enabled)
2126 {
2127 ANS_LOGE("AnsManagerStub::EnableDistributedByBundle called!");
2128 return ERR_INVALID_OPERATION;
2129 }
2130
EnableDistributedSelf(bool enabled)2131 ErrCode AnsManagerStub::EnableDistributedSelf(bool enabled)
2132 {
2133 ANS_LOGE("AnsManagerStub::EnableDistributedSelf called!");
2134 return ERR_INVALID_OPERATION;
2135 }
2136
IsDistributedEnableByBundle(const sptr<NotificationBundleOption> & bundleOption,bool & enabled)2137 ErrCode AnsManagerStub::IsDistributedEnableByBundle(const sptr<NotificationBundleOption> &bundleOption, bool &enabled)
2138 {
2139 ANS_LOGE("AnsManagerStub::IsDistributedEnableByBundle called!");
2140 return ERR_INVALID_OPERATION;
2141 }
2142
GetDeviceRemindType(NotificationConstant::RemindType & remindType)2143 ErrCode AnsManagerStub::GetDeviceRemindType(NotificationConstant::RemindType &remindType)
2144 {
2145 ANS_LOGE("AnsManagerStub::GetDeviceRemindType called!");
2146 return ERR_INVALID_OPERATION;
2147 }
2148
PublishContinuousTaskNotification(const sptr<NotificationRequest> & request)2149 ErrCode AnsManagerStub::PublishContinuousTaskNotification(const sptr<NotificationRequest> &request)
2150 {
2151 ANS_LOGE("AnsManagerStub::PublishContinuousTaskNotification called!");
2152 return ERR_INVALID_OPERATION;
2153 }
2154
CancelContinuousTaskNotification(const std::string & label,int32_t notificationId)2155 ErrCode AnsManagerStub::CancelContinuousTaskNotification(const std::string &label, int32_t notificationId)
2156 {
2157 ANS_LOGE("AnsManagerStub::CancelContinuousTaskNotification called!");
2158 return ERR_INVALID_OPERATION;
2159 }
2160
PublishReminder(sptr<ReminderRequest> & reminder)2161 ErrCode AnsManagerStub::PublishReminder(sptr<ReminderRequest> &reminder)
2162 {
2163 ANS_LOGE("AnsManagerStub::PublishReminder called!");
2164 return ERR_INVALID_OPERATION;
2165 }
2166
CancelReminder(const int32_t reminderId)2167 ErrCode AnsManagerStub::CancelReminder(const int32_t reminderId)
2168 {
2169 ANS_LOGE("AnsManagerStub::CancelReminder called!");
2170 return ERR_INVALID_OPERATION;
2171 }
2172
GetValidReminders(std::vector<sptr<ReminderRequest>> & reminders)2173 ErrCode AnsManagerStub::GetValidReminders(std::vector<sptr<ReminderRequest>> &reminders)
2174 {
2175 ANS_LOGE("AnsManagerStub::getValidReminders called!");
2176 return ERR_INVALID_OPERATION;
2177 }
2178
CancelAllReminders()2179 ErrCode AnsManagerStub::CancelAllReminders()
2180 {
2181 ANS_LOGE("AnsManagerStub::cancelAllReminders called!");
2182 return ERR_INVALID_OPERATION;
2183 }
2184
IsSupportTemplate(const std::string & templateName,bool & support)2185 ErrCode AnsManagerStub::IsSupportTemplate(const std::string &templateName, bool &support)
2186 {
2187 ANS_LOGE("AnsManagerStub::IsSupportTemplate called!");
2188 return ERR_INVALID_OPERATION;
2189 }
2190
IsSpecialUserAllowedNotify(const int32_t & userId,bool & allowed)2191 ErrCode AnsManagerStub::IsSpecialUserAllowedNotify(const int32_t &userId, bool &allowed)
2192 {
2193 ANS_LOGE("AnsManagerStub::IsSpecialUserAllowedNotify called!");
2194 return ERR_INVALID_OPERATION;
2195 }
2196
SetNotificationsEnabledByUser(const int32_t & deviceId,bool enabled)2197 ErrCode AnsManagerStub::SetNotificationsEnabledByUser(const int32_t &deviceId, bool enabled)
2198 {
2199 ANS_LOGE("AnsManagerStub::SetNotificationsEnabledByUser called!");
2200 return ERR_INVALID_OPERATION;
2201 }
2202
DeleteAllByUser(const int32_t & userId)2203 ErrCode AnsManagerStub::DeleteAllByUser(const int32_t &userId)
2204 {
2205 ANS_LOGE("AnsManagerStub::DeleteAllByUser called!");
2206 return ERR_INVALID_OPERATION;
2207 }
2208
SetDoNotDisturbDate(const int32_t & userId,const sptr<NotificationDoNotDisturbDate> & date)2209 ErrCode AnsManagerStub::SetDoNotDisturbDate(const int32_t &userId, const sptr<NotificationDoNotDisturbDate> &date)
2210 {
2211 ANS_LOGE("AnsManagerStub::SetDoNotDisturbDate called!");
2212 return ERR_INVALID_OPERATION;
2213 }
2214
GetDoNotDisturbDate(const int32_t & userId,sptr<NotificationDoNotDisturbDate> & date)2215 ErrCode AnsManagerStub::GetDoNotDisturbDate(const int32_t &userId, sptr<NotificationDoNotDisturbDate> &date)
2216 {
2217 ANS_LOGE("AnsManagerStub::GetDoNotDisturbDate called!");
2218 return ERR_INVALID_OPERATION;
2219 }
2220
SetEnabledForBundleSlot(const sptr<NotificationBundleOption> & bundleOption,const NotificationConstant::SlotType & slotType,bool enabled)2221 ErrCode AnsManagerStub::SetEnabledForBundleSlot(
2222 const sptr<NotificationBundleOption> &bundleOption, const NotificationConstant::SlotType &slotType, bool enabled)
2223 {
2224 ANS_LOGE("AnsManagerStub::SetEnabledForBundleSlot called!");
2225 return ERR_INVALID_OPERATION;
2226 }
2227
GetEnabledForBundleSlot(const sptr<NotificationBundleOption> & bundleOption,const NotificationConstant::SlotType & slotType,bool & enabled)2228 ErrCode AnsManagerStub::GetEnabledForBundleSlot(
2229 const sptr<NotificationBundleOption> &bundleOption, const NotificationConstant::SlotType &slotType, bool &enabled)
2230 {
2231 ANS_LOGE("AnsManagerStub::GetEnabledForBundleSlot called!");
2232 return ERR_INVALID_OPERATION;
2233 }
2234
2235
ShellDump(const std::string & cmd,const std::string & bundle,int32_t userId,std::vector<std::string> & dumpInfo)2236 ErrCode AnsManagerStub::ShellDump(const std::string &cmd, const std::string &bundle, int32_t userId,
2237 std::vector<std::string> &dumpInfo)
2238 {
2239 ANS_LOGE("AnsManagerStub::ShellDump called!");
2240 return ERR_INVALID_OPERATION;
2241 }
2242
SetSyncNotificationEnabledWithoutApp(const int32_t userId,const bool enabled)2243 ErrCode AnsManagerStub::SetSyncNotificationEnabledWithoutApp(const int32_t userId, const bool enabled)
2244 {
2245 ANS_LOGE("AnsManagerStub::SetSyncNotificationEnabledWithoutApp called!");
2246 return ERR_INVALID_OPERATION;
2247 }
2248
GetSyncNotificationEnabledWithoutApp(const int32_t userId,bool & enabled)2249 ErrCode AnsManagerStub::GetSyncNotificationEnabledWithoutApp(const int32_t userId, bool &enabled)
2250 {
2251 ANS_LOGE("AnsManagerStub::GetSyncNotificationEnabledWithoutApp called!");
2252 return ERR_INVALID_OPERATION;
2253 }
2254 } // namespace Notification
2255 } // namespace OHOS
2256