1 /* 2 * Copyright (c) 2021-2024 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 EMERGENCY_INFORMATION, // the notification type is emergency information 68 ILLEGAL_TYPE, // invalid type,it is used as the upper limit of the enumerated value 69 }; 70 71 enum ReminderFlag { 72 SOUND_FLAG = 1 << 0, 73 LOCKSCREEN_FLAG = 1 << 1, 74 BANNER_FLAG = 1 << 2, 75 LIGHTSCREEN_FLAG = 1 << 3, 76 VIBRATION_FLAG = 1 << 4, 77 STATUSBAR_ICON_FLAG = 1 << 5, 78 SA_SELF_BANNER_FLAG = 1 << 9, 79 }; 80 81 enum DistributedDeleteType { 82 ALL, 83 SLOT, 84 EXCLUDE_ONE_SLOT, 85 HASHCODES, 86 DEVICE_ID, 87 }; 88 89 enum class VisiblenessType { 90 /** 91 * the notification display effect has not been set by NotificationRequest::setVisibleness(). 92 * This method is usually not used. 93 */ 94 NO_OVERRIDE, 95 /** 96 * only the basic information, such as application icon and application name is displayed on the lock screen. 97 */ 98 PRIVATE, 99 /** 100 * contents of a notification are displayed on the lock screen. 101 */ 102 PUBLIC, 103 /** 104 * notifications are not displayed on the lock screen. 105 */ 106 SECRET, 107 /** 108 * invalid type 109 * It is used as the upper limit of the enumerated value. 110 */ 111 ILLEGAL_TYPE 112 }; 113 114 enum class DoNotDisturbType { 115 NONE = 0, 116 ONCE = 1, // only once 117 DAILY = 2, // every day 118 CLEARLY = 3, // time period 119 }; 120 121 enum class RemindType { 122 NONE = -1, 123 DEVICE_IDLE_DONOT_REMIND = 0, // The device is not in use, no reminder 124 DEVICE_IDLE_REMIND = 1, // The device is not in use, remind 125 DEVICE_ACTIVE_DONOT_REMIND = 2, // The device is in use, no reminder 126 DEVICE_ACTIVE_REMIND = 3, // The device is in use, reminder 127 }; 128 129 enum class DistributedReminderPolicy { 130 DEFAULT, 131 ALWAYS_REMIND, 132 DO_NOT_REMIND, 133 }; 134 135 enum class SourceType { 136 /** 137 * general notification. 138 */ 139 TYPE_NORMAL = 0x00000000, 140 /** 141 * long-term task notification. 142 */ 143 TYPE_CONTINUOUS = 0x00000001, 144 /** 145 * timed notification. 146 */ 147 TYPE_TIMER = 0x00000002 148 }; 149 150 enum class FlagStatus { 151 NONE, 152 OPEN, 153 CLOSE 154 }; 155 156 enum class SWITCH_STATE { 157 /** 158 * Represents an off state that was explicitly set by the user. 159 */ 160 USER_MODIFIED_OFF, 161 162 /** 163 * Represents an on state that was explicitly set by the user. 164 */ 165 USER_MODIFIED_ON, 166 167 /** 168 * Represents the initial off state before any user modification. 169 */ 170 SYSTEM_DEFAULT_OFF, 171 172 /** 173 * Represents the initial on state before any user modification. 174 */ 175 SYSTEM_DEFAULT_ON 176 }; 177 178 enum class DANS_SUPPORT_STATUS { 179 /** 180 * unsupport the set of distributed abilities. 181 */ 182 UNSUPPORT = -1, 183 184 /** 185 * support the set of distributed abilities. 186 */ 187 SUPPORT 188 }; 189 190 static const int32_t DEFAULT_REASON_DELETE = 0; 191 192 /** 193 * Indicates that a notification is deleted because it is clicked. 194 */ 195 static const int32_t CLICK_REASON_DELETE = 1; 196 197 /** 198 * Indicates that a notification is deleted because the user clears it. 199 */ 200 static const int32_t CANCEL_REASON_DELETE = 2; 201 202 /** 203 * Indicates that a notification is deleted because the user clears all notifications. 204 */ 205 static const int32_t CANCEL_ALL_REASON_DELETE = 3; 206 207 /** 208 * Indicates that a notification is deleted because of a UI error. 209 */ 210 static const int32_t ERROR_REASON_DELETE = 4; 211 212 /** 213 * Indicates that a notification is deleted because a change has been made to the application. 214 */ 215 static const int32_t PACKAGE_CHANGED_REASON_DELETE = 5; 216 217 /** 218 * Indicates that a notification is deleted because the application context is stopped. 219 */ 220 static const int32_t USER_STOPPED_REASON_DELETE = 6; 221 222 /** 223 * Indicates that a notification is deleted because the application is banned from sending notifications. 224 */ 225 static const int32_t PACKAGE_BANNED_REASON_DELETE = 7; 226 227 /** 228 * Indicates that a notification is deleted because the application cancels it. 229 */ 230 static const int32_t APP_CANCEL_REASON_DELETE = 8; 231 232 /** 233 * Indicates that a notification is deleted because the application cancels all notifications. 234 */ 235 static const int32_t APP_CANCEL_ALL_REASON_DELETE = 9; 236 237 /** 238 * Indicates that a notification is deleted because this user is removed. 239 */ 240 static const int32_t USER_REMOVED_REASON_DELETE = 10; 241 242 /** 243 * Indicates that a notification is deleted because of flow control. 244 */ 245 static const int32_t FLOW_CONTROL_REASON_DELETE = 11; 246 247 /** 248 * Indicates that a notification is deleted because enable state is changed. 249 */ 250 static const int32_t DISABLE_SLOT_REASON_DELETE = 12; 251 252 /** 253 * Indicates that a notification is deleted because enable state is changed. 254 */ 255 static const int32_t DISABLE_NOTIFICATION_REASON_DELETE = 13; 256 257 /** 258 * Indicates that a notification is deleted by bundle because the application cancel it. 259 */ 260 static const int32_t APP_CANCEL_AS_BUNELE_REASON_DELETE = 14; 261 262 /** 263 * Indicates that a notification is deleted by agent because the application cancel it. 264 */ 265 static const int32_t APP_CANCEL_AS_BUNELE_WITH_AGENT_REASON_DELETE = 15; 266 267 /** 268 * Indicates that a notification is deleted because the reminder cancel it. 269 */ 270 static const int32_t APP_CANCEL_REMINDER_REASON_DELETE = 16; 271 272 /** 273 * Indicates that a notification is deleted because the application cancel it by group. 274 */ 275 static const int32_t APP_CANCEL_GROPU_REASON_DELETE = 17; 276 277 /** 278 * Indicates that a notification is deleted by group because the system cancel it. 279 */ 280 static const int32_t APP_REMOVE_GROUP_REASON_DELETE = 18; 281 282 /** 283 * Indicates that aLL notification is deleted because the system cancel it. 284 */ 285 static const int32_t APP_REMOVE_ALL_REASON_DELETE = 19; 286 287 /** 288 * Indicates that aLL notification is deleted by userId because the system cancel it. 289 */ 290 static const int32_t APP_REMOVE_ALL_USER_REASON_DELETE = 20; 291 292 /** 293 * Indicates that notification is deleted because eight-hour timer cancel it. 294 */ 295 static const int32_t TRIGGER_EIGHT_HOUR_REASON_DELETE = 21; 296 297 /** 298 * Indicates that notification is deleted because four-hour timer cancel it. 299 */ 300 static const int32_t TRIGGER_FOUR_HOUR_REASON_DELETE = 22; 301 302 /** 303 * Indicates that notification is deleted because ten-minutes timer cancel it. 304 */ 305 static const int32_t TRIGGER_TEN_MINUTES_REASON_DELETE = 23; 306 307 /** 308 * Indicates that notification is deleted because fifteen-minutes timer cancel it. 309 */ 310 static const int32_t TRIGGER_FIFTEEN_MINUTES_REASON_DELETE = 24; 311 312 /** 313 * Indicates that notification is deleted because thirty-minutes timer cancel it. 314 */ 315 static const int32_t TRIGGER_THIRTY_MINUTES_REASON_DELETE = 25; 316 317 /** 318 * Indicates that notification is deleted because startArchive timer cancel it. 319 */ 320 static const int32_t TRIGGER_START_ARCHIVE_REASON_DELETE = 26; 321 322 /** 323 * Indicates that notification is deleted because auto delete timer cancel it. 324 */ 325 static const int32_t TRIGGER_AUTO_DELETE_REASON_DELETE = 27; 326 327 /** 328 * Indicates that notification is deleted because auto packge remove cancel it. 329 */ 330 static const int32_t PACKAGE_REMOVE_REASON_DELETE = 28; 331 332 /** 333 * Indicates that notification is deleted because slot enabled close remove cancel it. 334 */ 335 static const int32_t SLOT_ENABLED_REASON_DELETE = 29; 336 337 /** 338 * Indicates that a notification is deleted because recover live live validated need delete. 339 */ 340 static const int32_t RECOVER_LIVE_VIEW_DELETE = 30; 341 342 /** 343 * Indicates that a notification is deleted because disable. 344 */ 345 static const int32_t DISABLE_NOTIFICATION_FEATURE_REASON_DELETE = 31; 346 347 /** 348 * Indicates that a notification is deleted because collaborative delete. 349 */ 350 static const int32_t DISTRIBUTED_COLLABORATIVE_DELETE = 32; 351 352 /** 353 * Indicates that a notification is deleted because this user is removed. 354 */ 355 static const int32_t USER_LOGOUT_REASON_DELETE = 33; 356 357 /** 358 * Indicates that a notification is deleted because collaboration click. 359 */ 360 static const int32_t DISTRIBUTED_COLLABORATIVE_CLICK_DELETE = 34; 361 362 /** 363 * Indicates that a notification is deleted because distributed enable close removed. 364 */ 365 static const int32_t DISTRIBUTED_ENABLE_CLOSE_DELETE = 35; 366 367 /** 368 * Indicates that a notification is deleted because distributed release removed. 369 */ 370 static const int32_t DISTRIBUTED_RELEASE_DELETE = 36; 371 372 /** 373 * Indicates that a notification is deleted for other reasons. 374 */ 375 static const int32_t APP_CANCEL_REASON_OTHER = 100; 376 377 /** 378 * The key indicates input source. 379 */ 380 static const std::string EXTRA_INPUTS_SOURCE; 381 382 static const int64_t HOUR_TO_MS = 3600000; 383 384 static const int64_t SECOND_TO_MS = 1000; 385 386 static const int64_t TEN_MINUTES = 600000; 387 388 static const int64_t FIFTEEN_MINUTES = 900000; 389 390 static const int64_t THIRTY_MINUTES = 1800000; 391 392 static const int64_t FINISH_PER = 100; 393 394 static const int64_t DEFAULT_FINISH_STATUS = -1; 395 396 static const int64_t MAX_FINISH_TIME = 8 * HOUR_TO_MS; 397 398 static const int64_t MAX_UPDATE_TIME = 4 * HOUR_TO_MS; 399 400 static const int64_t INVALID_AUTO_DELETE_TIME = -1; 401 402 /* one hour */ 403 static const int64_t DEFAULT_AUTO_DELETE_TIME = 3600; 404 405 static const int64_t NO_DELAY_DELETE_TIME = 0; 406 407 static constexpr uint64_t INVALID_TIMER_ID = 0ULL; 408 409 static constexpr int32_t ANS_UID = 5523; 410 411 static const int32_t MAX_BTN_NUM = 3; 412 413 static const int32_t DISTRIBUTE_JUMP_INVALID = -1; 414 415 static const int32_t DISTRIBUTE_JUMP_BY_NTF = 0; 416 417 static const int32_t DISTRIBUTE_JUMP_BY_BTN = 1; 418 419 static const int32_t DISTRIBUTE_JUMP_BY_LIVE_VIEW = 32; 420 421 // live view max size is 512KB(extra size) + 8KB(base size) = 520KB 422 static constexpr uint64_t NOTIFICATION_MAX_LIVE_VIEW_SIZE = 520ULL * 1024ULL; 423 424 // rdb 425 constexpr static const char* NOTIFICATION_RDB_NAME = "/notificationdb.db"; 426 constexpr static const char* NOTIFICATION_RDB_TABLE_NAME = "notification_table"; 427 constexpr static const char* NOTIFICATION_RDB_PATH = "/data/service/el1/public/database/notification_service"; 428 constexpr static const char* NOTIFICATION_JOURNAL_MODE = "WAL"; 429 constexpr static const char* NOTIFICATION_SYNC_MODE = "FULL"; 430 constexpr static int32_t NOTIFICATION_RDB_VERSION = 2; 431 constexpr static const char* SLOTTYPECCMNAMES[] = {"Social_communication", "Service_reminder", 432 "Content_information", "Other", "Custom", "Live_view", "Custom_service", "Emergency_information"}; 433 constexpr static const char* CURRENT_DEVICE_TYPE = "current"; 434 constexpr static const char* HEADSET_DEVICE_TYPE = "headset"; 435 constexpr static const char* LITEWEARABLE_DEVICE_TYPE = "liteWearable"; 436 constexpr static const char* WEARABLE_DEVICE_TYPE = "wearable"; 437 constexpr static const char* PAD_DEVICE_TYPE = "tablet"; 438 constexpr static const char* PC_DEVICE_TYPE = "2in1"; 439 constexpr static const char* DEVICESTYPES[] = {"headset", "liteWearable", "wearable", "2in1", "tablet"}; 440 constexpr static const char* ANS_VOIP = "ANS_VOIP"; 441 constexpr static const char* PC_PAD_VOIP_FLAG = "110101"; 442 }; 443 } // namespace Notification 444 } // namespace OHOS 445 446 #endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_NOTIFICATION_CONSTANT_H 447