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 LIVE_VIEW, // the notification type is live view 66 CUSTOMER_SERVICE, // the notification type is customer service 67 }; 68 69 enum class VisiblenessType { 70 /** 71 * the notification display effect has not been set by NotificationRequest::setVisibleness(). 72 * This method is usually not used. 73 */ 74 NO_OVERRIDE, 75 /** 76 * only the basic information, such as application icon and application name is displayed on the lock screen. 77 */ 78 PRIVATE, 79 /** 80 * contents of a notification are displayed on the lock screen. 81 */ 82 PUBLIC, 83 /** 84 * notifications are not displayed on the lock screen. 85 */ 86 SECRET 87 }; 88 89 enum class DoNotDisturbType { 90 NONE = 0, 91 ONCE = 1, // only once 92 DAILY = 2, // every day 93 CLEARLY = 3, // time period 94 }; 95 96 enum class RemindType { 97 NONE = -1, 98 DEVICE_IDLE_DONOT_REMIND = 0, // The device is not in use, no reminder 99 DEVICE_IDLE_REMIND = 1, // The device is not in use, remind 100 DEVICE_ACTIVE_DONOT_REMIND = 2, // The device is in use, no reminder 101 DEVICE_ACTIVE_REMIND = 3, // The device is in use, reminder 102 }; 103 104 enum class DistributedReminderPolicy { 105 DEFAULT, 106 ALWAYS_REMIND, 107 DO_NOT_REMIND, 108 }; 109 110 enum class SourceType { 111 /** 112 * general notification. 113 */ 114 TYPE_NORMAL = 0x00000000, 115 /** 116 * long-term task notification. 117 */ 118 TYPE_CONTINUOUS = 0x00000001, 119 /** 120 * timed notification. 121 */ 122 TYPE_TIMER = 0x00000002 123 }; 124 125 enum class FlagStatus { 126 NONE, 127 OPEN, 128 CLOSE 129 }; 130 131 /** 132 * Indicates that a notification is deleted because it is clicked. 133 */ 134 static const int32_t CLICK_REASON_DELETE = 1; 135 136 /** 137 * Indicates that a notification is deleted because the user clears it. 138 */ 139 static const int32_t CANCEL_REASON_DELETE = 2; 140 141 /** 142 * Indicates that a notification is deleted because the user clears all notifications. 143 */ 144 static const int32_t CANCEL_ALL_REASON_DELETE = 3; 145 146 /** 147 * Indicates that a notification is deleted because of a UI error. 148 */ 149 static const int32_t ERROR_REASON_DELETE = 4; 150 151 /** 152 * Indicates that a notification is deleted because a change has been made to the application. 153 */ 154 static const int32_t PACKAGE_CHANGED_REASON_DELETE = 5; 155 156 /** 157 * Indicates that a notification is deleted because the application context is stopped. 158 */ 159 static const int32_t USER_STOPPED_REASON_DELETE = 6; 160 161 /** 162 * Indicates that a notification is deleted because the application is banned from sending notifications. 163 */ 164 static const int32_t PACKAGE_BANNED_REASON_DELETE = 7; 165 166 /** 167 * Indicates that a notification is deleted because the application cancels it. 168 */ 169 static const int32_t APP_CANCEL_REASON_DELETE = 8; 170 171 /** 172 * Indicates that a notification is deleted because the application cancels all notifications. 173 */ 174 static const int32_t APP_CANCEL_ALL_REASON_DELETE = 9; 175 176 /** 177 * Indicates that a notification is deleted for other reasons. 178 */ 179 static const int32_t APP_CANCEL_REASON_OTHER = 10; 180 181 /** 182 * The key indicates input source. 183 */ 184 static const std::string EXTRA_INPUTS_SOURCE; 185 186 static const int64_t HOUR_TO_MS = 3600000; 187 188 static const int64_t SECOND_TO_MS = 1000; 189 190 static const int64_t MAX_FINISH_TIME = 8 * HOUR_TO_MS; 191 192 static const int64_t MAX_UPDATE_TIME = 4 * HOUR_TO_MS; 193 194 static const int64_t INVALID_AUTO_DELETE_TIME = -1; 195 196 /* one hour */ 197 static const int64_t DEFAULT_AUTO_DELETE_TIME = 3600; 198 199 static const int64_t NO_DELAY_DELETE_TIME = 0; 200 201 static constexpr uint64_t INVALID_TIMER_ID = 0ULL; 202 203 // live view max size is 512KB(extra size) + 8KB(base size) = 520KB 204 static constexpr uint64_t NOTIFICATION_MAX_LIVE_VIEW_SIZE = 520ULL * 1024ULL; 205 206 // rdb 207 constexpr static const char* NOTIFICATION_RDB_NAME = "/notificationdb.db"; 208 constexpr static const char* NOTIFICATION_RDB_TABLE_NAME = "notification_table"; 209 constexpr static const char* NOTIFICATION_RDB_PATH = "/data/service/el1/public/database/notification_service"; 210 constexpr static const char* NOTIFICATION_JOURNAL_MODE = "WAL"; 211 constexpr static const char* NOTIFICATION_SYNC_MODE = "FULL"; 212 constexpr static int32_t NOTIFICATION_RDB_VERSION = 1; 213 constexpr static uint8_t DECIMAL_BASE = 2; 214 constexpr static uint8_t SLOTTYPE_MAX = 7; 215 constexpr static const char* NOTIFICATION_SLOTFLAG_CONFIG_PATH = "/etc/notification_reminder_config.ccm"; 216 constexpr static const char* SLOTTYPECCMNAMES[] = {"Social_communication", "Service_reminder", 217 "Content_information", "Other", "Custom", "Live_view", "Custom_service"}; 218 }; 219 } // namespace Notification 220 } // namespace OHOS 221 222 #endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_NOTIFICATION_CONSTANT_H 223