1/* 2 * Copyright (c) 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 16interface OHOS.Notification.IAnsDialogCallback; 17interface OHOS.Notification.IAnsSubscriberLocalLiveView; 18interface OHOS.Notification.IAnsSubscriber; 19interface OHOS.Notification.IAnsOperationCallback; 20 21sequenceable OHOS.Notification.NotificationBundleOption; 22sequenceable OHOS.Notification.DistributedBundleOption; 23sequenceable OHOS.Notification.NotificationDisable; 24sequenceable OHOS.Notification.NotificationDoNotDisturbDate; 25sequenceable OHOS.Notification.NotificationDoNotDisturbProfile; 26sequenceable OHOS.Notification.NotificationRequest; 27sequenceable OHOS.Notification.NotificationSlot; 28sequenceable OHOS.Notification.NotificationSubscribeInfo; 29sequenceable OHOS.Notification.NotificationOperationInfo; 30sequenceable OHOS.Notification.Notification; 31sequenceable OHOS.Notification.NotificationButtonOption; 32sequenceable OHOS.Notification.NotificationCheckRequest; 33sequenceable OHOS.IRemoteObject; 34 35interface OHOS.Notification.IAnsManager { 36 void Publish([in] String label, [in] sptr<NotificationRequest> notification); 37 [ipcincapacity 520] void PublishWithMaxCapacity([in] String label, [in] sptr<NotificationRequest> notification); 38 39 void PublishNotificationForIndirectProxy([in] sptr<NotificationRequest> notification); 40 [ipcincapacity 520] void PublishNotificationForIndirectProxyWithMaxCapacity([in] sptr<NotificationRequest> notification); 41 42 void Cancel([in] int notificationId, [in] String label, [in] String instanceKey); 43 44 void CancelAll([in] String instanceKey); 45 46 void CancelAsBundle([in] int notificationId, [in] String representativeBundle, [in] int userId); 47 48 void CancelAsBundle([in] sptr<NotificationBundleOption> bundleOption, [in] int notificationId); 49 50 void CancelAsBundle([in] sptr<NotificationBundleOption> bundleOption, [in] int notificationId, [in] int userId); 51 52 void AddSlotByType([in] int slotTypeInt); 53 54 void AddSlots([in] sptr<NotificationSlot>[] slots); 55 56 void RemoveSlotByType([in] int slotTypeInt); 57 58 void RemoveAllSlots(); 59 60 void GetSlotByType([in] int slotTypeInt, [out] null_sptr<NotificationSlot> slot); 61 62 void GetSlots([out] sptr<NotificationSlot>[] slots); 63 64 void GetSlotNumAsBundle([in] sptr<NotificationBundleOption> bundleOption, [out] unsigned long num); 65 66 void GetActiveNotifications([out] sptr<NotificationRequest>[] notifications, [in] String instanceKey); 67 68 void GetActiveNotificationNums([out] unsigned long num); 69 70 void GetAllActiveNotifications([out] sptr<Notification>[] notifications); 71 72 void GetAllNotificationsBySlotType([out] sptr<Notification>[] notifications, [in] int slotTypeInt); 73 74 void GetSpecialActiveNotifications([in] String[] key, [out] sptr<Notification>[] notifications); 75 76 [ipcoutcapacity 520] void GetActiveNotificationByFilter( 77 [in] sptr<NotificationBundleOption> bundleOption, 78 [in] int notificationId, 79 [in] String label, 80 [in] int userId, 81 [in] String[] extraInfoKeys, 82 [out] null_sptr<NotificationRequest> request); 83 84 void CanPublishAsBundle([in] String representativeBundle, [out] boolean canPublish); 85 86 void PublishAsBundle([in] sptr<NotificationRequest> notification, [in] String representativeBundle); 87 [ipcincapacity 520] void PublishAsBundleWithMaxCapacity([in] sptr<NotificationRequest> notification, [in] String representativeBundle); 88 89 void SetNotificationBadgeNum([in] int num); 90 91 void GetBundleImportance([out] int importance); 92 93 void HasNotificationPolicyAccessPermission([out] boolean granted); 94 95 void TriggerLocalLiveView( 96 [in] sptr<NotificationBundleOption> bundleOption, 97 [in] int notificationId, 98 [in] sptr<NotificationButtonOption> buttonOption); 99 100 void RemoveNotification( 101 [in] sptr<NotificationBundleOption> bundleOption, 102 [in] int notificationId, 103 [in] String label, 104 [in] int removeReason); 105 106 void RemoveAllNotifications([in] sptr<NotificationBundleOption> bundleOption); 107 108 void RemoveNotifications([in] String[] hashcodes, [in] int removeReason); 109 110 void RemoveDistributedNotifications([in] String[] hashcodes, [in] int slotTypeInt, [in] int deleteTypeInt, [in] int removeReason, [in] String deviceId); 111 112 void Delete([in] String key, [in] int removeReason); 113 114 void DeleteByBundle([in] sptr<NotificationBundleOption> bundleOption); 115 116 void DeleteAll(); 117 118 void GetSlotsByBundle([in] sptr<NotificationBundleOption> bundleOption, [out] sptr<NotificationSlot>[] slots); 119 120 void GetSlotByBundle([in] sptr<NotificationBundleOption> bundleOption, [in] int slotTypeInt, 121 [out] null_sptr<NotificationSlot> slot); 122 123 void UpdateSlots([in] sptr<NotificationBundleOption> bundleOption, [in] sptr<NotificationSlot>[] slots); 124 125 void RequestEnableNotification([in] String deviceId, [in] IAnsDialogCallback ansDialogCallback); 126 void RequestEnableNotification([in] String deviceId, [in] IAnsDialogCallback ansDialogCallback, [in] IRemoteObject callerToken); 127 128 void RequestEnableNotification([in] String bundleName, [in] int uid); 129 130 void SetNotificationsEnabledForBundle([in] String deviceId, [in] boolean enabled); 131 132 void SetNotificationsEnabledForAllBundles([in] String deviceId, [in] boolean enabled); 133 134 void SetNotificationsEnabledForSpecialBundle( 135 [in] String deviceId, [in] sptr<NotificationBundleOption> bundleOption, [in] boolean enabled, [in] boolean updateUnEnableTime); 136 137 void SetShowBadgeEnabledForBundle([in] sptr<NotificationBundleOption> bundleOption, [in] boolean enabled); 138 139 void GetShowBadgeEnabledForBundle([in] sptr<NotificationBundleOption> bundleOption, [out] boolean enabled); 140 141 void GetShowBadgeEnabled([out] boolean enabled); 142 143 void Subscribe([in] IAnsSubscriber subscriber); 144 void Subscribe([in] IAnsSubscriber subscriber, [in] sptr<NotificationSubscribeInfo> info); 145 146 void SubscribeSelf([in] IAnsSubscriber subscriber); 147 148 void SubscribeLocalLiveView( 149 [in] IAnsSubscriberLocalLiveView subscriber, 150 [in] boolean isNative); 151 void SubscribeLocalLiveView( 152 [in] IAnsSubscriberLocalLiveView subscriber, 153 [in] sptr<NotificationSubscribeInfo> info, 154 [in] boolean isNative); 155 156 void Unsubscribe([in] IAnsSubscriber subscriber); 157 void Unsubscribe([in] IAnsSubscriber subscriber, [in] sptr<NotificationSubscribeInfo> info); 158 159 void IsAllowedNotify([out] boolean allowed); 160 161 void IsAllowedNotifySelf([out] boolean allowed); 162 163 void CanPopEnableNotificationDialog([in] IAnsDialogCallback ansDialogCallback, [out] boolean canPop, [out] String bundleName); 164 165 void RemoveEnableNotificationDialog(); 166 167 void IsSpecialBundleAllowedNotify([in] sptr<NotificationBundleOption> bundleOption, [out] boolean allowed); 168 169 void SetDoNotDisturbDate([in] sptr<NotificationDoNotDisturbDate> date); 170 171 void GetDoNotDisturbDate([out] sptr<NotificationDoNotDisturbDate> date); 172 173 void AddDoNotDisturbProfiles([in] sptr<NotificationDoNotDisturbProfile>[] profiles); 174 175 void RemoveDoNotDisturbProfiles([in] sptr<NotificationDoNotDisturbProfile>[] profiles); 176 177 void DoesSupportDoNotDisturbMode([out] boolean doesSupport); 178 179 void IsNeedSilentInDoNotDisturbMode([in] String phoneNumber, [in] int callerType); 180 181 void CancelGroup([in] String groupName, [in] String instanceKey); 182 183 void RemoveGroupByBundle([in] sptr<NotificationBundleOption> bundleOption, [in] String groupName); 184 185 void IsDistributedEnabled([out] boolean enabled); 186 187 void GetDistributedDevicelist([out] String[] deviceTypes); 188 189 void SetDistributedEnabledBySlot( 190 [in] int slotTypeInt, [in] String deviceType, [in] boolean enabled); 191 192 void IsDistributedEnabledBySlot( 193 [in] int slotTypeInt, [in] String deviceType, [out] boolean enabled); 194 195 void EnableDistributed([in] boolean enabled); 196 197 void EnableDistributedByBundle([in] sptr<NotificationBundleOption> bundleOption, [in] boolean enabled); 198 199 void EnableDistributedSelf([in] boolean enabled); 200 201 void IsDistributedEnableByBundle([in] sptr<NotificationBundleOption> bundleOption, [out] boolean enabled); 202 203 void GetDeviceRemindType([out] int remindTypeInt); 204 205 void PublishContinuousTaskNotification([in] sptr<NotificationRequest> request); 206 207 void CancelContinuousTaskNotification([in] String label, [in] int notificationId); 208 209 void IsSupportTemplate([in] String templateName, [out] boolean support); 210 211 void IsSpecialUserAllowedNotify([in] int userId, [out] boolean allowed); 212 213 void SetNotificationsEnabledByUser([in] int userId, [in] boolean enabled); 214 215 void DeleteAllByUser([in] int userId); 216 217 void SetDoNotDisturbDate([in] int userId, [in] sptr<NotificationDoNotDisturbDate> date); 218 219 void GetDoNotDisturbDate([in] int userId, [out] sptr<NotificationDoNotDisturbDate> date); 220 221 void SetEnabledForBundleSlot( 222 [in] sptr<NotificationBundleOption> bundleOption, 223 [in] int slotTypeInt, 224 [in] boolean enabled, 225 [in] boolean isForceControl); 226 227 void GetEnabledForBundleSlot( 228 [in] sptr<NotificationBundleOption> bundleOption, 229 [in] int slotTypeInt, 230 [out] boolean enabled); 231 232 void GetEnabledForBundleSlotSelf([in] int slotTypeInt, [out] boolean enabled); 233 234 void ShellDump( 235 [in] String cmd, 236 [in] String bundle, 237 [in] int userId, 238 [in] int recvUserId, 239 [out] String[] dumpInfo); 240 241 void SetSyncNotificationEnabledWithoutApp([in] int userId, [in] boolean enabled); 242 243 void GetSyncNotificationEnabledWithoutApp([in] int userId, [out] boolean enabled); 244 245 void SetBadgeNumber([in] int badgeNumber, [in] String instanceKey); 246 247 void SetBadgeNumberByBundle([in] sptr<NotificationBundleOption> bundleOption, [in] int badgeNumber); 248 249 void SetBadgeNumberForDhByBundle([in] sptr<NotificationBundleOption> bundleOption, [in] int badgeNumber); 250 251 void GetSlotFlagsAsBundle([in] sptr<NotificationBundleOption> bundleOption, [out] unsigned int slotFlags); 252 253 void SetSlotFlagsAsBundle([in] sptr<NotificationBundleOption> bundleOption, [in] unsigned int slotFlags); 254 255 void GetNotificationSettings([out] unsigned int slotFlags); 256 257 void GetAllNotificationEnabledBundles([out] NotificationBundleOption[] bundleOption); 258 259 void GetAllLiveViewEnabledBundles([out] NotificationBundleOption[] bundleOption); 260 261 void GetAllDistribuedEnabledBundles([in] String deviceType, [out] NotificationBundleOption[] bundleOption); 262 263 void RegisterPushCallback([in] IRemoteObject pushCallback, [in] sptr<NotificationCheckRequest> notificationCheckRequest); 264 265 void UnregisterPushCallback(); 266 267 void SetAdditionConfig([in] String key, [in] String value); 268 269 void SetDistributedEnabledByBundle( 270 [in] sptr<NotificationBundleOption> bundleOption, [in] String deviceType, [in] boolean enabled); 271 272 void SetDistributedBundleOption( 273 [in] sptr<DistributedBundleOption>[] bundles, [in] String deviceType); 274 275 void SetDistributedEnabled([in] String deviceType, [in] boolean enabled); 276 277 void IsDistributedEnabled([in] String deviceType, [out] boolean enabled); 278 279 void GetDistributedAbility([out] int abilityId); 280 281 void GetDistributedAuthStatus([in] String deviceType, [in] String deviceId, [in] int userId, [out] boolean isAuth); 282 283 void SetDistributedAuthStatus([in] String deviceType, [in] String deviceId, [in] int userId, [in] boolean isAuth); 284 285 void IsSmartReminderEnabled([in] String deviceType, [out] boolean enabled); 286 287 void SetSmartReminderEnabled([in] String deviceType, [in] boolean enabled); 288 289 void IsSilentReminderEnabled([in] sptr<NotificationBundleOption> bundleOption, [out] int enabled); 290 291 void SetSilentReminderEnabled([in] sptr<NotificationBundleOption> bundleOption, [in] boolean enabled); 292 293 void IsDistributedEnabledByBundle([in] sptr<NotificationBundleOption> bundleOption, [in] String deviceType, [out] boolean enabled); 294 295 void CancelAsBundleWithAgent([in] sptr<NotificationBundleOption> bundleOption, [in] int id); 296 297 void SetTargetDeviceStatus([in] String deviceType, [in] unsigned int status, [in] String deviceId); 298 299 void SetTargetDeviceStatus([in] String deviceType, [in] unsigned int status, [in] unsigned int controlFlag, [in] String deviceId, [in] int userId); 300 301 void GetDoNotDisturbProfile([in] long id, [out] sptr<NotificationDoNotDisturbProfile> profile); 302 303 void AllowUseReminder([in] String bundleName, [out] boolean isAllowUseReminder); 304 305 [oneway] void UpdateNotificationTimerByUid([in] int uid, [in] boolean isPaused); 306 307 void DisableNotificationFeature([in] sptr<NotificationDisable> notificationDisable); 308 309 void GetTargetDeviceStatus([in] String deviceType, [out] int status); 310 311 void DistributeOperation([in] null_sptr<NotificationOperationInfo> operationInfo, [in] IAnsOperationCallback operationCallback); 312 313 void ReplyDistributeOperation([in] String hashCode, [in] int resultCode); 314 315 void GetNotificationRequestByHashCode( 316 [in] String hashCode, [out] null_sptr<NotificationRequest> notificationRequest); 317 318 void SetTargetDeviceBundleList([in] String deviceType, [in] String deviceId, [in] int operatorType, [in] String[] bundleList, [in] String[] labelList); 319 320 void SetTargetDeviceSwitch([in] String deviceType, [in] String deviceId, [in] boolean notificaitonEnable, [in] boolean liveViewEnable); 321 322 void SetHashCodeRule([in] unsigned int type); 323 324 void GetMutilDeviceStatus([in] String deviceType, [in] unsigned int status, [out] String deviceId, [out] int userId); 325 326 void GetTargetDeviceBundleList([in] String deviceType, [in] String deviceId, [out] String[] bundleList, [out] String[] labelList); 327 328 [macrodef NOTIFICATION_SMART_REMINDER_SUPPORTED] void RegisterSwingCallback([in] IRemoteObject swingCallback); 329} 330