1 /* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_NOTIFICATION_CONSTANT_H 17 #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_NOTIFICATION_CONSTANT_H 18 19 #include <string> 20 21 namespace OHOS { 22 namespace Notification { 23 class NotificationConstant { 24 public: 25 enum InputEditType { 26 EDIT_AUTO, // Indicates that the system determines whether to allow the user to edit the options before 27 // they are sent to the application. 28 EDIT_DISABLED, // Indicates that the user is not allowed to edit an option before the option is sent to the 29 // application. 30 EDIT_ENABLED, // Indicates that the user is allowed to edit an option before the option is sent to the 31 // application. 32 }; 33 34 enum InputsSource { 35 FREE_FORM_INPUT, // Indicates that the user manually input the content. 36 OPTION, // Indicates that the user selected one of the provided options. 37 }; 38 39 enum SemanticActionButton { 40 NONE_ACTION_BUTTON, // Indicates that no WantAgent is associated. 41 REPLY_ACTION_BUTTON, // Indicates the action of replying to a conversation. 42 READ_ACTION_BUTTON, // Indicates the action of marking the content as read. 43 UNREAD_ACTION_BUTTON, // Indicates the action of marking the content as unread. 44 DELETE_ACTION_BUTTON, // Indicates the action of deleting the content associated with the notification. 45 ARCHIVE_ACTION_BUTTON, // Indicates the action of archiving the content associated with the notification. 46 MUTE_ACTION_BUTTON, // Indicates the action of muting the content associated with the notification. 47 UNMUTE_ACTION_BUTTON, // Indicates the action of unmuting the content associated with the notification. 48 THUMBS_UP_ACTION_BUTTON, // Indicates the action of marking the content with a thumbs-up. 49 THUMBS_DOWN_ACTION_BUTTON, // Indicates the action of marking the content with a thumbs-down. 50 CALL_ACTION_BUTTON, // Indicates the action of making a call. 51 }; 52 53 enum SubscribeResult : uint32_t { 54 SUCCESS, 55 PREMISSION_FAIL, 56 RESOURCES_FAIL, 57 }; 58 59 enum SlotType { 60 SOCIAL_COMMUNICATION, // the notification type is social communication 61 SERVICE_REMINDER, // the notification type is service reminder 62 CONTENT_INFORMATION, // the notificatin type is content information 63 OTHER, // the notificatin type is other 64 CUSTOM, // the notification type is custom 65 }; 66 67 enum class VisiblenessType { 68 /** 69 * the notification display effect has not been set by NotificationRequest::setVisibleness(). 70 * This method is usually not used. 71 */ 72 NO_OVERRIDE, 73 /** 74 * only the basic information, such as application icon and application name is displayed on the lock screen. 75 */ 76 PRIVATE, 77 /** 78 * contents of a notification are displayed on the lock screen. 79 */ 80 PUBLIC, 81 /** 82 * notifications are not displayed on the lock screen. 83 */ 84 SECRET 85 }; 86 87 enum class DoNotDisturbType { 88 NONE = 0, 89 ONCE = 1, // only once 90 DAILY = 2, // every day 91 CLEARLY = 3, // time period 92 }; 93 94 enum class RemindType { 95 NONE = -1, 96 DEVICE_IDLE_DONOT_REMIND = 0, // The device is not in use, no reminder 97 DEVICE_IDLE_REMIND = 1, // The device is not in use, remind 98 DEVICE_ACTIVE_DONOT_REMIND = 2, // The device is in use, no reminder 99 DEVICE_ACTIVE_REMIND = 3, // The device is in use, reminder 100 }; 101 102 enum class DistributedReminderPolicy { 103 DEFAULT, 104 ALWAYS_REMIND, 105 DO_NOT_REMIND, 106 }; 107 108 enum class SourceType { 109 /** 110 * general notification. 111 */ 112 TYPE_NORMAL = 0x00000000, 113 /** 114 * long-term task notification. 115 */ 116 TYPE_CONTINUOUS = 0x00000001, 117 /** 118 * timed notification. 119 */ 120 TYPE_TIMER = 0x00000002 121 }; 122 123 enum class FlagStatus { 124 NONE, 125 OPEN, 126 CLOSE 127 }; 128 129 /** 130 * Indicates that a notification is deleted because it is clicked. 131 */ 132 static const int32_t CLICK_REASON_DELETE = 1; 133 134 /** 135 * Indicates that a notification is deleted because the user clears it. 136 */ 137 static const int32_t CANCEL_REASON_DELETE = 2; 138 139 /** 140 * Indicates that a notification is deleted because the user clears all notifications. 141 */ 142 static const int32_t CANCEL_ALL_REASON_DELETE = 3; 143 144 /** 145 * Indicates that a notification is deleted because of a UI error. 146 */ 147 static const int32_t ERROR_REASON_DELETE = 4; 148 149 /** 150 * Indicates that a notification is deleted because a change has been made to the application. 151 */ 152 static const int32_t PACKAGE_CHANGED_REASON_DELETE = 5; 153 154 /** 155 * Indicates that a notification is deleted because the application context is stopped. 156 */ 157 static const int32_t USER_STOPPED_REASON_DELETE = 6; 158 159 /** 160 * Indicates that a notification is deleted because the application is banned from sending notifications. 161 */ 162 static const int32_t PACKAGE_BANNED_REASON_DELETE = 7; 163 164 /** 165 * Indicates that a notification is deleted because the application cancels it. 166 */ 167 static const int32_t APP_CANCEL_REASON_DELETE = 8; 168 169 /** 170 * Indicates that a notification is deleted because the application cancels all notifications. 171 */ 172 static const int32_t APP_CANCEL_ALL_REASON_DELETE = 9; 173 174 /** 175 * Indicates that a notification is deleted for other reasons. 176 */ 177 static const int32_t APP_CANCEL_REASON_OTHER = 10; 178 179 /** 180 * The key indicates input source. 181 */ 182 static const std::string EXTRA_INPUTS_SOURCE; 183 184 // rdb 185 constexpr static const char* NOTIFICATION_RDB_NAME = "/notificationdb.db"; 186 constexpr static const char* NOTIFICATION_RDB_TABLE_NAME = "notification_table"; 187 constexpr static const char* NOTIFICATION_RDB_PATH = "/data/service/el1/public/database/notification_service"; 188 constexpr static const char* NOTIFICATION_JOURNAL_MODE = "WAL"; 189 constexpr static const char* NOTIFICATION_SYNC_MODE = "FULL"; 190 constexpr static int32_t NOTIFICATION_RDB_VERSION = 1; 191 }; 192 } // namespace Notification 193 } // namespace OHOS 194 195 #endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_NOTIFICATION_CONSTANT_H