diff --git a/frameworks/core/src/manager/ans_manager_stub.cpp b/frameworks/core/src/manager/ans_manager_stub.cpp deleted file mode 100644 index 32ca46af1452c4df4e5c924d10e25f1af748bd84..0000000000000000000000000000000000000000 --- a/frameworks/core/src/manager/ans_manager_stub.cpp +++ /dev/null @@ -1,2705 +0,0 @@ -/* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "ans_manager_stub.h" -#include "ans_const_define.h" -#include "ans_inner_errors.h" -#include "ans_log_wrapper.h" -#include "ans_subscriber_local_live_view_interface.h" -#include "message_option.h" -#include "message_parcel.h" -#include "notification_bundle_option.h" -#include "notification_button_option.h" -#include "parcel.h" -#include "reminder_request_alarm.h" -#include "reminder_request_calendar.h" -#include "reminder_request_timer.h" - -namespace OHOS { -namespace Notification { -AnsManagerStub::AnsManagerStub() {} - -AnsManagerStub::~AnsManagerStub() {} - -int32_t AnsManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &flags) -{ - std::u16string descriptor = AnsManagerStub::GetDescriptor(); - std::u16string remoteDescriptor = data.ReadInterfaceToken(); - if (descriptor != remoteDescriptor) { - ANS_LOGE("[OnRemoteRequest] fail: invalid interface token!"); - return OBJECT_NULL; - } - ErrCode result = NO_ERROR; - switch (code) { - case static_cast(NotificationInterfaceCode::PUBLISH_NOTIFICATION): { - result = HandlePublish(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::PUBLISH_NOTIFICATION_INDIRECTPROXY): { - result = HandlePublishNotificationForIndirectProxy(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::CANCEL_NOTIFICATION): { - result = HandleCancel(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::CANCEL_ALL_NOTIFICATIONS): { - result = HandleCancelAll(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::CANCEL_AS_BUNDLE_OPTION): { - result = HandleCancelAsBundleOption(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::CANCEL_AS_BUNDLE_AND_USER): { - result = HandleCancelAsBundleAndUser(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::CANCEL_AS_BUNDLE): { - result = HandleCancelAsBundle(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::ADD_SLOT_BY_TYPE): { - result = HandleAddSlotByType(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::ADD_SLOTS): { - result = HandleAddSlots(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::REMOVE_SLOT_BY_TYPE): { - result = HandleRemoveSlotByType(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::REMOVE_ALL_SLOTS): { - result = HandleRemoveAllSlots(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_SLOT_BY_TYPE): { - result = HandleGetSlotByType(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_SLOTS): { - result = HandleGetSlots(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_SLOT_NUM_AS_BUNDLE): { - result = HandleGetSlotNumAsBundle(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_ACTIVE_NOTIFICATIONS): { - result = HandleGetActiveNotifications(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_ACTIVE_NOTIFICATION_NUMS): { - result = HandleGetActiveNotificationNums(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_ALL_ACTIVE_NOTIFICATIONS): { - result = HandleGetAllActiveNotifications(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_SPECIAL_ACTIVE_NOTIFICATIONS): { - result = HandleGetSpecialActiveNotifications(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_ACTIVE_NOTIFICATION_BY_FILTER): { - result = HandleGetActiveNotificationByFilter(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::CAN_PUBLISH_AS_BUNDLE): { - result = HandleCanPublishAsBundle(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::PUBLISH_AS_BUNDLE): { - result = HandlePublishAsBundle(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SET_NOTIFICATION_BADGE_NUM): { - result = HandleSetNotificationBadgeNum(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_BUNDLE_IMPORTANCE): { - result = HandleGetBundleImportance(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::IS_NOTIFICATION_POLICY_ACCESS_GRANTED): { - result = HandleIsNotificationPolicyAccessGranted(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::REMOVE_NOTIFICATION): { - result = HandleRemoveNotification(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::REMOVE_ALL_NOTIFICATIONS): { - result = HandleRemoveAllNotifications(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::REMOVE_NOTIFICATIONS_BY_KEYS): { - result = HandleRemoveNotifications(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::DELETE_NOTIFICATION): { - result = HandleDelete(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::DELETE_NOTIFICATION_BY_BUNDLE): { - result = HandleDeleteByBundle(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::DELETE_ALL_NOTIFICATIONS): { - result = HandleDeleteAll(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_SLOTS_BY_BUNDLE): { - result = HandleGetSlotsByBundle(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::UPDATE_SLOTS): { - result = HandleUpdateSlots(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::REQUEST_ENABLE_NOTIFICATION): { - result = HandleRequestEnableNotification(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SET_NOTIFICATION_ENABLED_FOR_BUNDLE): { - result = HandleSetNotificationsEnabledForBundle(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SET_NOTIFICATION_ENABLED_FOR_ALL_BUNDLE): { - result = HandleSetNotificationsEnabledForAllBundles(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SET_NOTIFICATION_ENABLED_FOR_SPECIAL_BUNDLE): { - result = HandleSetNotificationsEnabledForSpecialBundle(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SET_SHOW_BADGE_ENABLED_FOR_BUNDLE): { - result = HandleSetShowBadgeEnabledForBundle(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_SHOW_BADGE_ENABLED_FOR_BUNDLE): { - result = HandleGetShowBadgeEnabledForBundle(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_SHOW_BADGE_ENABLED): { - result = HandleGetShowBadgeEnabled(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SUBSCRIBE_NOTIFICATION): { - result = HandleSubscribe(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::UNSUBSCRIBE_NOTIFICATION): { - result = HandleUnsubscribe(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::IS_ALLOWED_NOTIFY): { - result = HandleIsAllowedNotify(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::IS_ALLOWED_NOTIFY_SELF): { - result = HandleIsAllowedNotifySelf(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::CAN_POP_ENABLE_NOTIFICATION_DIALOG): { - result = HandleCanPopEnableNotificationDialog(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::REMOVE_ENABLE_NOTIFICATION_DIALOG): { - result = HandleRemoveEnableNotificationDialog(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::IS_SPECIAL_BUNDLE_ALLOWED_NOTIFY): { - result = HandleIsSpecialBundleAllowedNotify(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SET_DO_NOT_DISTURB_DATE): { - result = HandleSetDoNotDisturbDate(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_DO_NOT_DISTURB_DATE): { - result = HandleGetDoNotDisturbDate(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::DOES_SUPPORT_DO_NOT_DISTURB_MODE): { - result = HandleDoesSupportDoNotDisturbMode(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::IS_NEED_SILENT_IN_DO_NOT_DISTURB_MODE): { - result = HandleIsNeedSilentInDoNotDisturbMode(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::CANCEL_GROUP): { - result = HandleCancelGroup(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::REMOVE_GROUP_BY_BUNDLE): { - result = HandleRemoveGroupByBundle(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::IS_DISTRIBUTED_ENABLED): { - result = HandleIsDistributedEnabled(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::ENABLE_DISTRIBUTED): { - result = HandleEnableDistributed(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::ENABLE_DISTRIBUTED_BY_BUNDLE): { - result = HandleEnableDistributedByBundle(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::ENABLE_DISTRIBUTED_SELF): { - result = HandleEnableDistributedSelf(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::IS_DISTRIBUTED_ENABLED_BY_BUNDLE): { - result = HandleIsDistributedEnableByBundle(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_DEVICE_REMIND_TYPE): { - result = HandleGetDeviceRemindType(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SHELL_DUMP): { - result = HandleShellDump(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::PUBLISH_CONTINUOUS_TASK_NOTIFICATION): { - result = HandlePublishContinuousTaskNotification(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::CANCEL_CONTINUOUS_TASK_NOTIFICATION): { - result = HandleCancelContinuousTaskNotification(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::IS_SUPPORT_TEMPLATE): { - result = HandleIsSupportTemplate(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::IS_SPECIAL_USER_ALLOWED_NOTIFY): { - result = HandleIsSpecialUserAllowedNotifyByUser(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SET_NOTIFICATION_ENABLED_BY_USER): { - result = HandleSetNotificationsEnabledByUser(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::DELETE_ALL_NOTIFICATIONS_BY_USER): { - result = HandleDeleteAllByUser(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SET_DO_NOT_DISTURB_DATE_BY_USER): { - result = HandleSetDoNotDisturbDateByUser(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_DO_NOT_DISTURB_DATE_BY_USER): { - result = HandleGetDoNotDisturbDateByUser(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SET_ENABLED_FOR_BUNDLE_SLOT): { - result = HandleSetEnabledForBundleSlot(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_ENABLED_FOR_BUNDLE_SLOT): { - result = HandleGetEnabledForBundleSlot(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_ENABLED_FOR_BUNDLE_SLOT_SELF): { - result = HandleGetEnabledForBundleSlotSelf(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SET_DISTRIBUTED_ENABLED_BY_BUNDLE): { - result = HandleSetDistributedEnabledByBundle(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_DISTRIBUTED_ENABLED_BY_BUNDLE): { - result = HandleIsDistributedEnabledByBundle(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SET_SMART_REMINDER_ENABLED): { - result = HandleSetSmartReminderEnabled(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_SMART_REMINDER_ENABLED): { - result = HandleIsSmartReminderEnabled(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SET_DISTRIBUTED_ENABLED_BY_SLOT): { - result = HandleSetDistributedEnabledBySlot(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_DISTRIBUTED_ENABLED_BY_SLOT): { - result = HandleIsDistributedEnabledBySlot(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SET_SYNC_NOTIFICATION_ENABLED_WITHOUT_APP): { - result = HandleDistributedSetEnabledWithoutApp(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_SYNC_NOTIFICATION_ENABLED_WITHOUT_APP): { - result = HandleDistributedGetEnabledWithoutApp(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SET_BADGE_NUMBER): { - result = HandleSetBadgeNumber(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SET_BADGE_NUMBER_BY_BUNDLE): { - result = HandleSetBadgeNumberByBundle(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_ALL_NOTIFICATION_ENABLE_STATUS): { - result = HandleGetAllNotificationEnableStatus(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_ALL_LIVEVIEW_ENABLE_STATUS): { - result = HandleGetAllLiveViewEnabledBundles(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_ALL_DISTRIBUTED_ENABLE_STATUS): { - result = HandleGetAllDistribuedEnabledBundles(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::REGISTER_PUSH_CALLBACK): { - result = HandleRegisterPushCallback(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::UNREGISTER_PUSH_CALLBACK): { - result = HandleUnregisterPushCallback(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SUBSCRIBE_LOCAL_LIVE_VIEW_NOTIFICATION): { - result = HandleSubscribeLocalLiveView(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::TRIGGER_LOCAL_LIVE_VIEW_NOTIFICATION): { - result = HandleTriggerLocalLiveView(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SUBSCRIBE_NOTIFICATION_SELF): { - result = HandleSubscribeSelf(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SET_SLOTFLAGS_BY_BUNDLE): { - result = HandleSetSlotFlagsAsBundle(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_SLOTFLAGS_BY_BUNDLE): { - result = HandleGetSlotFlagsAsBundle(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SET_NOTIFICATION_AGENT_RELATIONSHIP): { - result = HandleSetAdditionConfig(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::CANCEL_AS_BUNDLE_WITH_AGENT): { - result = HandleCancelAsBundleWithAgent(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_SLOT_BY_BUNDLE): { - result = HandleGetSlotByBundle(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::ADD_DO_NOTDISTURB_PROFILES): { - result = HandleAddDoNotDisturbProfiles(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::REMOVE_DO_NOT_DISTURB_PROFILES): { - result = HandleRemoveDoNotDisturbProfiles(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SET_TARGET_DEVICE_STATUS): { - result = HandleSetTargetDeviceStatus(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::SET_TARGET_DEVICE_STATUS_WITH_FLAG): { - result = HandleSetDeviceStatus(data, reply); - break; - } -#ifdef NOTIFICATION_SMART_REMINDER_SUPPORTED - case static_cast(NotificationInterfaceCode::REGISTER_SWING_CALLBACK): { - result = HandleRegisterSwingCallback(data, reply); - break; - } -#endif - case static_cast(NotificationInterfaceCode::GET_DONOTDISTURB_PROFILE): { - result = HandleGetDoNotDisturbProfile(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::UPDATE_NOTIFICATION_TIMER): { - result = HandleUpdateNotificationTimerByUid(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::ALLOW_USE_REMINDER): { - result = HandleAllowUseReminder(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::DISABLE_NOTIFICATION_FEATURE): { - result = HandleDisableNotificationFeature(data, reply); - break; - } - case static_cast(NotificationInterfaceCode::GET_TARGET_DEVICE_STATUS): { - result = HandleGetDeviceStatus(data, reply); - break; - } - default: { - ANS_LOGE("[OnRemoteRequest] fail: unknown code!"); - return IPCObjectStub::OnRemoteRequest(code, data, reply, flags); - } - } - if (SUCCEEDED(result)) { - return NO_ERROR; - } - - ANS_LOGE("[OnRemoteRequest] fail: Failed to call interface %{public}u, err:%{public}d", code, result); - return result; -} - -ErrCode AnsManagerStub::HandlePublish(MessageParcel &data, MessageParcel &reply) -{ - std::string label; - if (!data.ReadString(label)) { - ANS_LOGE("[HandlePublish] fail: read label failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - sptr notification = data.ReadParcelable(); - if (!notification) { - ANS_LOGE("[HandlePublish] fail: notification ReadParcelable failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = Publish(label, notification); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandlePublish] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandlePublishNotificationForIndirectProxy(MessageParcel &data, MessageParcel &reply) -{ - sptr notification = data.ReadParcelable(); - if (!notification) { - ANS_LOGE("[HandlePublishNotificationForIndirectProxy] fail: notification ReadParcelable failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = PublishNotificationForIndirectProxy(notification); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandlePublishNotificationForIndirectProxy] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleCancel(MessageParcel &data, MessageParcel &reply) -{ - int32_t notificationId = 0; - if (!data.ReadInt32(notificationId)) { - ANS_LOGE("[HandleCancel] fail: read notificationId failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - std::string label; - if (!data.ReadString(label)) { - ANS_LOGE("[HandleCancel] fail: read label failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - std::string appInstanceKey; - if (!data.ReadString(appInstanceKey)) { - ANS_LOGE("[HandleCancel] fail: read InstanceKey failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = Cancel(notificationId, label, appInstanceKey); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleCancel] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleCancelAll(MessageParcel &data, MessageParcel &reply) -{ - std::string appInstanceKey; - if (!data.ReadString(appInstanceKey)) { - ANS_LOGE("[HandleCancelAll] fail: read instanceKey failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = CancelAll(appInstanceKey); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleCancelAll] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleCancelAsBundleOption(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadStrongParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleCancelAsBundle] fail: read BundleOption failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - int32_t notificationId = 0; - if (!data.ReadInt32(notificationId)) { - ANS_LOGE("[HandleCancelAsBundle] fail: read notificationId failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - ErrCode result = CancelAsBundle(bundleOption, notificationId); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleCancelAsBundle] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleCancelAsBundle(MessageParcel &data, MessageParcel &reply) -{ - int32_t notificationId = 0; - if (!data.ReadInt32(notificationId)) { - ANS_LOGE("[HandleCancelAsBundle] fail: read notificationId failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - std::string representativeBundle; - if (!data.ReadString(representativeBundle)) { - ANS_LOGE("[HandleCancelAsBundle] fail: read representativeBundle failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - int32_t userId = 0; - if (!data.ReadInt32(userId)) { - ANS_LOGE("[HandleCancelAsBundle] fail: read userId failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = CancelAsBundle(notificationId, representativeBundle, userId); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleCancelAsBundle] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleCancelAsBundleAndUser(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadStrongParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleCancelAsBundle] fail: read BundleOption failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - int32_t notificationId = 0; - if (!data.ReadInt32(notificationId)) { - ANS_LOGE("[HandleCancelAsBundle] fail: read notificationId failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - int32_t userId = 0; - if (!data.ReadInt32(userId)) { - ANS_LOGE("[HandleCancelAsBundle] fail: read userId failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - ErrCode result = CancelAsBundle(bundleOption, notificationId, userId); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleCancelAsBundle] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleAddSlotByType(MessageParcel &data, MessageParcel &reply) -{ - NotificationConstant::SlotType slotType = static_cast(data.ReadInt32()); - ErrCode result = AddSlotByType(slotType); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleAddSlotByType] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleAddSlots(MessageParcel &data, MessageParcel &reply) -{ - std::vector> slots; - if (!ReadParcelableVector(slots, data)) { - ANS_LOGE("[HandleAddSlots] fail: read slotsSize failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - ErrCode result = AddSlots(slots); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleAddSlots] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleRemoveSlotByType(MessageParcel &data, MessageParcel &reply) -{ - NotificationConstant::SlotType slotType = static_cast(data.ReadInt32()); - - ErrCode result = RemoveSlotByType(slotType); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleRemoveSlotByType] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleRemoveAllSlots(MessageParcel &data, MessageParcel &reply) -{ - ErrCode result = RemoveAllSlots(); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleRemoveAllSlots] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetSlots(MessageParcel &data, MessageParcel &reply) -{ - std::vector> slots; - ErrCode result = GetSlots(slots); - if (!WriteParcelableVector(slots, reply, result)) { - ANS_LOGE("[HandleGetSlots] fail: write slots failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetSlotByType(MessageParcel &data, MessageParcel &reply) -{ - NotificationConstant::SlotType slotType = static_cast(data.ReadInt32()); - - sptr slot = nullptr; - ErrCode result = GetSlotByType(slotType, slot); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleGetSlotByType] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteParcelable(slot)) { - ANS_LOGE("[HandleGetSlotByType] fail: write slot failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetSlotNumAsBundle(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadStrongParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleGetSlotNumAsBundle] fail: read bundle failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - uint64_t num = 0; - ErrCode result = GetSlotNumAsBundle(bundleOption, num); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleGetSlotNumAsBundle] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteUint64(num)) { - ANS_LOGE("[HandleGetSlotNumAsBundle] fail: write enabled failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleSetSlotFlagsAsBundle(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadStrongParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleSetSlotFlagsAsBundle] fail: read bundle failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - int32_t slotFlags = 0; - if (!data.ReadInt32(slotFlags)) { - ANS_LOGE("[HandleSetSlotFlagsAsBundle] fail: read notification failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = SetSlotFlagsAsBundle(bundleOption, slotFlags); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleSetSlotFlagsAsBundle] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetSlotFlagsAsBundle(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadStrongParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleGetSlotFlagsAsBundle] fail: read bundle failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - uint32_t slotFlags = 0; - ErrCode result = GetSlotFlagsAsBundle(bundleOption, slotFlags); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleGetSlotFlagsAsBundle] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteUint32(slotFlags)) { - ANS_LOGE("[HandleGetSlotFlagsAsBundle] fail: write enabled failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetActiveNotifications(MessageParcel &data, MessageParcel &reply) -{ - std::string appInstanceKey; - if (!data.ReadString(appInstanceKey)) { - ANS_LOGE("[HandleGetActiveNotifications] fail: read instanceKey failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - std::vector> notifications; - ErrCode result = GetActiveNotifications(notifications, appInstanceKey); - if (!WriteParcelableVector(notifications, reply, result)) { - ANS_LOGE("[HandleGetActiveNotifications] fail: write notifications failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetActiveNotificationNums(MessageParcel &data, MessageParcel &reply) -{ - uint64_t num = 0; - ErrCode result = GetActiveNotificationNums(num); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleGetActiveNotificationNums] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteUint64(num)) { - ANS_LOGE("[HandleGetActiveNotificationNums] fail: write num failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetAllActiveNotifications(MessageParcel &data, MessageParcel &reply) -{ - std::vector> notifications; - ErrCode result = GetAllActiveNotifications(notifications); - - if (!reply.SetMaxCapacity(NotificationConstant::NOTIFICATION_MAX_LIVE_VIEW_SIZE)) { - return ERR_ANS_PARCELABLE_FAILED; - } - if (!WriteParcelableVector(notifications, reply, result)) { - ANS_LOGE("[HandleGetAllActiveNotifications] fail: write notifications failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetSpecialActiveNotifications(MessageParcel &data, MessageParcel &reply) -{ - std::vector key; - if (!data.ReadStringVector(&key)) { - ANS_LOGE("[HandleGetSpecialActiveNotifications] fail: read key failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - std::vector> notifications; - ErrCode result = GetSpecialActiveNotifications(key, notifications); - if (!WriteParcelableVector(notifications, reply, result)) { - ANS_LOGE("[HandleGetSpecialActiveNotifications] fail: write notifications failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetActiveNotificationByFilter(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleGetActiveNotificationByFilter] fail: read bundleOption failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - int32_t notificationId = 0; - if (!data.ReadInt32(notificationId)) { - ANS_LOGE("[HandleGetActiveNotificationByFilter] fail: read notificationId failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - std::string label; - if (!data.ReadString(label)) { - ANS_LOGE("[HandleGetActiveNotificationByFilter] fail: read label failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - std::vector extraInfoKeys; - if (!data.ReadStringVector(&extraInfoKeys)) { - ANS_LOGE("[HandleGetActiveNotificationByFilter] fail: read extraInfoKeys failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - sptr request; - ErrCode result = GetActiveNotificationByFilter(bundleOption, notificationId, label, extraInfoKeys, request); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleGetActiveNotificationByFilter] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteParcelable(request)) { - ANS_LOGE("[HandleGetActiveNotificationByFilter] fail: get extra info by filter failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - return result; -} - -ErrCode AnsManagerStub::HandleCanPublishAsBundle(MessageParcel &data, MessageParcel &reply) -{ - std::string representativeBundle; - if (!data.ReadString(representativeBundle)) { - ANS_LOGE("[HandleCanPublishAsBundle] fail: read representativeBundle failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool canPublish = false; - ErrCode result = CanPublishAsBundle(representativeBundle, canPublish); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleCanPublishAsBundle] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteBool(canPublish)) { - ANS_LOGE("[HandleCanPublishAsBundle] fail: write canPublish failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandlePublishAsBundle(MessageParcel &data, MessageParcel &reply) -{ - sptr notification = data.ReadParcelable(); - if (!notification) { - ANS_LOGE("[HandlePublishAsBundle] fail: read notification failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - std::string representativeBundle; - if (!data.ReadString(representativeBundle)) { - ANS_LOGE("[HandlePublishAsBundle] fail: read representativeBundle failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = PublishAsBundle(notification, representativeBundle); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandlePublishAsBundle] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleSetNotificationBadgeNum(MessageParcel &data, MessageParcel &reply) -{ - int32_t num = 0; - if (!data.ReadInt32(num)) { - ANS_LOGE("[HandleSetNotificationBadgeNum] fail: read notification failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = SetNotificationBadgeNum(num); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleSetNotificationBadgeNum] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetBundleImportance(MessageParcel &data, MessageParcel &reply) -{ - int32_t importance = 0; - ErrCode result = GetBundleImportance(importance); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleGetBundleImportance] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteInt32(importance)) { - ANS_LOGE("[HandleGetBundleImportance] fail: write importance failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleSetDoNotDisturbDate(MessageParcel &data, MessageParcel &reply) -{ - sptr date = data.ReadParcelable(); - if (date == nullptr) { - ANS_LOGE("[HandleSetDoNotDisturbDate] fail: read date failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = SetDoNotDisturbDate(date); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleSetDoNotDisturbDate] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetDoNotDisturbDate(MessageParcel &data, MessageParcel &reply) -{ - sptr date = nullptr; - - ErrCode result = GetDoNotDisturbDate(date); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleSetDoNotDisturbDate] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (result == ERR_OK) { - if (!reply.WriteParcelable(date)) { - ANS_LOGE("[HandleSetDoNotDisturbDate] fail: write date failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleDoesSupportDoNotDisturbMode(MessageParcel &data, MessageParcel &reply) -{ - bool support = false; - - ErrCode result = DoesSupportDoNotDisturbMode(support); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleDoesSupportDoNotDisturbMode] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteBool(support)) { - ANS_LOGE("[HandleDoesSupportDoNotDisturbMode] fail: write doesSupport failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleIsNeedSilentInDoNotDisturbMode(MessageParcel &data, MessageParcel &reply) -{ - std::string phoneNumber; - if (!data.ReadString(phoneNumber)) { - ANS_LOGE("[HandleIsNeedSilentInDoNotDisturbMode] fail: read phoneNumber failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - int32_t callerType = 0; - if (!data.ReadInt32(callerType)) { - ANS_LOGE("[HandleIsNeedSilentInDoNotDisturbMode] fail: read callerType failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = IsNeedSilentInDoNotDisturbMode(phoneNumber, callerType); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleIsNeedSilentInDoNotDisturbMode] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandlePublishContinuousTaskNotification(MessageParcel &data, MessageParcel &reply) -{ - sptr request = data.ReadParcelable(); - if (!request) { - ANS_LOGE("[HandlePublishContinuousTaskNotification] fail: notification ReadParcelable failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = PublishContinuousTaskNotification(request); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandlePublishContinuousTaskNotification] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleCancelContinuousTaskNotification(MessageParcel &data, MessageParcel &reply) -{ - std::string label; - if (!data.ReadString(label)) { - ANS_LOGE("[HandleCancelContinuousTaskNotification] fail: read label failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - int32_t notificationId = 0; - if (!data.ReadInt32(notificationId)) { - ANS_LOGE("[HandleCancelContinuousTaskNotification] fail: read notificationId failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = CancelContinuousTaskNotification(label, notificationId); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleCancelContinuousTaskNotification] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleIsNotificationPolicyAccessGranted(MessageParcel &data, MessageParcel &reply) -{ - bool granted = false; - ErrCode result = HasNotificationPolicyAccessPermission(granted); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleIsNotificationPolicyAccessGranted] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteBool(granted)) { - ANS_LOGE("[HandleIsNotificationPolicyAccessGranted] fail: write granted failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleTriggerLocalLiveView(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadStrongParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleTriggerLocalLiveView] fail: read bundle failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - int32_t notificationId = 0; - if (!data.ReadInt32(notificationId)) { - ANS_LOGE("[HandleTriggerLocalLiveView] fail: read notificationId failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - sptr buttonOption = data.ReadStrongParcelable(); - if (buttonOption == nullptr) { - ANS_LOGE("[HandleTriggerLocalLiveView] fail: read button failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = TriggerLocalLiveView(bundleOption, notificationId, buttonOption); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleTriggerLocalLiveView] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleRemoveNotification(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadStrongParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleRemoveNotification] fail: read bundle failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - int32_t notificationId = 0; - if (!data.ReadInt32(notificationId)) { - ANS_LOGE("[HandleRemoveNotification] fail: read notificationId failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - std::string label; - if (!data.ReadString(label)) { - ANS_LOGE("[HandleRemoveNotification] fail: read label failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - int32_t removeReason = 0; - if (!data.ReadInt32(removeReason)) { - ANS_LOGE("[HandleRemoveNotification] fail: read removeReason failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = RemoveNotification(bundleOption, notificationId, label, removeReason); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleRemoveNotification] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleRemoveAllNotifications(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadStrongParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleRemoveAllNotifications] fail: read bundle failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = RemoveAllNotifications(bundleOption); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleRemoveAllNotifications] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleRemoveNotifications(MessageParcel &data, MessageParcel &reply) -{ - int32_t keysSize = 0; - if (!data.ReadInt32(keysSize)) { - ANS_LOGE("read keys size failed."); - return false; - } - - std::vector keys; - if (!data.ReadStringVector(&keys)) { - ANS_LOGE("read keys failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - int32_t removeReason = 0; - if (!data.ReadInt32(removeReason)) { - ANS_LOGE("read removeReason failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = RemoveNotifications(keys, removeReason); - if (!reply.WriteInt32(result)) { - ANS_LOGE("write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - - -ErrCode AnsManagerStub::HandleDelete(MessageParcel &data, MessageParcel &reply) -{ - std::string key; - if (!data.ReadString(key)) { - ANS_LOGE("[HandleDelete] fail: read key failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - int32_t removeReason = 0; - if (!data.ReadInt32(removeReason)) { - ANS_LOGE("[HandleDelete] fail: read removeReason failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = Delete(key, removeReason); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleDelete] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleDeleteByBundle(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadStrongParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleDeleteByBundle] fail: read bundle failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = DeleteByBundle(bundleOption); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleDeleteByBundle] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleDeleteAll(MessageParcel &data, MessageParcel &reply) -{ - ErrCode result = DeleteAll(); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleDeleteAll] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetSlotsByBundle(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleGetSlotsByBundle] fail: read bundleOption failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - std::vector> slots; - ErrCode result = GetSlotsByBundle(bundleOption, slots); - if (!WriteParcelableVector(slots, reply, result)) { - ANS_LOGE("[HandleGetSlotsByBundle] fail: write slots failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetSlotByBundle(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleGetSlotByBundle] fail: read bundleOption failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - NotificationConstant::SlotType slotType = static_cast(data.ReadInt32()); - - sptr slot = nullptr; - ErrCode result = GetSlotByBundle(bundleOption, slotType, slot); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleGetSlotByBundle] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteParcelable(slot)) { - ANS_LOGE("[HandleGetSlotByBundle] fail: write slot failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleUpdateSlots(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleUpdateSlots] fail: read bundleOption failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - std::vector> slots; - if (!ReadParcelableVector(slots, data)) { - ANS_LOGE("[HandleUpdateSlots] fail: read slots failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = UpdateSlots(bundleOption, slots); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleUpdateSlots] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleRequestEnableNotification(MessageParcel &data, MessageParcel &reply) -{ - ANS_LOGD("enter"); - std::string deviceId; - if (!data.ReadString(deviceId)) { - ANS_LOGE("[HandleRequestEnableNotification] fail: read deviceId failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - sptr callback = data.ReadRemoteObject(); - if (callback == nullptr) { - ANS_LOGE("[HandleRequestEnableNotification] fail: read callback failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool hasCallerToken = false; - if (!data.ReadBool(hasCallerToken)) { - ANS_LOGE("fail: read hasCallerToken failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - sptr callerToken = nullptr; - if (hasCallerToken) { - callerToken = data.ReadRemoteObject(); - } - - ErrCode result = RequestEnableNotification(deviceId, iface_cast(callback), callerToken); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleRequestEnableNotification] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleSetNotificationsEnabledForBundle(MessageParcel &data, MessageParcel &reply) -{ - std::string deviceId; - if (!data.ReadString(deviceId)) { - ANS_LOGE("[HandleSetNotificationsEnabledForBundle] fail: read deviceId failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool enabled = false; - if (!data.ReadBool(enabled)) { - ANS_LOGE("[HandleSetNotificationsEnabledForBundle] fail: read enabled failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = SetNotificationsEnabledForBundle(deviceId, enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleSetNotificationsEnabledForBundle] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleSetNotificationsEnabledForAllBundles(MessageParcel &data, MessageParcel &reply) -{ - std::string deviceId; - if (!data.ReadString(deviceId)) { - ANS_LOGE("[HandleSetNotificationsEnabledForAllBundles] fail: read deviceId failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool enabled = false; - if (!data.ReadBool(enabled)) { - ANS_LOGE("[HandleSetNotificationsEnabledForAllBundles] fail: read enabled failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = SetNotificationsEnabledForAllBundles(deviceId, enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleSetNotificationsEnabledForAllBundles] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleSetNotificationsEnabledForSpecialBundle(MessageParcel &data, MessageParcel &reply) -{ - std::string deviceId; - if (!data.ReadString(deviceId)) { - ANS_LOGE("[HandleSetNotificationsEnabledForSpecialBundle] fail: read deviceId failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - sptr bundleOption = data.ReadParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleSetNotificationsEnabledForSpecialBundle] fail: read bundleOption failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool enabled = false; - if (!data.ReadBool(enabled)) { - ANS_LOGE("[HandleSetNotificationsEnabledForSpecialBundle] fail: read enabled failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = SetNotificationsEnabledForSpecialBundle(deviceId, bundleOption, enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleSetNotificationsEnabledForSpecialBundle] fail: write result failed, ErrCode=%{public}d", - result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleSetShowBadgeEnabledForBundle(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleSetShowBadgeEnabledForBundle] fail: read bundle failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool enabled = false; - if (!data.ReadBool(enabled)) { - ANS_LOGE("[HandleSetShowBadgeEnabledForBundle] fail: read enabled failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = SetShowBadgeEnabledForBundle(bundleOption, enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleSetShowBadgeEnabledForBundle] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetShowBadgeEnabledForBundle(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleGetShowBadgeEnabledForBundle] fail: read bundle failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool enabled = false; - ErrCode result = GetShowBadgeEnabledForBundle(bundleOption, enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleGetShowBadgeEnabledForBundle] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteBool(enabled)) { - ANS_LOGE("[HandleGetShowBadgeEnabledForBundle] fail: write enabled failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetShowBadgeEnabled(MessageParcel &data, MessageParcel &reply) -{ - bool enabled = false; - ErrCode result = GetShowBadgeEnabled(enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleGetShowBadgeEnabled] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteBool(enabled)) { - ANS_LOGE("[HandleGetShowBadgeEnabled] fail: write enabled failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleSubscribe(MessageParcel &data, MessageParcel &reply) -{ - sptr subscriber = data.ReadRemoteObject(); - if (subscriber == nullptr) { - ANS_LOGE("[HandleSubscribe] fail: read subscriber failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool subcribeInfo = false; - if (!data.ReadBool(subcribeInfo)) { - ANS_LOGE("[HandleSubscribe] fail: read isSubcribeInfo failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - sptr info = nullptr; - if (subcribeInfo) { - info = data.ReadParcelable(); - if (info == nullptr) { - ANS_LOGE("[HandleSubscribe] fail: read info failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - } - - ErrCode result = Subscribe(iface_cast(subscriber), info); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleSubscribe] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleSubscribeSelf(MessageParcel &data, MessageParcel &reply) -{ - sptr subscriber = data.ReadRemoteObject(); - if (subscriber == nullptr) { - ANS_LOGE("[HandleSubscribeSelf] fail: read subscriber failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = SubscribeSelf(iface_cast(subscriber)); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleSubscribeSelf] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleSubscribeLocalLiveView(MessageParcel &data, MessageParcel &reply) -{ - sptr subscriber = data.ReadRemoteObject(); - if (subscriber == nullptr) { - ANS_LOGE("[HandleSubscribeLocalLiveView] fail: read subscriber failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool subcribeInfo = false; - if (!data.ReadBool(subcribeInfo)) { - ANS_LOGE("[HandleSubscribeLocalLiveView] fail: read isSubcribeInfo failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - sptr info = nullptr; - if (subcribeInfo) { - info = data.ReadParcelable(); - if (info == nullptr) { - ANS_LOGE("[HandleSubscribeLocalLiveView] fail: read info failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - } - - bool isNative = false; - if (!data.ReadBool(isNative)) { - ANS_LOGE("[HandleSubscribeLocalLiveView] fail: read isNative failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = - SubscribeLocalLiveView(iface_cast(subscriber), info, isNative); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleSubscribeLocalLiveView] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleUnsubscribe(MessageParcel &data, MessageParcel &reply) -{ - sptr subscriber = data.ReadRemoteObject(); - if (subscriber == nullptr) { - ANS_LOGE("[HandleUnsubscribe] fail: read subscriber failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool subcribeInfo = false; - if (!data.ReadBool(subcribeInfo)) { - ANS_LOGE("[HandleUnsubscribe] fail: read isSubcribeInfo failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - sptr info = nullptr; - if (subcribeInfo) { - info = data.ReadParcelable(); - if (info == nullptr) { - ANS_LOGE("[HandleUnsubscribe] fail: read info failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - } - - ErrCode result = Unsubscribe(iface_cast(subscriber), info); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleUnsubscribe] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleIsAllowedNotify(MessageParcel &data, MessageParcel &reply) -{ - bool allowed = false; - ErrCode result = IsAllowedNotify(allowed); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleIsAllowedNotify] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteBool(allowed)) { - ANS_LOGE("[HandleIsAllowedNotify] fail: write allowed failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleIsAllowedNotifySelf(MessageParcel &data, MessageParcel &reply) -{ - bool allowed = false; - ErrCode result = IsAllowedNotifySelf(allowed); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleIsAllowedNotifySelf] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteBool(allowed)) { - ANS_LOGE("[HandleIsAllowedNotifySelf] fail: write allowed failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleCanPopEnableNotificationDialog(MessageParcel &data, MessageParcel &reply) -{ - sptr callback = data.ReadRemoteObject(); - if (callback == nullptr) { - ANS_LOGE("[HandleCanPopEnableNotificationDialog] fail: read callback failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - bool canPop = false; - std::string bundleName; - ErrCode result = CanPopEnableNotificationDialog(iface_cast(callback), canPop, bundleName); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleCanPopEnableNotificationDialog] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteBool(canPop)) { - ANS_LOGE("[HandleCanPopEnableNotificationDialog] fail: write canPop failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - if (!reply.WriteString(bundleName)) { - ANS_LOGE("[HandleCanPopEnableNotificationDialog] fail: write bundleName failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleRemoveEnableNotificationDialog(MessageParcel &data, MessageParcel &reply) -{ - ErrCode result = RemoveEnableNotificationDialog(); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleRemoveEnableNotificationDialog] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleIsSpecialBundleAllowedNotify(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[IsSpecialBundleAllowedNotify] fail: read bundle failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool allowed = false; - ErrCode result = IsSpecialBundleAllowedNotify(bundleOption, allowed); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[IsSpecialBundleAllowedNotify] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteBool(allowed)) { - ANS_LOGE("[IsSpecialBundleAllowedNotify] fail: write allowed failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleCancelGroup(MessageParcel &data, MessageParcel &reply) -{ - std::string groupName; - if (!data.ReadString(groupName)) { - ANS_LOGE("[HandleCancelGroup] fail: read groupName failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - std::string appInstanceKey; - if (!data.ReadString(appInstanceKey)) { - ANS_LOGE("[HandleCancelGroup] fail: read instanceKey failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = CancelGroup(groupName, appInstanceKey); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleCancelGroup] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleRemoveGroupByBundle(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleRemoveGroupByBundle] fail: read bundleOption failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - std::string groupName; - if (!data.ReadString(groupName)) { - ANS_LOGE("[HandleRemoveGroupByBundle] fail: read groupName failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = RemoveGroupByBundle(bundleOption, groupName); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleRemoveGroupByBundle] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleIsDistributedEnabled(MessageParcel &data, MessageParcel &reply) -{ - bool enabled = false; - ErrCode result = IsDistributedEnabled(enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleIsDistributedEnabled] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteBool(enabled)) { - ANS_LOGE("[HandleIsDistributedEnabled] fail: write enabled failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleEnableDistributed(MessageParcel &data, MessageParcel &reply) -{ - bool enabled = false; - if (!data.ReadBool(enabled)) { - ANS_LOGE("[HandleEnableDistributed] fail: read enabled failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = EnableDistributed(enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleEnableDistributed] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleEnableDistributedByBundle(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleEnableDistributedByBundle] fail: read bundle failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool enabled = false; - if (!data.ReadBool(enabled)) { - ANS_LOGE("[HandleEnableDistributedByBundle] fail: read enabled failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = EnableDistributedByBundle(bundleOption, enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleEnableDistributedByBundle] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleEnableDistributedSelf(MessageParcel &data, MessageParcel &reply) -{ - bool enabled = false; - if (!data.ReadBool(enabled)) { - ANS_LOGE("[HandleEnableDistributedSelf] fail: read enabled failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = EnableDistributedSelf(enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleEnableDistributedSelf] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleIsDistributedEnableByBundle(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleIsDistributedEnableByBundle] fail: read bundle failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool enabled = false; - ErrCode result = IsDistributedEnableByBundle(bundleOption, enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleIsDistributedEnableByBundle] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteBool(enabled)) { - ANS_LOGE("[HandleIsDistributedEnableByBundle] fail: write enabled failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetDeviceRemindType(MessageParcel &data, MessageParcel &reply) -{ - auto rType{ NotificationConstant::RemindType::NONE }; - ErrCode result = GetDeviceRemindType(rType); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleGetDeviceRemindType] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteInt32(static_cast(rType))) { - ANS_LOGE("[HandleGetDeviceRemindType] fail: write remind type failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleShellDump(MessageParcel &data, MessageParcel &reply) -{ - std::string cmd; - if (!data.ReadString(cmd)) { - ANS_LOGE("[HandleShellDump] fail: read cmd failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - std::string bundle; - if (!data.ReadString(bundle)) { - ANS_LOGE("[HandleShellDump] fail: read bundle failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - int32_t userId; - if (!data.ReadInt32(userId)) { - ANS_LOGE("[HandleShellDump] fail: read userId failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - int32_t recvUserId; - if (!data.ReadInt32(recvUserId)) { - ANS_LOGE("[HandleShellDump] fail: read recvUserId failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - std::vector notificationsInfo; - ErrCode result = ShellDump(cmd, bundle, userId, recvUserId, notificationsInfo); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleGetRecentNotificationsInfo] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteStringVector(notificationsInfo)) { - ANS_LOGE("[HandleGetRecentNotificationsInfo] fail: write notificationsInfo failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleIsSupportTemplate(MessageParcel &data, MessageParcel &reply) -{ - std::string templateName; - if (!data.ReadString(templateName)) { - ANS_LOGE("[HandleIsSupportTemplate] fail: read template name failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - bool support = false; - ErrCode result = IsSupportTemplate(templateName, support); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleIsSupportTemplate] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - if (!reply.WriteBool(support)) { - ANS_LOGE("[HandleIsSupportTemplate] fail: write support failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleIsSpecialUserAllowedNotifyByUser(MessageParcel &data, MessageParcel &reply) -{ - int32_t userId = SUBSCRIBE_USER_INIT; - if (!data.ReadInt32(userId)) { - ANS_LOGE("[HandleIsSpecialUserAllowedNotifyByUser] fail: read userId failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool allowed = false; - ErrCode result = IsSpecialUserAllowedNotify(userId, allowed); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleIsSpecialUserAllowedNotifyByUser] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteBool(allowed)) { - ANS_LOGE("[HandleIsSpecialUserAllowedNotifyByUser] fail: write allowed failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleSetNotificationsEnabledByUser(MessageParcel &data, MessageParcel &reply) -{ - int32_t userId = SUBSCRIBE_USER_INIT; - if (!data.ReadInt32(userId)) { - ANS_LOGE("[HandleSetNotificationsEnabledByUser] fail: read userId failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool enabled = false; - if (!data.ReadBool(enabled)) { - ANS_LOGE("[HandleSetNotificationsEnabledByUser] fail: read enabled failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = SetNotificationsEnabledByUser(userId, enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleSetNotificationsEnabledByUser] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleDeleteAllByUser(MessageParcel &data, MessageParcel &reply) -{ - int32_t userId = SUBSCRIBE_USER_INIT; - if (!data.ReadInt32(userId)) { - ANS_LOGE("[HandleDeleteAllByUser] fail: read userId failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = DeleteAllByUser(userId); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleDeleteAllByUser] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleSetDoNotDisturbDateByUser(MessageParcel &data, MessageParcel &reply) -{ - int32_t userId = SUBSCRIBE_USER_INIT; - if (!data.ReadInt32(userId)) { - ANS_LOGE("[HandleSetDoNotDisturbDateByUser] fail: read userId failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - sptr date = data.ReadParcelable(); - if (date == nullptr) { - ANS_LOGE("[HandleSetDoNotDisturbDateByUser] fail: read date failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = SetDoNotDisturbDate(userId, date); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleSetDoNotDisturbDateByUser] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetDoNotDisturbDateByUser(MessageParcel &data, MessageParcel &reply) -{ - int32_t userId = SUBSCRIBE_USER_INIT; - if (!data.ReadInt32(userId)) { - ANS_LOGE("[HandleGetDoNotDisturbDateByUser] fail: read userId failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - sptr date = nullptr; - ErrCode result = GetDoNotDisturbDate(userId, date); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleGetDoNotDisturbDateByUser] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (result == ERR_OK) { - if (!reply.WriteParcelable(date)) { - ANS_LOGE("[HandleGetDoNotDisturbDateByUser] fail: write date failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleSetEnabledForBundleSlot(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadStrongParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleSetEnabledForBundleSlot] fail: read bundle failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - int32_t type = 0; - if (!data.ReadInt32(type)) { - ANS_LOGE("[HandleSetEnabledForBundleSlot] fail: read slot type failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - NotificationConstant::SlotType slotType = static_cast(type); - - bool enabled = false; - if (!data.ReadBool(enabled)) { - ANS_LOGE("[HandleSetEnabledForBundleSlot] fail: read enabled failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool isForceControl = false; - if (!data.ReadBool(isForceControl)) { - ANS_LOGE("[HandleSetEnabledForBundleSlot] fail: read isForceControl failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = SetEnabledForBundleSlot(bundleOption, slotType, enabled, isForceControl); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleSetEnabledForBundleSlot] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetEnabledForBundleSlot(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadStrongParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleGetEnabledForBundleSlot] fail: read bundle failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - int32_t type = 0; - if (!data.ReadInt32(type)) { - ANS_LOGE("[HandleGetEnabledForBundleSlot] fail: read slot type failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - NotificationConstant::SlotType slotType = static_cast(type); - - bool enabled = false; - ErrCode result = GetEnabledForBundleSlot(bundleOption, slotType, enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleGetEnabledForBundleSlot] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteBool(enabled)) { - ANS_LOGE("[HandleGetEnabledForBundleSlot] fail: write enabled failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetEnabledForBundleSlotSelf(MessageParcel &data, MessageParcel &reply) -{ - int32_t type = 0; - if (!data.ReadInt32(type)) { - ANS_LOGE("[HandleGetEnabledForBundleSlotSelf] fail: read slot type failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - NotificationConstant::SlotType slotType = static_cast(type); - - bool enabled = false; - ErrCode result = GetEnabledForBundleSlotSelf(slotType, enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleGetEnabledForBundleSlotSelf] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteBool(enabled)) { - ANS_LOGE("[HandleGetEnabledForBundleSlotSelf] fail: write enabled failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleDistributedSetEnabledWithoutApp(MessageParcel &data, MessageParcel &reply) -{ - int32_t userId = SUBSCRIBE_USER_INIT; - if (!data.ReadInt32(userId)) { - ANS_LOGE("[HandleDistributedSetEnabledWithoutApp] fail: read userId failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool enabled = false; - if (!data.ReadBool(enabled)) { - ANS_LOGE("[HandleDistributedSetEnabledWithoutApp] fail: read enabled failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = SetSyncNotificationEnabledWithoutApp(userId, enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleDistributedSetEnabledWithoutApp] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleDistributedGetEnabledWithoutApp(MessageParcel &data, MessageParcel &reply) -{ - int32_t userId = SUBSCRIBE_USER_INIT; - if (!data.ReadInt32(userId)) { - ANS_LOGE("[HandleDistributedGetEnabledWithoutApp] fail: read userId failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool enabled = false; - ErrCode result = GetSyncNotificationEnabledWithoutApp(userId, enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleDistributedGetEnabledWithoutApp] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteBool(enabled)) { - ANS_LOGE("[HandleDistributedGetEnabledWithoutApp] fail: write enabled failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleSetBadgeNumber(MessageParcel &data, MessageParcel &reply) -{ - ANSR_LOGI("HandleSetBadgeNumber"); - int32_t badgeNumber = -1; - if (!data.ReadInt32(badgeNumber)) { - ANSR_LOGE("Read badge number failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - std::string appInstanceKey; - if (!data.ReadString(appInstanceKey)) { - ANSR_LOGE("Read instance key failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = SetBadgeNumber(badgeNumber, appInstanceKey); - if (!reply.WriteInt32(result)) { - ANSR_LOGE("Write badge number failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - return result; -} - -ErrCode AnsManagerStub::HandleSetBadgeNumberByBundle(MessageParcel &data, MessageParcel &reply) -{ - ANS_LOGD("Called."); - sptr bundleOption = data.ReadParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("Read bundle option failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - int32_t badgeNumber = 0; - if (!data.ReadInt32(badgeNumber)) { - ANS_LOGE("Read badge number failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = SetBadgeNumberByBundle(bundleOption, badgeNumber); - if (!reply.WriteInt32(result)) { - ANS_LOGE("Write result failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - return result; -} - -ErrCode AnsManagerStub::HandleGetAllNotificationEnableStatus(MessageParcel &data, MessageParcel &reply) -{ - std::vector bundleOption; - ErrCode result = GetAllNotificationEnabledBundles(bundleOption); - int32_t vectorSize = bundleOption.size(); - if (vectorSize > MAX_STATUS_VECTOR_NUM) { - ANS_LOGE("Bundle bundleOption vector is over size."); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteInt32(result)) { - ANS_LOGE("Write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteInt32(vectorSize)) { - ANS_LOGE("Write bundleOption size failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - for (const auto &item : bundleOption) { - if (!reply.WriteParcelable(&item)) { - ANS_LOGE("Write bundleOption failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleRegisterPushCallback(MessageParcel &data, MessageParcel &reply) -{ - sptr pushCallBack = data.ReadRemoteObject(); - if (pushCallBack == nullptr) { - ANS_LOGE("fail: read JSPushCallBack failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - sptr notificationCheckRequest = data.ReadParcelable(); - if (notificationCheckRequest == nullptr) { - ANS_LOGE("fail: read notificationCheckRequest failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = RegisterPushCallback(pushCallBack, notificationCheckRequest); - if (!reply.WriteInt32(result)) { - ANS_LOGE("fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return result; -} - -ErrCode AnsManagerStub::HandleUnregisterPushCallback(MessageParcel &data, MessageParcel &reply) -{ - ErrCode result = UnregisterPushCallback(); - if (!reply.WriteInt32(result)) { - ANS_LOGE("fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return result; -} - -ErrCode AnsManagerStub::HandleAddDoNotDisturbProfiles(MessageParcel &data, MessageParcel &reply) -{ - std::vector> profiles; - if (!ReadParcelableVector(profiles, data)) { - ANS_LOGE("Read profiles failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (profiles.size() > MAX_STATUS_VECTOR_NUM) { - ANS_LOGE("The profiles is exceeds limit."); - return ERR_ANS_INVALID_PARAM; - } - - ErrCode result = AddDoNotDisturbProfiles(profiles); - if (!reply.WriteInt32(result)) { - ANS_LOGE("Write result failed, ErrCode is %{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleSetDistributedEnabledByBundle(MessageParcel &data, MessageParcel &reply) -{ - ANS_LOGD("enter"); - sptr bundleOption = data.ReadParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleSetNotificationsEnabledForSpecialBundle] fail: read bundleOption failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - std::string deviceType; - if (!data.ReadString(deviceType)) { - ANS_LOGE("[HandleSetNotificationsEnabledForSpecialBundle] fail: read deviceId failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool enabled = false; - if (!data.ReadBool(enabled)) { - ANS_LOGE("[HandleSetNotificationsEnabledForSpecialBundle] fail: read enabled failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = SetDistributedEnabledByBundle(bundleOption, deviceType, enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleSetNotificationsEnabledForSpecialBundle] fail: write result failed, ErrCode=%{public}d", - result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleRemoveDoNotDisturbProfiles(MessageParcel &data, MessageParcel &reply) -{ - std::vector> profiles; - if (!ReadParcelableVector(profiles, data)) { - ANS_LOGE("Read profiles failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (profiles.size() > MAX_STATUS_VECTOR_NUM) { - ANS_LOGE("The profiles is exceeds limit."); - return ERR_ANS_INVALID_PARAM; - } - - ErrCode result = RemoveDoNotDisturbProfiles(profiles); - if (!reply.WriteInt32(result)) { - ANS_LOGE("Write result failed, ErrCode is %{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleIsDistributedEnabledByBundle(MessageParcel &data, MessageParcel &reply) -{ - ANS_LOGD("enter"); - sptr bundleOption = data.ReadParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("[HandleIsDistributedEnabledByBundle] fail: read bundleOption failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - std::string deviceType; - if (!data.ReadString(deviceType)) { - ANS_LOGE("[HandleIsDistributedEnabledByBundle] fail: read deviceId failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool enabled = false; - ErrCode result = IsDistributedEnabledByBundle(bundleOption, deviceType, enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleIsDistributedEnabledByBundle] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteBool(enabled)) { - ANS_LOGE("[HandleIsDistributedEnabledByBundle] fail: write enabled failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleSetAdditionConfig(MessageParcel &data, MessageParcel &reply) -{ - std::string key; - if (!data.ReadString(key)) { - ANS_LOGE("Failed to read key."); - return ERR_ANS_PARCELABLE_FAILED; - } - - std::string value; - if (!data.ReadString(value)) { - ANS_LOGE("Failed to read value."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = SetAdditionConfig(key, value); - if (!reply.WriteInt32(result)) { - ANS_LOGE("Failed to write result, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return result; -} - -ErrCode AnsManagerStub::HandleSetSmartReminderEnabled(MessageParcel &data, MessageParcel &reply) -{ - ANS_LOGD("enter"); - std::string deviceType; - if (!data.ReadString(deviceType)) { - ANS_LOGE("[HandleSetSmartReminderEnabled] fail: read deviceId failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool enabled = false; - if (!data.ReadBool(enabled)) { - ANS_LOGE("[HandleSetSmartReminderEnabled] fail: read enabled failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = SetSmartReminderEnabled(deviceType, enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleSetSmartReminderEnabled] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleCancelAsBundleWithAgent(MessageParcel &data, MessageParcel &reply) -{ - sptr bundleOption = data.ReadParcelable(); - if (bundleOption == nullptr) { - ANS_LOGE("Read bundleOption failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - int32_t id = 0; - if (!data.ReadInt32(id)) { - ANS_LOGE("Read notification id failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = CancelAsBundleWithAgent(bundleOption, id); - if (!reply.WriteInt32(result)) { - ANS_LOGE("Write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return result; -} - -ErrCode AnsManagerStub::HandleIsSmartReminderEnabled(MessageParcel &data, MessageParcel &reply) -{ - ANS_LOGD("enter"); - std::string deviceType; - if (!data.ReadString(deviceType)) { - ANS_LOGE("[HandleIsSmartReminderEnabled] fail: read deviceId failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool enabled = false; - ErrCode result = IsSmartReminderEnabled(deviceType, enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleIsSmartReminderEnabled] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteBool(enabled)) { - ANS_LOGE("[HandleIsSmartReminderEnabled] fail: write enabled failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleSetDistributedEnabledBySlot(MessageParcel &data, MessageParcel &reply) -{ - ANS_LOGD("enter"); - NotificationConstant::SlotType slotType = static_cast(data.ReadInt32()); - - std::string deviceType; - if (!data.ReadString(deviceType)) { - ANS_LOGE("[HandleSetDistributedEnabledBySlot] fail: read deviceId failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool enabled = false; - if (!data.ReadBool(enabled)) { - ANS_LOGE("[HandleSetDistributedEnabledBySlot] fail: read enabled failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = SetDistributedEnabledBySlot(slotType, deviceType, enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleSetDistributedEnabledBySlot] fail: write result failed, ErrCode=%{public}d", - result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetAllLiveViewEnabledBundles(MessageParcel &data, MessageParcel &reply) -{ - std::vector bundleOption; - ErrCode result = GetAllLiveViewEnabledBundles(bundleOption); - int32_t vectorSize = bundleOption.size(); - if (vectorSize > MAX_STATUS_VECTOR_NUM) { - ANS_LOGE("Bundle bundleOption vector is over size."); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteInt32(result)) { - ANS_LOGE("Write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteInt32(vectorSize)) { - ANS_LOGE("Write bundleOption size failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - for (const auto &item : bundleOption) { - if (!reply.WriteParcelable(&item)) { - ANS_LOGE("Write bundleOption failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetAllDistribuedEnabledBundles(MessageParcel &data, MessageParcel &reply) -{ - std::string deviceType; - if (!data.ReadString(deviceType)) { - ANS_LOGE("[HandleGetAllDistribuedEnabledBundles] fail: read deviceType failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - std::vector bundleOption; - ErrCode result = GetAllDistribuedEnabledBundles(deviceType, bundleOption); - int32_t vectorSize = bundleOption.size(); - if (vectorSize > MAX_STATUS_VECTOR_NUM) { - ANS_LOGE("Bundle bundleOption vector is over size."); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteInt32(result)) { - ANS_LOGE("Write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteInt32(vectorSize)) { - ANS_LOGE("Write bundleOption size failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - for (const auto &item : bundleOption) { - if (!reply.WriteParcelable(&item)) { - ANS_LOGE("Write bundleOption failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - } - - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleIsDistributedEnabledBySlot(MessageParcel &data, MessageParcel &reply) -{ - ANS_LOGD("enter"); - NotificationConstant::SlotType slotType = static_cast(data.ReadInt32()); - - std::string deviceType; - if (!data.ReadString(deviceType)) { - ANS_LOGE("[HandleIsDistributedEnabledBySlot] fail: read deviceId failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool enabled = false; - ErrCode result = IsDistributedEnabledBySlot(slotType, deviceType, enabled); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleIsDistributedEnabledBySlot] fail: write result failed, ErrCode=%{public}d", - result); - return ERR_ANS_PARCELABLE_FAILED; - } - if (!reply.WriteBool(enabled)) { - ANS_LOGE("[HandleIsDistributedEnabledBySlot] fail: write enabled failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleSetTargetDeviceStatus(MessageParcel &data, MessageParcel &reply) -{ - std::string deviceType; - if (!data.ReadString(deviceType)) { - ANS_LOGE("[HandleSetTargetDeviceStatus] fail: read deviceType failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - int32_t status = 0; - if (!data.ReadInt32(status)) { - ANS_LOGE("[HandleSetTargetDeviceStatus] fail: read status failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = SetTargetDeviceStatus(deviceType, status); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleSetTargetDeviceStatus] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetDoNotDisturbProfile(MessageParcel &data, MessageParcel &reply) -{ - int32_t profileId = data.ReadInt32(); - sptr profile = nullptr; - ErrCode result = GetDoNotDisturbProfile(profileId, profile); - if (!reply.WriteInt32(result)) { - ANS_LOGE("HandleGetDoNotDisturbProfile write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (result == ERR_OK) { - if (!reply.WriteParcelable(profile)) { - ANS_LOGE("HandleGetDoNotDisturbProfile write slot failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - } - return ERR_OK; -} - -#ifdef NOTIFICATION_SMART_REMINDER_SUPPORTED -ErrCode AnsManagerStub::HandleRegisterSwingCallback(MessageParcel &data, MessageParcel &reply) -{ - sptr swingCallBack = data.ReadRemoteObject(); - if (swingCallBack == nullptr) { - ANS_LOGE("fail: read SwingCallBack failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = RegisterSwingCallback(swingCallBack); - if (!reply.WriteInt32(result)) { - ANS_LOGE("fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return result; -} -#endif - -ErrCode AnsManagerStub::HandleUpdateNotificationTimerByUid(MessageParcel &data, MessageParcel &reply) -{ - int32_t uid = data.ReadInt32(); - bool isPaused = data.ReadBool(); - ErrCode result = UpdateNotificationTimerByUid(uid, isPaused); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleUpdateNotificationTimerByUid] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleAllowUseReminder(MessageParcel &data, MessageParcel &reply) -{ - ANS_LOGD("enter"); - std::string bundleName; - if (!data.ReadString(bundleName)) { - ANS_LOGE("fail: read deviceId failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - bool isAllowUseReminder = false; - ErrCode result = AllowUseReminder(bundleName, isAllowUseReminder); - if (!reply.WriteInt32(result)) { - ANS_LOGE("fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteBool(isAllowUseReminder)) { - ANS_LOGE("fail: write enabled failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleDisableNotificationFeature(MessageParcel &data, MessageParcel &reply) -{ - sptr notificationDisable = data.ReadParcelable(); - ErrCode result = DisableNotificationFeature(notificationDisable); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleDisableNotificationFeature] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleSetDeviceStatus(MessageParcel &data, MessageParcel &reply) -{ - std::string deviceType; - if (!data.ReadString(deviceType)) { - ANS_LOGE("[HandleSetTargetDeviceStatus] fail: read deviceType failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - int32_t status = 0; - if (!data.ReadInt32(status)) { - ANS_LOGE("[HandleSetTargetDeviceStatus] fail: read status failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - int32_t controlFlag = 0; - if (!data.ReadInt32(controlFlag)) { - ANS_LOGE("[HandleSetTargetDeviceStatus] fail: read status failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = SetTargetDeviceStatus(deviceType, status, controlFlag); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleSetTargetDeviceStatus] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - -ErrCode AnsManagerStub::HandleGetDeviceStatus(MessageParcel &data, MessageParcel &reply) -{ - std::string deviceType; - if (!data.ReadString(deviceType)) { - ANS_LOGE("[HandleGetDeviceStatus] fail: read deviceType failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - int32_t status = 0; - ErrCode result = GetTargetDeviceStatus(deviceType, status); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleGetDeviceStatus] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - if (!reply.WriteInt32(status)) { - ANS_LOGE("[HandleGetDeviceStatus] fail: write slot failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} -} // namespace Notification -} // namespace OHOS diff --git a/frameworks/core/src/manager/ans_manager_stub_invalid.cpp b/frameworks/core/src/manager/ans_manager_stub_invalid.cpp deleted file mode 100644 index 3e62a98d10e6b8c80cd8f692f463294f03166914..0000000000000000000000000000000000000000 --- a/frameworks/core/src/manager/ans_manager_stub_invalid.cpp +++ /dev/null @@ -1,679 +0,0 @@ -/* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "ans_manager_stub.h" -#include "ans_const_define.h" -#include "ans_inner_errors.h" -#include "ans_log_wrapper.h" -#include "message_option.h" -#include "message_parcel.h" -#include "parcel.h" -#include "reminder_request_alarm.h" -#include "reminder_request_calendar.h" -#include "reminder_request_timer.h" - -namespace OHOS { -namespace Notification { -ErrCode AnsManagerStub::Publish(const std::string &label, const sptr ¬ification) -{ - ANS_LOGE("AnsManagerStub::Publish called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::PublishNotificationForIndirectProxy(const sptr ¬ification) -{ - ANS_LOGE("AnsManagerStub::PublishNotificationForIndirectProxy called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::Cancel(int notificationId, const std::string &label, const std::string &instanceKey) -{ - ANS_LOGE("AnsManagerStub::Cancel called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::CancelAll(const std::string &instanceKey) -{ - ANS_LOGE("AnsManagerStub::CancelAll called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::CancelAsBundle(int32_t notificationId, const std::string &representativeBundle, int32_t userId) -{ - ANS_LOGE("AnsManagerStub::CancelAsBundle called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::CancelAsBundle(const sptr &bundleOption, int32_t notificationId) -{ - ANS_LOGE("AnsManagerStub::CancelAsBundle called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::CancelAsBundle( - const sptr &bundleOption, int32_t notificationId, int32_t userId) -{ - ANS_LOGE("AnsManagerStub::CancelAsBundle called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::AddSlotByType(NotificationConstant::SlotType slotType) -{ - ANS_LOGE("AnsManagerStub::AddSlotByType called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::AddSlots(const std::vector> &slots) -{ - ANS_LOGE("AnsManagerStub::AddSlots called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::RemoveSlotByType(const NotificationConstant::SlotType &slotType) -{ - ANS_LOGE("AnsManagerStub::RemoveSlotByType called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::RemoveAllSlots() -{ - ANS_LOGE("AnsManagerStub::RemoveAllSlots called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetSlotByType(const NotificationConstant::SlotType &slotType, sptr &slot) -{ - ANS_LOGE("AnsManagerStub::GetSlotByType called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetSlots(std::vector> &slots) -{ - ANS_LOGE("AnsManagerStub::GetSlots called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetSlotNumAsBundle(const sptr &bundleOption, uint64_t &num) -{ - ANS_LOGE("AnsManagerStub::GetSlotNumAsBundle called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetActiveNotifications( - std::vector> ¬ifications, const std::string &instanceKey) -{ - ANS_LOGE("AnsManagerStub::GetActiveNotifications called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetActiveNotificationNums(uint64_t &num) -{ - ANS_LOGE("AnsManagerStub::GetActiveNotificationNums called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetAllActiveNotifications(std::vector> ¬ifications) -{ - ANS_LOGE("AnsManagerStub::GetAllActiveNotifications called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetSpecialActiveNotifications( - const std::vector &key, std::vector> ¬ifications) -{ - ANS_LOGE("AnsManagerStub::GetSpecialActiveNotifications called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetActiveNotificationByFilter( - const sptr &bundleOption, const int32_t notificationId, const std::string &label, - std::vector extraInfoKeys, sptr &request) -{ - ANS_LOGE("AnsManagerStub::GetActiveNotificationByFilter called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::CanPublishAsBundle(const std::string &representativeBundle, bool &canPublish) -{ - ANS_LOGE("AnsManagerStub::CanPublishAsBundle called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::PublishAsBundle( - const sptr notification, const std::string &representativeBundle) -{ - ANS_LOGE("AnsManagerStub::PublishAsBundle called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::SetNotificationBadgeNum(int num) -{ - ANS_LOGE("AnsManagerStub::SetNotificationBadgeNum called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetBundleImportance(int &importance) -{ - ANS_LOGE("AnsManagerStub::GetBundleImportance called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetSlotFlagsAsBundle(const sptr &bundleOption, uint32_t &slotFlags) -{ - ANS_LOGE("AnsManagerStub::GetSlotFlagsAsBundle called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::SetSlotFlagsAsBundle(const sptr &bundleOption, uint32_t slotFlags) -{ - ANS_LOGE("AnsManagerStub::SetSlotFlagsAsBundle called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::HasNotificationPolicyAccessPermission(bool &granted) -{ - ANS_LOGE("AnsManagerStub::HasNotificationPolicyAccessPermission called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::TriggerLocalLiveView(const sptr &bundleOption, - const int32_t notificationId, const sptr &buttonOption) -{ - ANS_LOGE("AnsManagerStub::TriggerLocalLiveView called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::RemoveNotification(const sptr &bundleOption, - int notificationId, const std::string &label, int32_t removeReason) -{ - ANS_LOGE("AnsManagerStub::RemoveNotification called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::RemoveAllNotifications(const sptr &bundleOption) -{ - ANS_LOGE("AnsManagerStub::RemoveAllNotifications called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::RemoveNotifications(const std::vector &keys, int32_t removeReason) -{ - ANS_LOGD("called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::Delete(const std::string &key, int32_t removeReason) -{ - ANS_LOGE("AnsManagerStub::Delete called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::DeleteByBundle(const sptr &bundleOption) -{ - ANS_LOGE("AnsManagerStub::DeleteByBundle called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::DeleteAll() -{ - ANS_LOGE("AnsManagerStub::DeleteAll called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetSlotsByBundle( - const sptr &bundleOption, std::vector> &slots) -{ - ANS_LOGE("AnsManagerStub::GetSlotsByBundle called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetSlotByBundle( - const sptr &bundleOption, const NotificationConstant::SlotType &slotType, - sptr &slot) -{ - ANS_LOGE("AnsManagerStub::GetSlotByBundle called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::UpdateSlots( - const sptr &bundleOption, const std::vector> &slots) -{ - ANS_LOGE("AnsManagerStub::UpdateSlots called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::RequestEnableNotification(const std::string &deviceId, - const sptr &callback, - const sptr &callerToken) -{ - ANS_LOGE("AnsManagerStub::RequestEnableNotification called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::SetNotificationsEnabledForBundle(const std::string &bundle, bool enabled) -{ - ANS_LOGE("AnsManagerStub::SetNotificationsEnabledForBundle called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::SetNotificationsEnabledForAllBundles(const std::string &deviceId, bool enabled) -{ - ANS_LOGE("AnsManagerStub::SetNotificationsEnabledForAllBundles called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::SetNotificationsEnabledForSpecialBundle( - const std::string &deviceId, const sptr &bundleOption, bool enabled) -{ - ANS_LOGE("AnsManagerStub::SetNotificationsEnabledForSpecialBundle called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::SetShowBadgeEnabledForBundle(const sptr &bundleOption, bool enabled) -{ - ANS_LOGE("AnsManagerStub::SetShowBadgeEnabledForBundle called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetShowBadgeEnabledForBundle(const sptr &bundleOption, bool &enabled) -{ - ANS_LOGE("AnsManagerStub::GetShowBadgeEnabledForBundle called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetShowBadgeEnabled(bool &enabled) -{ - ANS_LOGE("AnsManagerStub::GetShowBadgeEnabled called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::Subscribe(const sptr &subscriber, - const sptr &info) -{ - ANS_LOGE("AnsManagerStub::Subscribe called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::SubscribeSelf(const sptr &subscriber) -{ - ANS_LOGE("AnsManagerStub::SubscribeSelf called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::SubscribeLocalLiveView(const sptr &subscriber, - const sptr &info, const bool isNative) -{ - ANS_LOGE("AnsManagerStub::SubscribeLocalLiveView called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::Unsubscribe(const sptr &subscriber, - const sptr &info) -{ - ANS_LOGE("AnsManagerStub::Unsubscribe called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::IsAllowedNotify(bool &allowed) -{ - ANS_LOGE("AnsManagerStub::IsAllowedNotify called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::IsAllowedNotifySelf(bool &allowed) -{ - ANS_LOGE("AnsManagerStub::IsAllowedNotifySelf called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::CanPopEnableNotificationDialog(const sptr &callback, - bool &canPop, std::string &bundleName) -{ - ANS_LOGE("AnsManagerStub::CanPopEnableNotificationDialog called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::RemoveEnableNotificationDialog() -{ - ANS_LOGE("AnsManagerStub::RemoveEnableNotificationDialog called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::IsSpecialBundleAllowedNotify(const sptr &bundleOption, bool &allowed) -{ - ANS_LOGE("AnsManagerStub::IsSpecialBundleAllowedNotify called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::CancelGroup(const std::string &groupName, const std::string &instanceKey) -{ - ANS_LOGE("AnsManagerStub::CancelGroup called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::RemoveGroupByBundle( - const sptr &bundleOption, const std::string &groupName) -{ - ANS_LOGE("AnsManagerStub::RemoveGroupByBundle called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::SetDoNotDisturbDate(const sptr &date) -{ - ANS_LOGE("AnsManagerStub::SetDoNotDisturbDate called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetDoNotDisturbDate(sptr &date) -{ - ANS_LOGE("AnsManagerStub::GetDoNotDisturbDate called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::AddDoNotDisturbProfiles(const std::vector> &profiles) -{ - ANS_LOGD("Called."); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::RemoveDoNotDisturbProfiles(const std::vector> &profiles) -{ - ANS_LOGD("Called."); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::DoesSupportDoNotDisturbMode(bool &doesSupport) -{ - ANS_LOGE("AnsManagerStub::DoesSupportDoNotDisturbMode called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::IsNeedSilentInDoNotDisturbMode(const std::string &phoneNumber, int32_t callerType) -{ - ANS_LOGE("AnsManagerStub::IsNeedSilentInDoNotDisturbMode called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::IsDistributedEnabled(bool &enabled) -{ - ANS_LOGE("AnsManagerStub::IsDistributedEnabled called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::EnableDistributed(bool enabled) -{ - ANS_LOGE("AnsManagerStub::EnableDistributed called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::EnableDistributedByBundle(const sptr &bundleOption, bool enabled) -{ - ANS_LOGE("AnsManagerStub::EnableDistributedByBundle called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::EnableDistributedSelf(bool enabled) -{ - ANS_LOGE("AnsManagerStub::EnableDistributedSelf called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::IsDistributedEnableByBundle(const sptr &bundleOption, bool &enabled) -{ - ANS_LOGE("AnsManagerStub::IsDistributedEnableByBundle called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetDeviceRemindType(NotificationConstant::RemindType &remindType) -{ - ANS_LOGE("AnsManagerStub::GetDeviceRemindType called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::PublishContinuousTaskNotification(const sptr &request) -{ - ANS_LOGE("AnsManagerStub::PublishContinuousTaskNotification called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::CancelContinuousTaskNotification(const std::string &label, int32_t notificationId) -{ - ANS_LOGE("AnsManagerStub::CancelContinuousTaskNotification called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::IsSupportTemplate(const std::string &templateName, bool &support) -{ - ANS_LOGE("AnsManagerStub::IsSupportTemplate called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::IsSpecialUserAllowedNotify(const int32_t &userId, bool &allowed) -{ - ANS_LOGE("AnsManagerStub::IsSpecialUserAllowedNotify called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::SetNotificationsEnabledByUser(const int32_t &deviceId, bool enabled) -{ - ANS_LOGE("AnsManagerStub::SetNotificationsEnabledByUser called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::DeleteAllByUser(const int32_t &userId) -{ - ANS_LOGE("AnsManagerStub::DeleteAllByUser called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::SetDoNotDisturbDate(const int32_t &userId, const sptr &date) -{ - ANS_LOGE("AnsManagerStub::SetDoNotDisturbDate called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetDoNotDisturbDate(const int32_t &userId, sptr &date) -{ - ANS_LOGE("AnsManagerStub::GetDoNotDisturbDate called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::SetEnabledForBundleSlot(const sptr &bundleOption, - const NotificationConstant::SlotType &slotType, bool enabled, bool isForceControl) -{ - ANS_LOGE("AnsManagerStub::SetEnabledForBundleSlot called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetEnabledForBundleSlot( - const sptr &bundleOption, const NotificationConstant::SlotType &slotType, bool &enabled) -{ - ANS_LOGE("AnsManagerStub::GetEnabledForBundleSlot called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetEnabledForBundleSlotSelf(const NotificationConstant::SlotType &slotType, bool &enabled) -{ - ANS_LOGE("AnsManagerStub::GetEnabledForBundleSlotSelf called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::ShellDump(const std::string &cmd, const std::string &bundle, int32_t userId, - int32_t recvUserId, std::vector &dumpInfo) -{ - ANS_LOGE("AnsManagerStub::ShellDump called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::SetSyncNotificationEnabledWithoutApp(const int32_t userId, const bool enabled) -{ - ANS_LOGE("AnsManagerStub::SetSyncNotificationEnabledWithoutApp called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetSyncNotificationEnabledWithoutApp(const int32_t userId, bool &enabled) -{ - ANS_LOGE("AnsManagerStub::GetSyncNotificationEnabledWithoutApp called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::SetBadgeNumber(int32_t badgeNumber, const std::string &instanceKey) -{ - ANS_LOGE("AnsManagerStub::SetBadgeNumber called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::SetBadgeNumberByBundle(const sptr &bundleOption, int32_t badgeNumber) -{ - ANS_LOGD("Called."); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetAllNotificationEnabledBundles(std::vector &bundleOption) -{ - ANS_LOGE("AnsManagerStub::GetAllNotificationEnabledBundles called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::RegisterPushCallback( - const sptr& pushCallback, const sptr ¬ificationCheckRequest) -{ - ANS_LOGE("RegisterPushCallback called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::UnregisterPushCallback() -{ - ANS_LOGE("UnregisterPushCallback called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::SetDistributedEnabledByBundle(const sptr &bundleOption, - const std::string &deviceType, const bool enabled) -{ - ANS_LOGE("SetDistributedEnabledByBundle called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::IsDistributedEnabledByBundle(const sptr &bundleOption, - const std::string &deviceType, bool &enabled) -{ - ANS_LOGE("IsDistributedEnabledByBundle called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::SetSmartReminderEnabled(const std::string &deviceType, const bool enabled) -{ - ANS_LOGE("SetSmartReminderEnabled called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::IsSmartReminderEnabled(const std::string &deviceType, bool &enabled) -{ - ANS_LOGE("IsSmartReminderEnabled called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::SetDistributedEnabledBySlot( - const NotificationConstant::SlotType &slotType, const std::string &deviceType, const bool enabled) -{ - ANS_LOGE("SetDistributedEnabledBySlot called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::IsDistributedEnabledBySlot( - const NotificationConstant::SlotType &slotType, const std::string &deviceType, bool &enabled) -{ - ANS_LOGE("IsDistributedEnabledBySlot called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::SetAdditionConfig(const std::string &key, const std::string &value) -{ - ANS_LOGE("Called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetTargetDeviceStatus(const std::string &deviceType, int32_t &status) -{ - ANS_LOGE("GetTargetDeviceStatus called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::CancelAsBundleWithAgent(const sptr &bundleOption, const int32_t id) -{ - ANS_LOGE("Called."); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetAllLiveViewEnabledBundles(std::vector &bundleOption) -{ - ANS_LOGE("AnsManagerStub::GetAllLiveViewEnabledBundles called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetAllDistribuedEnabledBundles(const std::string& deviceType, - std::vector &bundleOption) -{ - ANS_LOGE("AnsManagerStub::GetAllDistribuedEnabledBundles called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::SetTargetDeviceStatus(const std::string &deviceType, const uint32_t status) -{ - ANS_LOGE("SetTargetDeviceStatus called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::SetTargetDeviceStatus(const std::string &deviceType, const uint32_t status, - const uint32_t controlFlag) -{ - ANS_LOGE("SetTargetDeviceStatus called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::GetDoNotDisturbProfile(int32_t id, sptr &profile) -{ - ANS_LOGE("GetDoNotDisturbProfile called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::AllowUseReminder(const std::string& bundleName, bool& isAllowUseReminder) -{ - ANS_LOGE("AllowUseReminder called!"); - return ERR_INVALID_OPERATION; -} - -#ifdef NOTIFICATION_SMART_REMINDER_SUPPORTED -ErrCode AnsManagerStub::RegisterSwingCallback(const sptr& swingCallback) -{ - ANS_LOGE("RegisterSwingCallback called!"); - return ERR_INVALID_OPERATION; -} -#endif - -ErrCode AnsManagerStub::UpdateNotificationTimerByUid(const int32_t uid, const bool isPaused) -{ - ANS_LOGE("UpdateNotificationTimerByUid called!"); - return ERR_INVALID_OPERATION; -} - -ErrCode AnsManagerStub::DisableNotificationFeature(const sptr ¬ificationDisable) -{ - ANS_LOGE("DisableNotificationFeature called!"); - return ERR_INVALID_OPERATION; -} -} // namespace Notification -} // namespace OHOS