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.ComponentName; 28 import android.content.Intent; 29 import android.content.pm.ParceledListSlice; 30 import android.net.Uri; 31 import android.os.Bundle; 32 import android.os.UserHandle; 33 import android.service.notification.Adjustment; 34 import android.service.notification.Condition; 35 import android.service.notification.IConditionListener; 36 import android.service.notification.IConditionProvider; 37 import android.service.notification.INotificationListener; 38 import android.service.notification.NotificationListenerFilter; 39 import android.service.notification.StatusBarNotification; 40 import android.app.AutomaticZenRule; 41 import android.service.notification.ZenModeConfig; 42 43 /** {@hide} */ 44 interface INotificationManager 45 { 46 @UnsupportedAppUsage cancelAllNotifications(String pkg, int userId)47 void cancelAllNotifications(String pkg, int userId); 48 clearData(String pkg, int uid, boolean fromApp)49 void clearData(String pkg, int uid, boolean fromApp); enqueueTextToast(String pkg, IBinder token, CharSequence text, int duration, int displayId, @nullable ITransientNotificationCallback callback)50 void enqueueTextToast(String pkg, IBinder token, CharSequence text, int duration, int displayId, @nullable ITransientNotificationCallback callback); enqueueToast(String pkg, IBinder token, ITransientNotification callback, int duration, int displayId)51 void enqueueToast(String pkg, IBinder token, ITransientNotification callback, int duration, int displayId); cancelToast(String pkg, IBinder token)52 void cancelToast(String pkg, IBinder token); finishToken(String pkg, IBinder token)53 void finishToken(String pkg, IBinder token); 54 enqueueNotificationWithTag(String pkg, String opPkg, String tag, int id, in Notification notification, int userId)55 void enqueueNotificationWithTag(String pkg, String opPkg, String tag, int id, 56 in Notification notification, int userId); 57 @UnsupportedAppUsage cancelNotificationWithTag(String pkg, String opPkg, String tag, int id, int userId)58 void cancelNotificationWithTag(String pkg, String opPkg, String tag, int id, int userId); 59 isInCall(String pkg, int uid)60 boolean isInCall(String pkg, int uid); setShowBadge(String pkg, int uid, boolean showBadge)61 void setShowBadge(String pkg, int uid, boolean showBadge); canShowBadge(String pkg, int uid)62 boolean canShowBadge(String pkg, int uid); hasSentValidMsg(String pkg, int uid)63 boolean hasSentValidMsg(String pkg, int uid); isInInvalidMsgState(String pkg, int uid)64 boolean isInInvalidMsgState(String pkg, int uid); hasUserDemotedInvalidMsgApp(String pkg, int uid)65 boolean hasUserDemotedInvalidMsgApp(String pkg, int uid); setInvalidMsgAppDemoted(String pkg, int uid, boolean isDemoted)66 void setInvalidMsgAppDemoted(String pkg, int uid, boolean isDemoted); hasSentValidBubble(String pkg, int uid)67 boolean hasSentValidBubble(String pkg, int uid); setNotificationsEnabledForPackage(String pkg, int uid, boolean enabled)68 void setNotificationsEnabledForPackage(String pkg, int uid, boolean enabled); 69 /** 70 * Updates the notification's enabled state. Additionally locks importance for all of the 71 * notifications belonging to the app, such that future notifications aren't reconsidered for 72 * blocking helper. 73 */ setNotificationsEnabledWithImportanceLockForPackage(String pkg, int uid, boolean enabled)74 void setNotificationsEnabledWithImportanceLockForPackage(String pkg, int uid, boolean enabled); 75 76 @UnsupportedAppUsage areNotificationsEnabledForPackage(String pkg, int uid)77 boolean areNotificationsEnabledForPackage(String pkg, int uid); areNotificationsEnabled(String pkg)78 boolean areNotificationsEnabled(String pkg); getPackageImportance(String pkg)79 int getPackageImportance(String pkg); isImportanceLocked(String pkg, int uid)80 boolean isImportanceLocked(String pkg, int uid); 81 getAllowedAssistantAdjustments(String pkg)82 List<String> getAllowedAssistantAdjustments(String pkg); allowAssistantAdjustment(String adjustmentType)83 void allowAssistantAdjustment(String adjustmentType); disallowAssistantAdjustment(String adjustmentType)84 void disallowAssistantAdjustment(String adjustmentType); 85 shouldHideSilentStatusIcons(String callingPkg)86 boolean shouldHideSilentStatusIcons(String callingPkg); setHideSilentStatusIcons(boolean hide)87 void setHideSilentStatusIcons(boolean hide); 88 setBubblesAllowed(String pkg, int uid, int bubblePreference)89 void setBubblesAllowed(String pkg, int uid, int bubblePreference); areBubblesAllowed(String pkg)90 boolean areBubblesAllowed(String pkg); areBubblesEnabled(in UserHandle user)91 boolean areBubblesEnabled(in UserHandle user); getBubblePreferenceForPackage(String pkg, int uid)92 int getBubblePreferenceForPackage(String pkg, int uid); 93 createNotificationChannelGroups(String pkg, in ParceledListSlice channelGroupList)94 void createNotificationChannelGroups(String pkg, in ParceledListSlice channelGroupList); createNotificationChannels(String pkg, in ParceledListSlice channelsList)95 void createNotificationChannels(String pkg, in ParceledListSlice channelsList); createNotificationChannelsForPackage(String pkg, int uid, in ParceledListSlice channelsList)96 void createNotificationChannelsForPackage(String pkg, int uid, in ParceledListSlice channelsList); getConversations(boolean onlyImportant)97 ParceledListSlice getConversations(boolean onlyImportant); getConversationsForPackage(String pkg, int uid)98 ParceledListSlice getConversationsForPackage(String pkg, int uid); getNotificationChannelGroupsForPackage(String pkg, int uid, boolean includeDeleted)99 ParceledListSlice getNotificationChannelGroupsForPackage(String pkg, int uid, boolean includeDeleted); getNotificationChannelGroupForPackage(String groupId, String pkg, int uid)100 NotificationChannelGroup getNotificationChannelGroupForPackage(String groupId, String pkg, int uid); getPopulatedNotificationChannelGroupForPackage(String pkg, int uid, String groupId, boolean includeDeleted)101 NotificationChannelGroup getPopulatedNotificationChannelGroupForPackage(String pkg, int uid, String groupId, boolean includeDeleted); updateNotificationChannelGroupForPackage(String pkg, int uid, in NotificationChannelGroup group)102 void updateNotificationChannelGroupForPackage(String pkg, int uid, in NotificationChannelGroup group); updateNotificationChannelForPackage(String pkg, int uid, in NotificationChannel channel)103 void updateNotificationChannelForPackage(String pkg, int uid, in NotificationChannel channel); unlockNotificationChannel(String pkg, int uid, String channelId)104 void unlockNotificationChannel(String pkg, int uid, String channelId); unlockAllNotificationChannels()105 void unlockAllNotificationChannels(); getNotificationChannel(String callingPkg, int userId, String pkg, String channelId)106 NotificationChannel getNotificationChannel(String callingPkg, int userId, String pkg, String channelId); getConversationNotificationChannel(String callingPkg, int userId, String pkg, String channelId, boolean returnParentIfNoConversationChannel, String conversationId)107 NotificationChannel getConversationNotificationChannel(String callingPkg, int userId, String pkg, String channelId, boolean returnParentIfNoConversationChannel, String conversationId); createConversationNotificationChannelForPackage(String pkg, int uid, in NotificationChannel parentChannel, String conversationId)108 void createConversationNotificationChannelForPackage(String pkg, int uid, in NotificationChannel parentChannel, String conversationId); getNotificationChannelForPackage(String pkg, int uid, String channelId, String conversationId, boolean includeDeleted)109 NotificationChannel getNotificationChannelForPackage(String pkg, int uid, String channelId, String conversationId, boolean includeDeleted); deleteNotificationChannel(String pkg, String channelId)110 void deleteNotificationChannel(String pkg, String channelId); getNotificationChannels(String callingPkg, String targetPkg, int userId)111 ParceledListSlice getNotificationChannels(String callingPkg, String targetPkg, int userId); getNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted)112 ParceledListSlice getNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted); getNumNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted)113 int getNumNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted); getDeletedChannelCount(String pkg, int uid)114 int getDeletedChannelCount(String pkg, int uid); getBlockedChannelCount(String pkg, int uid)115 int getBlockedChannelCount(String pkg, int uid); deleteNotificationChannelGroup(String pkg, String channelGroupId)116 void deleteNotificationChannelGroup(String pkg, String channelGroupId); getNotificationChannelGroup(String pkg, String channelGroupId)117 NotificationChannelGroup getNotificationChannelGroup(String pkg, String channelGroupId); getNotificationChannelGroups(String pkg)118 ParceledListSlice getNotificationChannelGroups(String pkg); onlyHasDefaultChannel(String pkg, int uid)119 boolean onlyHasDefaultChannel(String pkg, int uid); areChannelsBypassingDnd()120 boolean areChannelsBypassingDnd(); getNotificationChannelsBypassingDnd(String pkg, int uid)121 ParceledListSlice getNotificationChannelsBypassingDnd(String pkg, int uid); isPackagePaused(String pkg)122 boolean isPackagePaused(String pkg); deleteNotificationHistoryItem(String pkg, int uid, long postedTime)123 void deleteNotificationHistoryItem(String pkg, int uid, long postedTime); isPermissionFixed(String pkg, int userId)124 boolean isPermissionFixed(String pkg, int userId); 125 silenceNotificationSound()126 void silenceNotificationSound(); 127 128 // TODO: Remove this when callers have been migrated to the equivalent 129 // INotificationListener method. 130 @UnsupportedAppUsage getActiveNotifications(String callingPkg)131 StatusBarNotification[] getActiveNotifications(String callingPkg); getActiveNotificationsWithAttribution(String callingPkg, String callingAttributionTag)132 StatusBarNotification[] getActiveNotificationsWithAttribution(String callingPkg, 133 String callingAttributionTag); 134 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) getHistoricalNotifications(String callingPkg, int count, boolean includeSnoozed)135 StatusBarNotification[] getHistoricalNotifications(String callingPkg, int count, boolean includeSnoozed); getHistoricalNotificationsWithAttribution(String callingPkg, String callingAttributionTag, int count, boolean includeSnoozed)136 StatusBarNotification[] getHistoricalNotificationsWithAttribution(String callingPkg, 137 String callingAttributionTag, int count, boolean includeSnoozed); 138 getNotificationHistory(String callingPkg, String callingAttributionTag)139 NotificationHistory getNotificationHistory(String callingPkg, String callingAttributionTag); 140 registerListener(in INotificationListener listener, in ComponentName component, int userid)141 void registerListener(in INotificationListener listener, in ComponentName component, int userid); unregisterListener(in INotificationListener listener, int userid)142 void unregisterListener(in INotificationListener listener, int userid); 143 cancelNotificationFromListener(in INotificationListener token, String pkg, String tag, int id)144 void cancelNotificationFromListener(in INotificationListener token, String pkg, String tag, int id); cancelNotificationsFromListener(in INotificationListener token, in String[] keys)145 void cancelNotificationsFromListener(in INotificationListener token, in String[] keys); 146 snoozeNotificationUntilContextFromListener(in INotificationListener token, String key, String snoozeCriterionId)147 void snoozeNotificationUntilContextFromListener(in INotificationListener token, String key, String snoozeCriterionId); snoozeNotificationUntilFromListener(in INotificationListener token, String key, long until)148 void snoozeNotificationUntilFromListener(in INotificationListener token, String key, long until); 149 requestBindListener(in ComponentName component)150 void requestBindListener(in ComponentName component); requestUnbindListener(in INotificationListener token)151 void requestUnbindListener(in INotificationListener token); 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); 229 setPrivateNotificationsAllowed(boolean allow)230 void setPrivateNotificationsAllowed(boolean allow); getPrivateNotificationsAllowed()231 boolean getPrivateNotificationsAllowed(); 232 pullStats(long startNs, int report, boolean doAgg, out List<ParcelFileDescriptor> stats)233 long pullStats(long startNs, int report, boolean doAgg, out List<ParcelFileDescriptor> stats); 234 getListenerFilter(in ComponentName cn, int userId)235 NotificationListenerFilter getListenerFilter(in ComponentName cn, int userId); setListenerFilter(in ComponentName cn, int userId, in NotificationListenerFilter nlf)236 void setListenerFilter(in ComponentName cn, int userId, in NotificationListenerFilter nlf); migrateNotificationFilter(in INotificationListener token, int defaultTypes, in List<String> disallowedPkgs)237 void migrateNotificationFilter(in INotificationListener token, int defaultTypes, in List<String> disallowedPkgs); 238 setToastRateLimitingEnabled(boolean enable)239 void setToastRateLimitingEnabled(boolean enable); 240 } 241