* Copyright (c) 2021-2025 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.
*/
#ifndef BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_NOTIFICATION_CONSTANT_H
#define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_NOTIFICATION_CONSTANT_H
#include <string>
#include <set>
namespace OHOS {
namespace Notification {
class NotificationConstant {
public:
enum EventCodeType {
USER_GRANTED_STATE = 1,
USER_GRANTED_BUNDLE_STATE = 2,
EXTENSION_ABILITY_ADDED = 3,
EXTENSION_ABILITY_REMOVED = 4,
};
enum InputEditType {
EDIT_AUTO,
EDIT_DISABLED,
EDIT_ENABLED,
};
enum InputsSource {
FREE_FORM_INPUT,
OPTION,
};
enum SemanticActionButton {
NONE_ACTION_BUTTON,
REPLY_ACTION_BUTTON,
READ_ACTION_BUTTON,
UNREAD_ACTION_BUTTON,
DELETE_ACTION_BUTTON,
ARCHIVE_ACTION_BUTTON,
MUTE_ACTION_BUTTON,
UNMUTE_ACTION_BUTTON,
THUMBS_UP_ACTION_BUTTON,
THUMBS_DOWN_ACTION_BUTTON,
CALL_ACTION_BUTTON,
};
enum SubscribeResult : uint32_t {
SUCCESS,
PREMISSION_FAIL,
RESOURCES_FAIL,
};
enum SlotType {
SOCIAL_COMMUNICATION,
SERVICE_REMINDER,
CONTENT_INFORMATION,
OTHER,
CUSTOM,
LIVE_VIEW,
CUSTOMER_SERVICE,
EMERGENCY_INFORMATION,
ILLEGAL_TYPE,
};
enum ReminderFlag {
SOUND_FLAG = 1 << 0,
LOCKSCREEN_FLAG = 1 << 1,
BANNER_FLAG = 1 << 2,
LIGHTSCREEN_FLAG = 1 << 3,
VIBRATION_FLAG = 1 << 4,
STATUSBAR_ICON_FLAG = 1 << 5,
BADGENUMBER_SHOW_FLAG = 1 << 6,
NOTIFICATION_FLAG = 1 << 7,
SA_SELF_BANNER_FLAG = 1 << 9,
};
enum SubscribedFlag {
SUBSCRIBE_ON_CANCELED = 1 << 0,
SUBSCRIBE_ON_CONNECTED = 1 << 1,
SUBSCRIBE_ON_CONSUMED = 1 << 2,
SUBSCRIBE_ON_DISCONNECTED = 1 << 3,
SUBSCRIBE_ON_UPDATE = 1 << 4,
SUBSCRIBE_ON_BATCHCANCELED = 1 << 5,
SUBSCRIBE_ON_DONOTDISTURBDATA_CHANGED = 1 << 6,
SUBSCRIBE_ON_ENABLENOTIFICATION_CHANGED = 1 << 7,
SUBSCRIBE_ON_BADGE_CHANGED = 1 << 8,
SUBSCRIBE_ON_BADGEENABLE_CHANGED = 1 << 9,
SUBSCRIBE_ON_APPLICATIONINFONEED_CHANGED = 1 << 10,
SUBSCRIBE_ON_OPERATIONRESPONSE = 1 << 11,
SUBSCRIBE_ON_DIED = 1 << 12,
SUBSCRIBE_ON_ENABLEPRIORITY_CHANGED = 1 << 13,
SUBSCRIBE_ON_ENABLEPRIORITYBYBUNDLE_CHANGED = 1 << 14,
SUBSCRIBE_ON_SYSTEM_UPDATE = 1 << 15,
SUBSCRIBE_ON_ENABL_WATCH_CHANGED = 1 << 16,
SUBSCRIBE_ON_ENABLEDSILENTREMINDER_CHANGED = 1 << 17,
SUBSCRIBE_ON_VOICE_CONTENT = 1 << 18,
SUBSCRIBE_ON_NOTIFICATION_SWITCH_CHANGED = 1 << 19,
};
enum DistributedDeleteType {
ALL,
SLOT,
EXCLUDE_ONE_SLOT,
HASHCODES,
DEVICE_ID,
};
enum class VisiblenessType {
* the notification display effect has not been set by NotificationRequest::setVisibleness().
* This method is usually not used.
*/
NO_OVERRIDE,
* only the basic information, such as application icon and application name is displayed on the lock screen.
*/
PRIVATE,
* contents of a notification are displayed on the lock screen.
*/
PUBLIC,
* notifications are not displayed on the lock screen.
*/
SECRET,
* invalid type
* It is used as the upper limit of the enumerated value.
*/
ILLEGAL_TYPE
};
enum class DoNotDisturbType {
NONE = 0,
ONCE = 1,
DAILY = 2,
CLEARLY = 3,
};
enum class RemindType {
NONE = -1,
DEVICE_IDLE_DONOT_REMIND = 0,
DEVICE_IDLE_REMIND = 1,
DEVICE_ACTIVE_DONOT_REMIND = 2,
DEVICE_ACTIVE_REMIND = 3,
};
enum class DistributedReminderPolicy {
DEFAULT,
ALWAYS_REMIND,
DO_NOT_REMIND,
};
enum class SourceType {
* general notification.
*/
TYPE_NORMAL = 0x00000000,
* long-term task notification.
*/
TYPE_CONTINUOUS = 0x00000001,
* timed notification.
*/
TYPE_TIMER = 0x00000002
};
enum class FlagStatus {
NONE,
OPEN,
CLOSE
};
enum class SWITCH_STATE {
* Represents an off state that was explicitly set by the user.
*/
USER_MODIFIED_OFF,
* Represents an on state that was explicitly set by the user.
*/
USER_MODIFIED_ON,
* Represents the initial off state before any user modification.
*/
SYSTEM_DEFAULT_OFF,
* Represents the initial on state before any user modification.
*/
SYSTEM_DEFAULT_ON
};
enum class DANS_SUPPORT_STATUS {
* unsupport the set of distributed abilities.
*/
UNSUPPORT = -1,
* support the set of distributed abilities.
*/
SUPPORT
};
enum class PriorityEnableStatus {
* disable priority notification
*/
DISABLE = 0,
* enable priority notification by intelligent identification
*/
ENABLE_BY_INTELLIGENT = 1,
* enable priority notification
*/
ENABLE = 2,
};
enum PriorityStrategyStatus {
* Default priority strategy status
*/
STATUS_SYSTEM_DEFAULT = 1 << 0,
* Priority rules only
*/
STATUS_SYSTEM_RULE = 1 << 1,
* Intelligent recognition only
*/
STATUS_INTELLIGENT = 1 << 2,
* User-defined only
*/
STATUS_USER_DEFINED = 1 << 3,
* Application-defined only
*/
STATUS_APPLICATION_DEFINED = 1 << 4,
* All notifications are priority state
*/
STATUS_ALL_PRIORITY = 1 << 5
};
enum class TypePriorityParam {
TYPE_BOOL,
TYPE_LONG
};
enum class MonitorEvent {
MONITOR_TYPE_ENTRY = 1,
MONITOR_TYPE_LEAVE = 2,
};
enum class ConfigPath {
CONFIG_PATH_DEVICE_CONFIG = 1,
CONFIG_PATH_CLOUD_CONFIG = 2,
};
enum class CoordinateSystemType {
COORDINATE_TYPE_WGS84 = 1,
COORDINATE_TYPE_GCJ02 = 2,
};
enum class TriggerType {
TRIGGER_TYPE_FENCE = 1,
};
enum class RingtoneType {
RINGTONE_TYPE_SYSTEM = 0,
RINGTONE_TYPE_LOCAL = 1,
RINGTONE_TYPE_ONLINE = 2,
RINGTONE_TYPE_NONE = 3,
RINGTONE_TYPE_BUTT = 4,
};
enum class RingtoneReportType {
RINGTONE_UPDATE = 0,
RINGTONE_REMOVE = 1,
};
enum class SubscribeType {
BLUETOOTH = 0,
SYSTEM = 10,
};
enum class PrioritySourceResult {
INVALID_RESULT = -1,
PARAM_IN = 0,
KEYWORD = 1,
AI = 2,
PUSH_RULE = 3,
};
static const int32_t DEFAULT_REASON_DELETE = 0;
* Indicates that a notification is deleted because it is clicked.
*/
static const int32_t CLICK_REASON_DELETE = 1;
* Indicates that a notification is deleted because the user clears it.
*/
static const int32_t CANCEL_REASON_DELETE = 2;
* Indicates that a notification is deleted because the user clears all notifications.
*/
static const int32_t CANCEL_ALL_REASON_DELETE = 3;
* Indicates that a notification is deleted because of a UI error.
*/
static const int32_t ERROR_REASON_DELETE = 4;
* Indicates that a notification is deleted because a change has been made to the application.
*/
static const int32_t PACKAGE_CHANGED_REASON_DELETE = 5;
* Indicates that a notification is deleted because the application context is stopped.
*/
static const int32_t USER_STOPPED_REASON_DELETE = 6;
* Indicates that a notification is deleted because the application is banned from sending notifications.
*/
static const int32_t PACKAGE_BANNED_REASON_DELETE = 7;
* Indicates that a notification is deleted because the application cancels it.
*/
static const int32_t APP_CANCEL_REASON_DELETE = 8;
* Indicates that a notification is deleted because the application cancels all notifications.
*/
static const int32_t APP_CANCEL_ALL_REASON_DELETE = 9;
* Indicates that a notification is deleted because this user is removed.
*/
static const int32_t USER_REMOVED_REASON_DELETE = 10;
* Indicates that a notification is deleted because of flow control.
*/
static const int32_t FLOW_CONTROL_REASON_DELETE = 11;
* Indicates that a notification is deleted because enable state is changed.
*/
static const int32_t DISABLE_SLOT_REASON_DELETE = 12;
* Indicates that a notification is deleted because enable state is changed.
*/
static const int32_t DISABLE_NOTIFICATION_REASON_DELETE = 13;
* Indicates that a notification is deleted by bundle because the application cancel it.
*/
static const int32_t APP_CANCEL_AS_BUNELE_REASON_DELETE = 14;
* Indicates that a notification is deleted by agent because the application cancel it.
*/
static const int32_t APP_CANCEL_AS_BUNELE_WITH_AGENT_REASON_DELETE = 15;
* Indicates that a notification is deleted because the reminder cancel it.
*/
static const int32_t APP_CANCEL_REMINDER_REASON_DELETE = 16;
* Indicates that a notification is deleted because the application cancel it by group.
*/
static const int32_t APP_CANCEL_GROPU_REASON_DELETE = 17;
* Indicates that a notification is deleted by group because the system cancel it.
*/
static const int32_t APP_REMOVE_GROUP_REASON_DELETE = 18;
* Indicates that aLL notification is deleted because the system cancel it.
*/
static const int32_t APP_REMOVE_ALL_REASON_DELETE = 19;
* Indicates that aLL notification is deleted by userId because the system cancel it.
*/
static const int32_t APP_REMOVE_ALL_USER_REASON_DELETE = 20;
* Indicates that notification is deleted because eight-hour timer cancel it.
*/
static const int32_t TRIGGER_EIGHT_HOUR_REASON_DELETE = 21;
* Indicates that notification is deleted because four-hour timer cancel it.
*/
static const int32_t TRIGGER_FOUR_HOUR_REASON_DELETE = 22;
* Indicates that notification is deleted because ten-minutes timer cancel it.
*/
static const int32_t TRIGGER_TEN_MINUTES_REASON_DELETE = 23;
* Indicates that notification is deleted because fifteen-minutes timer cancel it.
*/
static const int32_t TRIGGER_FIFTEEN_MINUTES_REASON_DELETE = 24;
* Indicates that notification is deleted because thirty-minutes timer cancel it.
*/
static const int32_t TRIGGER_THIRTY_MINUTES_REASON_DELETE = 25;
* Indicates that notification is deleted because startArchive timer cancel it.
*/
static const int32_t TRIGGER_START_ARCHIVE_REASON_DELETE = 26;
* Indicates that notification is deleted because auto delete timer cancel it.
*/
static const int32_t TRIGGER_AUTO_DELETE_REASON_DELETE = 27;
* Indicates that notification is deleted because auto packge remove cancel it.
*/
static const int32_t PACKAGE_REMOVE_REASON_DELETE = 28;
* Indicates that notification is deleted because slot enabled close remove cancel it.
*/
static const int32_t SLOT_ENABLED_REASON_DELETE = 29;
* Indicates that a notification is deleted because recover live live validated need delete.
*/
static const int32_t RECOVER_LIVE_VIEW_DELETE = 30;
* Indicates that a notification is deleted because disable.
*/
static const int32_t DISABLE_NOTIFICATION_FEATURE_REASON_DELETE = 31;
* Indicates that a notification is deleted because collaborative delete.
*/
static const int32_t DISTRIBUTED_COLLABORATIVE_DELETE = 32;
* Indicates that a notification is deleted because this user is removed.
*/
static const int32_t USER_LOGOUT_REASON_DELETE = 33;
* Indicates that a notification is deleted because collaboration click.
*/
static const int32_t DISTRIBUTED_COLLABORATIVE_CLICK_DELETE = 34;
* Indicates that a notification is deleted because distributed enable close removed.
*/
static const int32_t DISTRIBUTED_ENABLE_CLOSE_DELETE = 35;
* Indicates that a notification is deleted because distributed release removed.
*/
static const int32_t DISTRIBUTED_RELEASE_DELETE = 36;
* Indicates that a notification is deleted because master device's distributed enable close removed.
*/
static const int32_t DISTRIBUTED_MASTER_ENABLE_CLOSE_DELETE = 37;
* Indicates that notification is deleted because geofence timer cancel it.
*/
static const int32_t TRIGGER_GEOFENCE_REASON_DELETE = 38;
* Indicates that notification is deleted because distributed enable close.
*/
static const int32_t DISTRIBUTED_APPLICATION_ENABLE_REASON_DELETE = 39;
* Indicates that notification is deleted because set snooze.
*/
static const int32_t SNOOZE_REASON_DELETE = 40;
* Indicates that notification is deleted by shell.
*/
static const int32_t SHELL_REASON_DELETE = 41;
* Indicates that a notification is deleted for other reasons.
*/
static const int32_t APP_CANCEL_REASON_OTHER = 100;
* The key indicates input source.
*/
static const std::string EXTRA_INPUTS_SOURCE;
static const int64_t HOUR_TO_MS = 3600000;
static const int64_t SECOND_TO_MS = 1000;
static const int64_t TEN_MINUTES = 600000;
static const int64_t FIFTEEN_MINUTES = 900000;
static const int64_t THIRTY_MINUTES = 1800000;
static const int64_t FINISH_PER = 100;
static const int64_t DEFAULT_FINISH_STATUS = -1;
static const int64_t MAX_FINISH_TIME = 8 * HOUR_TO_MS;
static const int64_t MAX_UPDATE_TIME = 4 * HOUR_TO_MS;
static const int64_t INVALID_AUTO_DELETE_TIME = -1;
static const int64_t DEFAULT_AUTO_DELETE_TIME = 3600;
static const int64_t NO_DELAY_DELETE_TIME = 0;
static constexpr uint64_t INVALID_TIMER_ID = 0ULL;
static constexpr uint64_t INVALID_DISPLAY_TIME = 0ULL;
static constexpr int32_t ANS_UID = 5523;
static constexpr int32_t BROKER_UID = 5557;
static const int32_t MAX_BTN_NUM = 3;
static const int32_t DISTRIBUTE_JUMP_INVALID = -1;
static const int32_t DISTRIBUTE_JUMP_BY_NTF = 0;
static const int32_t DISTRIBUTE_JUMP_BY_BTN = 1;
static const int32_t DISTRIBUTE_JUMP_BY_LIVE_VIEW = 32;
static const int64_t MAX_CLONE_TIME = 7 * 24 * HOUR_TO_MS;
static const int64_t MAX_DELAY_TIME_S = 24 * 3600;
static constexpr uint64_t NOTIFICATION_MAX_LIVE_VIEW_SIZE = 520ULL * 1024ULL;
static const char* NOTIFICATION_RDB_NAME;
static const char* NOTIFICATION_RDB_TABLE_NAME;
static const char* NOTIFICATION_RDB_PATH;
static const char* NOTIFICATION_JOURNAL_MODE;
static const char* NOTIFICATION_SYNC_MODE;
constexpr static int32_t NOTIFICATION_RDB_VERSION = 2;
static const char* SLOTTYPECCMNAMES[8];
static const char* CURRENT_DEVICE_TYPE;
static const char* HEADSET_DEVICE_TYPE;
static const char* GLASSES_DEVICE_TYPE;
static const char* LITEWEARABLE_DEVICE_TYPE;
static const char* WEARABLE_DEVICE_TYPE;
static const char* PAD_DEVICE_TYPE;
static const char* PC_DEVICE_TYPE;
static const char* SLAVE_DEVICE_TYPE;
static const char* THIRD_PARTY_WEARABLE_DEVICE_TYPE;
static const char* DEVICESTYPES[7];
static const char* ANS_VOIP;
static const char* PC_PAD_VOIP_FLAG;
* Indicates priority notification type
*/
class PriorityNotificationType {
public:
* Indicates non-priority notification
*/
static const char* OTHER;
* Indicates Priority contact
*/
static const char* PRIMARY_CONTACT;
* Indicates Someone @me
*/
static const char* AT_ME;
* Indicates Urgent message
*/
static const char* URGENT_MESSAGE;
* Indicates Schedule reminder
*/
static const char* SCHEDULE_REMINDER;
* Indicates Payment due
*/
static const char* PAYMENT_DUE;
* Indicates Transaction alert
*/
static const char* TRANSACTION_ALERT;
* Indicates Express progress
*/
static const char* EXPRESS_PROGRESS;
* Indicates Miss call
*/
static const char* MISS_CALL;
* Indicates Travel alert
*/
static const char* TRAVEL_ALERT;
* Indicates Account alert
*/
static const char* ACCOUNT_ALERT;
* Indicates Appointment reminder
*/
static const char* APPOINTMENT_REMINDER;
* Indicates Traffic notice
*/
static const char* TRAFFIC_NOTICE;
* Indicates Key progress
*/
static const char* KEY_PROGRESS;
* Indicates Public event
*/
static const char* PUBLIC_EVENT;
* Indicates Iot warning
*/
static const char* IOT_WARNING;
* custom keyword
*/
static const char* CUSTOM_KEYWORD;
* E_COMMERCE_LOGISTICS
*/
static const char* E_COMMERCE_LOGISTICS;
* Use to verify the priority type
*/
static const std::vector<std::string> VALID_PRIORITY_TYPE_LIST;
};
* Indicates aggregation notification type
*/
class AggregationType {
public:
* Indicates OTHER type notification (non-aggregation)
*/
static const char* OTHER;
* Indicates DEAL notification (transaction alert)
*/
static const char* DEAL;
* Indicates LOGISTICS notification
*/
static const char* LOGISTICS;
* Use to verify the aggregation type
*/
static const std::vector<std::string> VALID_AGGREGATION_TYPE_LIST;
};
* Indicates notification switch
*/
class NotificationSwitch {
public:
* Indicates INVALID type notification switch
*/
static const char* INVALID;
* Indicates DEAL notification switch
*/
static const char* DEAL;
* Indicates LOGISTICS notification switch
*/
static const char* LOGISTICS;
* Use to verify the switch type
*/
static const std::set<std::string> VALID_NOTIFICATION_SWITCH_SET;
* Use to verify the switch type
*/
static bool IsValidNotificationSwitch(const std::string& switchType);
};
static constexpr int32_t MAX_GEOFENCE_DISPLAY_TIME_S = 1800;
static constexpr int32_t MIN_GEOFENCE_DISPLAY_TIME_S = 15;
static constexpr int32_t DEFAULT_GEOFENCE_DISPLAY_TIME_S = 900;
static constexpr int32_t MAX_GEOFENCE_DELAY_TIME_S = 300;
static constexpr int32_t MIN_GEOFENCE_DELAY_TIME_S = 0;
static constexpr int32_t DEFAULT_GEOFENCE_DELAY_TIME_S = 0;
static constexpr double MAX_GEOFENCE_LONGITUDE = 180.0;
static constexpr double MIN_GEOFENCE_LONGITUDE = -180.0;
static constexpr double MAX_GEOFENCE_LATITUDE = 90.0;
static constexpr double MIN_GEOFENCE_LATITUDE = -90.0;
static constexpr double MAX_GEOFENCE_RADIUS = 2000.0;
static constexpr double MIN_GEOFENCE_RADIUS = 200.0;
static const char* EVENT_PRIORITY_INTELLIGENT_SWITCH;
static const char* EVENT_PRIORITY_SWITCH_BY_BUNDLE;
static const char* EVENT_PRIORITY_STRATEGY_BY_BUNDLE;
static const char* EVENT_NOTIFICATION_REMOVED;
static const uint32_t TYPE_PRIORITY_INTELLIGENT_SWITCH = 0;
static const uint32_t TYPE_PRIORITY_SWITCH_BY_BUNDLE = 1;
static const uint32_t TYPE_PRIORITY_STRATEGY_BY_BUNDLE = 2;
static const uint32_t CAPACITY_520 = 520 << 10;
};
}
}
#endif