1 /* //device/java/android/android/app/INotificationManager.aidl 2 ** 3 ** Copyright 2007, The Android Open Source Project 4 ** 5 ** Licensed under the Apache License, Version 2.0 (the "License"); 6 ** you may not use this file except in compliance with the License. 7 ** You may obtain a copy of the License at 8 ** 9 ** http://www.apache.org/licenses/LICENSE-2.0 10 ** 11 ** Unless required by applicable law or agreed to in writing, software 12 ** distributed under the License is distributed on an "AS IS" BASIS, 13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 ** See the License for the specific language governing permissions and 15 ** limitations under the License. 16 */ 17 18 package android.app; 19 20 import android.app.ITransientNotification; 21 import android.app.ITransientNotificationCallback; 22 import android.app.Notification; 23 import android.app.NotificationChannel; 24 import android.app.NotificationChannelGroup; 25 import android.app.NotificationHistory; 26 import android.app.NotificationManager; 27 import android.content.AttributionSource; 28 import android.content.ComponentName; 29 import android.content.Intent; 30 import android.content.pm.ParceledListSlice; 31 import android.net.Uri; 32 import android.os.Bundle; 33 import android.os.UserHandle; 34 import android.service.notification.Adjustment; 35 import android.service.notification.Condition; 36 import android.service.notification.IConditionListener; 37 import android.service.notification.IConditionProvider; 38 import android.service.notification.INotificationListener; 39 import android.service.notification.NotificationListenerFilter; 40 import android.service.notification.StatusBarNotification; 41 import android.app.AutomaticZenRule; 42 import android.service.notification.ZenModeConfig; 43 44 /** {@hide} */ 45 interface INotificationManager 46 { 47 @UnsupportedAppUsage cancelAllNotifications(String pkg, int userId)48 void cancelAllNotifications(String pkg, int userId); 49 clearData(String pkg, int uid, boolean fromApp)50 void clearData(String pkg, int uid, boolean fromApp); enqueueTextToast(String pkg, IBinder token, CharSequence text, int duration, boolean isUiContext, int displayId, @nullable ITransientNotificationCallback callback)51 void enqueueTextToast(String pkg, IBinder token, CharSequence text, int duration, boolean isUiContext, int displayId, @nullable ITransientNotificationCallback callback); enqueueToast(String pkg, IBinder token, ITransientNotification callback, int duration, boolean isUiContext, int displayId)52 void enqueueToast(String pkg, IBinder token, ITransientNotification callback, int duration, boolean isUiContext, int displayId); cancelToast(String pkg, IBinder token)53 void cancelToast(String pkg, IBinder token); finishToken(String pkg, IBinder token)54 void finishToken(String pkg, IBinder token); 55 enqueueNotificationWithTag(String pkg, String opPkg, String tag, int id, in Notification notification, int userId)56 void enqueueNotificationWithTag(String pkg, String opPkg, String tag, int id, 57 in Notification notification, int userId); 58 @UnsupportedAppUsage cancelNotificationWithTag(String pkg, String opPkg, String tag, int id, int userId)59 void cancelNotificationWithTag(String pkg, String opPkg, String tag, int id, int userId); 60 isInCall(String pkg, int uid)61 boolean isInCall(String pkg, int uid); setShowBadge(String pkg, int uid, boolean showBadge)62 void setShowBadge(String pkg, int uid, boolean showBadge); canShowBadge(String pkg, int uid)63 boolean canShowBadge(String pkg, int uid); hasSentValidMsg(String pkg, int uid)64 boolean hasSentValidMsg(String pkg, int uid); isInInvalidMsgState(String pkg, int uid)65 boolean isInInvalidMsgState(String pkg, int uid); hasUserDemotedInvalidMsgApp(String pkg, int uid)66 boolean hasUserDemotedInvalidMsgApp(String pkg, int uid); setInvalidMsgAppDemoted(String pkg, int uid, boolean isDemoted)67 void setInvalidMsgAppDemoted(String pkg, int uid, boolean isDemoted); hasSentValidBubble(String pkg, int uid)68 boolean hasSentValidBubble(String pkg, int uid); setNotificationsEnabledForPackage(String pkg, int uid, boolean enabled)69 void setNotificationsEnabledForPackage(String pkg, int uid, boolean enabled); 70 /** 71 * Updates the notification's enabled state. Additionally locks importance for all of the 72 * notifications belonging to the app, such that future notifications aren't reconsidered for 73 * blocking helper. 74 */ setNotificationsEnabledWithImportanceLockForPackage(String pkg, int uid, boolean enabled)75 void setNotificationsEnabledWithImportanceLockForPackage(String pkg, int uid, boolean enabled); 76 77 @UnsupportedAppUsage areNotificationsEnabledForPackage(String pkg, int uid)78 boolean areNotificationsEnabledForPackage(String pkg, int uid); areNotificationsEnabled(String pkg)79 boolean areNotificationsEnabled(String pkg); getPackageImportance(String pkg)80 int getPackageImportance(String pkg); isImportanceLocked(String pkg, int uid)81 boolean isImportanceLocked(String pkg, int uid); 82 getAllowedAssistantAdjustments(String pkg)83 List<String> getAllowedAssistantAdjustments(String pkg); 84 shouldHideSilentStatusIcons(String callingPkg)85 boolean shouldHideSilentStatusIcons(String callingPkg); setHideSilentStatusIcons(boolean hide)86 void setHideSilentStatusIcons(boolean hide); 87 setBubblesAllowed(String pkg, int uid, int bubblePreference)88 void setBubblesAllowed(String pkg, int uid, int bubblePreference); areBubblesAllowed(String pkg)89 boolean areBubblesAllowed(String pkg); areBubblesEnabled(in UserHandle user)90 boolean areBubblesEnabled(in UserHandle user); getBubblePreferenceForPackage(String pkg, int uid)91 int getBubblePreferenceForPackage(String pkg, int uid); 92 createNotificationChannelGroups(String pkg, in ParceledListSlice channelGroupList)93 void createNotificationChannelGroups(String pkg, in ParceledListSlice channelGroupList); createNotificationChannels(String pkg, in ParceledListSlice channelsList)94 void createNotificationChannels(String pkg, in ParceledListSlice channelsList); createNotificationChannelsForPackage(String pkg, int uid, in ParceledListSlice channelsList)95 void createNotificationChannelsForPackage(String pkg, int uid, in ParceledListSlice channelsList); getConversations(boolean onlyImportant)96 ParceledListSlice getConversations(boolean onlyImportant); getConversationsForPackage(String pkg, int uid)97 ParceledListSlice getConversationsForPackage(String pkg, int uid); getNotificationChannelGroupsForPackage(String pkg, int uid, boolean includeDeleted)98 ParceledListSlice getNotificationChannelGroupsForPackage(String pkg, int uid, boolean includeDeleted); getNotificationChannelGroupForPackage(String groupId, String pkg, int uid)99 NotificationChannelGroup getNotificationChannelGroupForPackage(String groupId, String pkg, int uid); getPopulatedNotificationChannelGroupForPackage(String pkg, int uid, String groupId, boolean includeDeleted)100 NotificationChannelGroup getPopulatedNotificationChannelGroupForPackage(String pkg, int uid, String groupId, boolean includeDeleted); updateNotificationChannelGroupForPackage(String pkg, int uid, in NotificationChannelGroup group)101 void updateNotificationChannelGroupForPackage(String pkg, int uid, in NotificationChannelGroup group); updateNotificationChannelForPackage(String pkg, int uid, in NotificationChannel channel)102 void updateNotificationChannelForPackage(String pkg, int uid, in NotificationChannel channel); unlockNotificationChannel(String pkg, int uid, String channelId)103 void unlockNotificationChannel(String pkg, int uid, String channelId); unlockAllNotificationChannels()104 void unlockAllNotificationChannels(); getNotificationChannel(String callingPkg, int userId, String pkg, String channelId)105 NotificationChannel getNotificationChannel(String callingPkg, int userId, String pkg, String channelId); getConversationNotificationChannel(String callingPkg, int userId, String pkg, String channelId, boolean returnParentIfNoConversationChannel, String conversationId)106 NotificationChannel getConversationNotificationChannel(String callingPkg, int userId, String pkg, String channelId, boolean returnParentIfNoConversationChannel, String conversationId); createConversationNotificationChannelForPackage(String pkg, int uid, in NotificationChannel parentChannel, String conversationId)107 void createConversationNotificationChannelForPackage(String pkg, int uid, in NotificationChannel parentChannel, String conversationId); getNotificationChannelForPackage(String pkg, int uid, String channelId, String conversationId, boolean includeDeleted)108 NotificationChannel getNotificationChannelForPackage(String pkg, int uid, String channelId, String conversationId, boolean includeDeleted); deleteNotificationChannel(String pkg, String channelId)109 void deleteNotificationChannel(String pkg, String channelId); getNotificationChannels(String callingPkg, String targetPkg, int userId)110 ParceledListSlice getNotificationChannels(String callingPkg, String targetPkg, int userId); getNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted)111 ParceledListSlice getNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted); getNumNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted)112 int getNumNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted); getDeletedChannelCount(String pkg, int uid)113 int getDeletedChannelCount(String pkg, int uid); getBlockedChannelCount(String pkg, int uid)114 int getBlockedChannelCount(String pkg, int uid); deleteNotificationChannelGroup(String pkg, String channelGroupId)115 void deleteNotificationChannelGroup(String pkg, String channelGroupId); getNotificationChannelGroup(String pkg, String channelGroupId)116 NotificationChannelGroup getNotificationChannelGroup(String pkg, String channelGroupId); getNotificationChannelGroups(String pkg)117 ParceledListSlice getNotificationChannelGroups(String pkg); onlyHasDefaultChannel(String pkg, int uid)118 boolean onlyHasDefaultChannel(String pkg, int uid); areChannelsBypassingDnd()119 boolean areChannelsBypassingDnd(); getNotificationChannelsBypassingDnd(String pkg, int uid)120 ParceledListSlice getNotificationChannelsBypassingDnd(String pkg, int uid); isPackagePaused(String pkg)121 boolean isPackagePaused(String pkg); deleteNotificationHistoryItem(String pkg, int uid, long postedTime)122 void deleteNotificationHistoryItem(String pkg, int uid, long postedTime); isPermissionFixed(String pkg, int userId)123 boolean isPermissionFixed(String pkg, int userId); 124 silenceNotificationSound()125 void silenceNotificationSound(); 126 127 // TODO: Remove this when callers have been migrated to the equivalent 128 // INotificationListener method. 129 @UnsupportedAppUsage getActiveNotifications(String callingPkg)130 StatusBarNotification[] getActiveNotifications(String callingPkg); getActiveNotificationsWithAttribution(String callingPkg, String callingAttributionTag)131 StatusBarNotification[] getActiveNotificationsWithAttribution(String callingPkg, 132 String callingAttributionTag); 133 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) getHistoricalNotifications(String callingPkg, int count, boolean includeSnoozed)134 StatusBarNotification[] getHistoricalNotifications(String callingPkg, int count, boolean includeSnoozed); getHistoricalNotificationsWithAttribution(String callingPkg, String callingAttributionTag, int count, boolean includeSnoozed)135 StatusBarNotification[] getHistoricalNotificationsWithAttribution(String callingPkg, 136 String callingAttributionTag, int count, boolean includeSnoozed); 137 getNotificationHistory(String callingPkg, String callingAttributionTag)138 NotificationHistory getNotificationHistory(String callingPkg, String callingAttributionTag); 139 registerListener(in INotificationListener listener, in ComponentName component, int userid)140 void registerListener(in INotificationListener listener, in ComponentName component, int userid); unregisterListener(in INotificationListener listener, int userid)141 void unregisterListener(in INotificationListener listener, int userid); 142 cancelNotificationFromListener(in INotificationListener token, String pkg, String tag, int id)143 void cancelNotificationFromListener(in INotificationListener token, String pkg, String tag, int id); cancelNotificationsFromListener(in INotificationListener token, in String[] keys)144 void cancelNotificationsFromListener(in INotificationListener token, in String[] keys); 145 snoozeNotificationUntilContextFromListener(in INotificationListener token, String key, String snoozeCriterionId)146 void snoozeNotificationUntilContextFromListener(in INotificationListener token, String key, String snoozeCriterionId); snoozeNotificationUntilFromListener(in INotificationListener token, String key, long until)147 void snoozeNotificationUntilFromListener(in INotificationListener token, String key, long until); 148 requestBindListener(in ComponentName component)149 void requestBindListener(in ComponentName component); requestUnbindListener(in INotificationListener token)150 void requestUnbindListener(in INotificationListener token); requestUnbindListenerComponent(in ComponentName component)151 void requestUnbindListenerComponent(in ComponentName component); requestBindProvider(in ComponentName component)152 void requestBindProvider(in ComponentName component); requestUnbindProvider(in IConditionProvider token)153 void requestUnbindProvider(in IConditionProvider token); 154 setNotificationsShownFromListener(in INotificationListener token, in String[] keys)155 void setNotificationsShownFromListener(in INotificationListener token, in String[] keys); 156 getActiveNotificationsFromListener(in INotificationListener token, in String[] keys, int trim)157 ParceledListSlice getActiveNotificationsFromListener(in INotificationListener token, in String[] keys, int trim); getSnoozedNotificationsFromListener(in INotificationListener token, int trim)158 ParceledListSlice getSnoozedNotificationsFromListener(in INotificationListener token, int trim); clearRequestedListenerHints(in INotificationListener token)159 void clearRequestedListenerHints(in INotificationListener token); requestHintsFromListener(in INotificationListener token, int hints)160 void requestHintsFromListener(in INotificationListener token, int hints); getHintsFromListener(in INotificationListener token)161 int getHintsFromListener(in INotificationListener token); getHintsFromListenerNoToken()162 int getHintsFromListenerNoToken(); requestInterruptionFilterFromListener(in INotificationListener token, int interruptionFilter)163 void requestInterruptionFilterFromListener(in INotificationListener token, int interruptionFilter); getInterruptionFilterFromListener(in INotificationListener token)164 int getInterruptionFilterFromListener(in INotificationListener token); setOnNotificationPostedTrimFromListener(in INotificationListener token, int trim)165 void setOnNotificationPostedTrimFromListener(in INotificationListener token, int trim); setInterruptionFilter(String pkg, int interruptionFilter)166 void setInterruptionFilter(String pkg, int interruptionFilter); 167 updateNotificationChannelGroupFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user, in NotificationChannelGroup group)168 void updateNotificationChannelGroupFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user, in NotificationChannelGroup group); updateNotificationChannelFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user, in NotificationChannel channel)169 void updateNotificationChannelFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user, in NotificationChannel channel); getNotificationChannelsFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user)170 ParceledListSlice getNotificationChannelsFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user); getNotificationChannelGroupsFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user)171 ParceledListSlice getNotificationChannelGroupsFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user); 172 applyEnqueuedAdjustmentFromAssistant(in INotificationListener token, in Adjustment adjustment)173 void applyEnqueuedAdjustmentFromAssistant(in INotificationListener token, in Adjustment adjustment); applyAdjustmentFromAssistant(in INotificationListener token, in Adjustment adjustment)174 void applyAdjustmentFromAssistant(in INotificationListener token, in Adjustment adjustment); applyAdjustmentsFromAssistant(in INotificationListener token, in List<Adjustment> adjustments)175 void applyAdjustmentsFromAssistant(in INotificationListener token, in List<Adjustment> adjustments); unsnoozeNotificationFromAssistant(in INotificationListener token, String key)176 void unsnoozeNotificationFromAssistant(in INotificationListener token, String key); unsnoozeNotificationFromSystemListener(in INotificationListener token, String key)177 void unsnoozeNotificationFromSystemListener(in INotificationListener token, String key); 178 getEffectsSuppressor()179 ComponentName getEffectsSuppressor(); matchesCallFilter(in Bundle extras)180 boolean matchesCallFilter(in Bundle extras); cleanUpCallersAfter(long timeThreshold)181 void cleanUpCallersAfter(long timeThreshold); isSystemConditionProviderEnabled(String path)182 boolean isSystemConditionProviderEnabled(String path); 183 isNotificationListenerAccessGranted(in ComponentName listener)184 boolean isNotificationListenerAccessGranted(in ComponentName listener); isNotificationListenerAccessGrantedForUser(in ComponentName listener, int userId)185 boolean isNotificationListenerAccessGrantedForUser(in ComponentName listener, int userId); isNotificationAssistantAccessGranted(in ComponentName assistant)186 boolean isNotificationAssistantAccessGranted(in ComponentName assistant); setNotificationListenerAccessGranted(in ComponentName listener, boolean enabled, boolean userSet)187 void setNotificationListenerAccessGranted(in ComponentName listener, boolean enabled, boolean userSet); setNotificationAssistantAccessGranted(in ComponentName assistant, boolean enabled)188 void setNotificationAssistantAccessGranted(in ComponentName assistant, boolean enabled); setNotificationListenerAccessGrantedForUser(in ComponentName listener, int userId, boolean enabled, boolean userSet)189 void setNotificationListenerAccessGrantedForUser(in ComponentName listener, int userId, boolean enabled, boolean userSet); setNotificationAssistantAccessGrantedForUser(in ComponentName assistant, int userId, boolean enabled)190 void setNotificationAssistantAccessGrantedForUser(in ComponentName assistant, int userId, boolean enabled); getEnabledNotificationListenerPackages()191 List<String> getEnabledNotificationListenerPackages(); getEnabledNotificationListeners(int userId)192 List<ComponentName> getEnabledNotificationListeners(int userId); getAllowedNotificationAssistantForUser(int userId)193 ComponentName getAllowedNotificationAssistantForUser(int userId); getAllowedNotificationAssistant()194 ComponentName getAllowedNotificationAssistant(); getDefaultNotificationAssistant()195 ComponentName getDefaultNotificationAssistant(); setNASMigrationDoneAndResetDefault(int userId, boolean loadFromConfig)196 void setNASMigrationDoneAndResetDefault(int userId, boolean loadFromConfig); hasEnabledNotificationListener(String packageName, int userId)197 boolean hasEnabledNotificationListener(String packageName, int userId); 198 199 @UnsupportedAppUsage getZenMode()200 int getZenMode(); 201 @UnsupportedAppUsage getZenModeConfig()202 ZenModeConfig getZenModeConfig(); getConsolidatedNotificationPolicy()203 NotificationManager.Policy getConsolidatedNotificationPolicy(); setZenMode(int mode, in Uri conditionId, String reason)204 oneway void setZenMode(int mode, in Uri conditionId, String reason); notifyConditions(String pkg, in IConditionProvider provider, in Condition[] conditions)205 oneway void notifyConditions(String pkg, in IConditionProvider provider, in Condition[] conditions); isNotificationPolicyAccessGranted(String pkg)206 boolean isNotificationPolicyAccessGranted(String pkg); getNotificationPolicy(String pkg)207 NotificationManager.Policy getNotificationPolicy(String pkg); setNotificationPolicy(String pkg, in NotificationManager.Policy policy)208 void setNotificationPolicy(String pkg, in NotificationManager.Policy policy); isNotificationPolicyAccessGrantedForPackage(String pkg)209 boolean isNotificationPolicyAccessGrantedForPackage(String pkg); setNotificationPolicyAccessGranted(String pkg, boolean granted)210 void setNotificationPolicyAccessGranted(String pkg, boolean granted); setNotificationPolicyAccessGrantedForUser(String pkg, int userId, boolean granted)211 void setNotificationPolicyAccessGrantedForUser(String pkg, int userId, boolean granted); getAutomaticZenRule(String id)212 AutomaticZenRule getAutomaticZenRule(String id); getZenRules()213 List<ZenModeConfig.ZenRule> getZenRules(); addAutomaticZenRule(in AutomaticZenRule automaticZenRule, String pkg)214 String addAutomaticZenRule(in AutomaticZenRule automaticZenRule, String pkg); updateAutomaticZenRule(String id, in AutomaticZenRule automaticZenRule)215 boolean updateAutomaticZenRule(String id, in AutomaticZenRule automaticZenRule); removeAutomaticZenRule(String id)216 boolean removeAutomaticZenRule(String id); removeAutomaticZenRules(String packageName)217 boolean removeAutomaticZenRules(String packageName); getRuleInstanceCount(in ComponentName owner)218 int getRuleInstanceCount(in ComponentName owner); setAutomaticZenRuleState(String id, in Condition condition)219 void setAutomaticZenRuleState(String id, in Condition condition); 220 getBackupPayload(int user)221 byte[] getBackupPayload(int user); applyRestore(in byte[] payload, int user)222 void applyRestore(in byte[] payload, int user); 223 getAppActiveNotifications(String callingPkg, int userId)224 ParceledListSlice getAppActiveNotifications(String callingPkg, int userId); 225 setNotificationDelegate(String callingPkg, String delegate)226 void setNotificationDelegate(String callingPkg, String delegate); getNotificationDelegate(String callingPkg)227 String getNotificationDelegate(String callingPkg); canNotifyAsPackage(String callingPkg, String targetPkg, int userId)228 boolean canNotifyAsPackage(String callingPkg, String targetPkg, int userId); canUseFullScreenIntent(in AttributionSource attributionSource)229 boolean canUseFullScreenIntent(in AttributionSource attributionSource); 230 setPrivateNotificationsAllowed(boolean allow)231 void setPrivateNotificationsAllowed(boolean allow); getPrivateNotificationsAllowed()232 boolean getPrivateNotificationsAllowed(); 233 pullStats(long startNs, int report, boolean doAgg, out List<ParcelFileDescriptor> stats)234 long pullStats(long startNs, int report, boolean doAgg, out List<ParcelFileDescriptor> stats); 235 getListenerFilter(in ComponentName cn, int userId)236 NotificationListenerFilter getListenerFilter(in ComponentName cn, int userId); setListenerFilter(in ComponentName cn, int userId, in NotificationListenerFilter nlf)237 void setListenerFilter(in ComponentName cn, int userId, in NotificationListenerFilter nlf); migrateNotificationFilter(in INotificationListener token, int defaultTypes, in List<String> disallowedPkgs)238 void migrateNotificationFilter(in INotificationListener token, int defaultTypes, in List<String> disallowedPkgs); 239 240 @EnforcePermission("MANAGE_TOAST_RATE_LIMITING") setToastRateLimitingEnabled(boolean enable)241 void setToastRateLimitingEnabled(boolean enable); 242 } 243