• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_CORE_NOTIFICATION_SUBSCRIBER_LISTENER_H
17 #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_CORE_NOTIFICATION_SUBSCRIBER_LISTENER_H
18 
19 #include "ans_subscriber_stub.h"
20 #include "ians_manager.h"
21 #include "notification_request.h"
22 #include "notification_sorting.h"
23 #include "notification_sorting_map.h"
24 #include "notification_subscriber.h"
25 
26 namespace OHOS {
27 namespace Notification {
28 class SubscriberListener final : public AnsSubscriberStub {
29 public:
30     SubscriberListener(const std::shared_ptr<NotificationSubscriber> &subscriber);
31     ~SubscriberListener();
32 
33     ErrCode OnConnected() override;
34 
35     ErrCode OnDisconnected() override;
36 
37     ErrCode OnConsumed(
38         const sptr<Notification> &notification, const sptr<NotificationSortingMap> &notificationMap) override;
39 
40     ErrCode OnConsumed(const sptr<Notification> &notification) override;
41 
42     ErrCode OnConsumedWithMaxCapacity(
43         const sptr<Notification> &notification, const sptr<NotificationSortingMap> &notificationMap) override;
44 
45     ErrCode OnConsumedWithMaxCapacity(const sptr<Notification> &notification) override;
46 
47     ErrCode OnConsumedList(const std::vector<sptr<Notification>> &notifications,
48         const sptr<NotificationSortingMap> &notificationMap) override;
49 
50     ErrCode OnConsumedList(const std::vector<sptr<Notification>> &notifications) override;
51 
52     ErrCode OnCanceled(const sptr<Notification> &notification, const sptr<NotificationSortingMap> &notificationMap,
53         int32_t deleteReason) override;
54 
55     ErrCode OnCanceled(const sptr<Notification> &notification, int32_t deleteReason) override;
56 
57     ErrCode OnCanceledWithMaxCapacity(const sptr<Notification> &notification,
58         const sptr<NotificationSortingMap> &notificationMap, int32_t deleteReason) override;
59 
60     ErrCode OnCanceledWithMaxCapacity(const sptr<Notification> &notification, int32_t deleteReason) override;
61 
62     ErrCode OnCanceledList(const std::vector<sptr<Notification>> &notifications,
63         const sptr<NotificationSortingMap> &notificationMap, int32_t deleteReason) override;
64 
65     ErrCode OnCanceledList(const std::vector<sptr<Notification>> &notifications, int32_t deleteReason) override;
66 
67     void OnBatchCanceled(const std::vector<sptr<Notification>> &notifications,
68         const sptr<NotificationSortingMap> &notificationMap, int32_t deleteReason);
69 
70     ErrCode OnUpdated(const sptr<NotificationSortingMap> &notificationMap) override;
71 
72     ErrCode OnDoNotDisturbDateChange(const sptr<NotificationDoNotDisturbDate> &date) override;
73 
74     ErrCode OnEnabledNotificationChanged(const sptr<EnabledNotificationCallbackData> &callbackData) override;
75 
76     ErrCode OnBadgeChanged(const sptr<BadgeNumberCallbackData> &badgeData) override;
77 
78     ErrCode OnBadgeEnabledChanged(const sptr<EnabledNotificationCallbackData> &callbackData) override;
79 
80     ErrCode OnApplicationInfoNeedChanged(const std::string& bundleName) override;
81 
82     ErrCode OnOperationResponse(const sptr<NotificationOperationInfo>& operationInfo, int32_t& funcResult) override;
83 
84 public:
85     std::weak_ptr<NotificationSubscriber> subscriber_;
86 };
87 }  // namespace Notification
88 }  // namespace OHOS
89 
90 #endif  // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_CORE_NOTIFICATION_SUBSCRIBER_LISTENER_H
91