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.StatusBarNotification; 39 import android.app.AutomaticZenRule; 40 import android.service.notification.ZenModeConfig; 41 42 /** {@hide} */ 43 interface INotificationManager 44 { 45 @UnsupportedAppUsage cancelAllNotifications(String pkg, int userId)46 void cancelAllNotifications(String pkg, int userId); 47 clearData(String pkg, int uid, boolean fromApp)48 void clearData(String pkg, int uid, boolean fromApp); enqueueTextToast(String pkg, IBinder token, CharSequence text, int duration, int displayId, @nullable ITransientNotificationCallback callback)49 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)50 void enqueueToast(String pkg, IBinder token, ITransientNotification callback, int duration, int displayId); cancelToast(String pkg, IBinder token)51 void cancelToast(String pkg, IBinder token); finishToken(String pkg, IBinder token)52 void finishToken(String pkg, IBinder token); 53 enqueueNotificationWithTag(String pkg, String opPkg, String tag, int id, in Notification notification, int userId)54 void enqueueNotificationWithTag(String pkg, String opPkg, String tag, int id, 55 in Notification notification, int userId); 56 @UnsupportedAppUsage cancelNotificationWithTag(String pkg, String opPkg, String tag, int id, int userId)57 void cancelNotificationWithTag(String pkg, String opPkg, String tag, int id, int userId); 58 setShowBadge(String pkg, int uid, boolean showBadge)59 void setShowBadge(String pkg, int uid, boolean showBadge); canShowBadge(String pkg, int uid)60 boolean canShowBadge(String pkg, int uid); hasSentValidMsg(String pkg, int uid)61 boolean hasSentValidMsg(String pkg, int uid); isInInvalidMsgState(String pkg, int uid)62 boolean isInInvalidMsgState(String pkg, int uid); hasUserDemotedInvalidMsgApp(String pkg, int uid)63 boolean hasUserDemotedInvalidMsgApp(String pkg, int uid); setInvalidMsgAppDemoted(String pkg, int uid, boolean isDemoted)64 void setInvalidMsgAppDemoted(String pkg, int uid, boolean isDemoted); setNotificationsEnabledForPackage(String pkg, int uid, boolean enabled)65 void setNotificationsEnabledForPackage(String pkg, int uid, boolean enabled); 66 /** 67 * Updates the notification's enabled state. Additionally locks importance for all of the 68 * notifications belonging to the app, such that future notifications aren't reconsidered for 69 * blocking helper. 70 */ setNotificationsEnabledWithImportanceLockForPackage(String pkg, int uid, boolean enabled)71 void setNotificationsEnabledWithImportanceLockForPackage(String pkg, int uid, boolean enabled); 72 73 @UnsupportedAppUsage areNotificationsEnabledForPackage(String pkg, int uid)74 boolean areNotificationsEnabledForPackage(String pkg, int uid); areNotificationsEnabled(String pkg)75 boolean areNotificationsEnabled(String pkg); getPackageImportance(String pkg)76 int getPackageImportance(String pkg); 77 getAllowedAssistantAdjustments(String pkg)78 List<String> getAllowedAssistantAdjustments(String pkg); allowAssistantAdjustment(String adjustmentType)79 void allowAssistantAdjustment(String adjustmentType); disallowAssistantAdjustment(String adjustmentType)80 void disallowAssistantAdjustment(String adjustmentType); 81 shouldHideSilentStatusIcons(String callingPkg)82 boolean shouldHideSilentStatusIcons(String callingPkg); setHideSilentStatusIcons(boolean hide)83 void setHideSilentStatusIcons(boolean hide); 84 setBubblesAllowed(String pkg, int uid, int bubblePreference)85 void setBubblesAllowed(String pkg, int uid, int bubblePreference); areBubblesAllowed(String pkg)86 boolean areBubblesAllowed(String pkg); getBubblePreferenceForPackage(String pkg, int uid)87 int getBubblePreferenceForPackage(String pkg, int uid); 88 createNotificationChannelGroups(String pkg, in ParceledListSlice channelGroupList)89 void createNotificationChannelGroups(String pkg, in ParceledListSlice channelGroupList); createNotificationChannels(String pkg, in ParceledListSlice channelsList)90 void createNotificationChannels(String pkg, in ParceledListSlice channelsList); createNotificationChannelsForPackage(String pkg, int uid, in ParceledListSlice channelsList)91 void createNotificationChannelsForPackage(String pkg, int uid, in ParceledListSlice channelsList); getConversations(boolean onlyImportant)92 ParceledListSlice getConversations(boolean onlyImportant); getConversationsForPackage(String pkg, int uid)93 ParceledListSlice getConversationsForPackage(String pkg, int uid); getNotificationChannelGroupsForPackage(String pkg, int uid, boolean includeDeleted)94 ParceledListSlice getNotificationChannelGroupsForPackage(String pkg, int uid, boolean includeDeleted); getNotificationChannelGroupForPackage(String groupId, String pkg, int uid)95 NotificationChannelGroup getNotificationChannelGroupForPackage(String groupId, String pkg, int uid); getPopulatedNotificationChannelGroupForPackage(String pkg, int uid, String groupId, boolean includeDeleted)96 NotificationChannelGroup getPopulatedNotificationChannelGroupForPackage(String pkg, int uid, String groupId, boolean includeDeleted); updateNotificationChannelGroupForPackage(String pkg, int uid, in NotificationChannelGroup group)97 void updateNotificationChannelGroupForPackage(String pkg, int uid, in NotificationChannelGroup group); updateNotificationChannelForPackage(String pkg, int uid, in NotificationChannel channel)98 void updateNotificationChannelForPackage(String pkg, int uid, in NotificationChannel channel); getNotificationChannel(String callingPkg, int userId, String pkg, String channelId)99 NotificationChannel getNotificationChannel(String callingPkg, int userId, String pkg, String channelId); getConversationNotificationChannel(String callingPkg, int userId, String pkg, String channelId, boolean returnParentIfNoConversationChannel, String conversationId)100 NotificationChannel getConversationNotificationChannel(String callingPkg, int userId, String pkg, String channelId, boolean returnParentIfNoConversationChannel, String conversationId); createConversationNotificationChannelForPackage(String pkg, int uid, String triggeringKey, in NotificationChannel parentChannel, String conversationId)101 void createConversationNotificationChannelForPackage(String pkg, int uid, String triggeringKey, in NotificationChannel parentChannel, String conversationId); getNotificationChannelForPackage(String pkg, int uid, String channelId, String conversationId, boolean includeDeleted)102 NotificationChannel getNotificationChannelForPackage(String pkg, int uid, String channelId, String conversationId, boolean includeDeleted); deleteNotificationChannel(String pkg, String channelId)103 void deleteNotificationChannel(String pkg, String channelId); deleteConversationNotificationChannels(String pkg, int uid, String conversationId)104 void deleteConversationNotificationChannels(String pkg, int uid, String conversationId); getNotificationChannels(String callingPkg, String targetPkg, int userId)105 ParceledListSlice getNotificationChannels(String callingPkg, String targetPkg, int userId); getNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted)106 ParceledListSlice getNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted); getNumNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted)107 int getNumNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted); getDeletedChannelCount(String pkg, int uid)108 int getDeletedChannelCount(String pkg, int uid); getBlockedChannelCount(String pkg, int uid)109 int getBlockedChannelCount(String pkg, int uid); deleteNotificationChannelGroup(String pkg, String channelGroupId)110 void deleteNotificationChannelGroup(String pkg, String channelGroupId); getNotificationChannelGroup(String pkg, String channelGroupId)111 NotificationChannelGroup getNotificationChannelGroup(String pkg, String channelGroupId); getNotificationChannelGroups(String pkg)112 ParceledListSlice getNotificationChannelGroups(String pkg); onlyHasDefaultChannel(String pkg, int uid)113 boolean onlyHasDefaultChannel(String pkg, int uid); getBlockedAppCount(int userId)114 int getBlockedAppCount(int userId); areChannelsBypassingDnd()115 boolean areChannelsBypassingDnd(); getAppsBypassingDndCount(int uid)116 int getAppsBypassingDndCount(int uid); getNotificationChannelsBypassingDnd(String pkg, int userId)117 ParceledListSlice getNotificationChannelsBypassingDnd(String pkg, int userId); isPackagePaused(String pkg)118 boolean isPackagePaused(String pkg); deleteNotificationHistoryItem(String pkg, int uid, long postedTime)119 void deleteNotificationHistoryItem(String pkg, int uid, long postedTime); 120 silenceNotificationSound()121 void silenceNotificationSound(); 122 123 // TODO: Remove this when callers have been migrated to the equivalent 124 // INotificationListener method. 125 @UnsupportedAppUsage getActiveNotifications(String callingPkg)126 StatusBarNotification[] getActiveNotifications(String callingPkg); getActiveNotificationsWithAttribution(String callingPkg, String callingAttributionTag)127 StatusBarNotification[] getActiveNotificationsWithAttribution(String callingPkg, 128 String callingAttributionTag); 129 @UnsupportedAppUsage getHistoricalNotifications(String callingPkg, int count, boolean includeSnoozed)130 StatusBarNotification[] getHistoricalNotifications(String callingPkg, int count, boolean includeSnoozed); getHistoricalNotificationsWithAttribution(String callingPkg, String callingAttributionTag, int count, boolean includeSnoozed)131 StatusBarNotification[] getHistoricalNotificationsWithAttribution(String callingPkg, 132 String callingAttributionTag, int count, boolean includeSnoozed); 133 getNotificationHistory(String callingPkg, String callingAttributionTag)134 NotificationHistory getNotificationHistory(String callingPkg, String callingAttributionTag); 135 registerListener(in INotificationListener listener, in ComponentName component, int userid)136 void registerListener(in INotificationListener listener, in ComponentName component, int userid); unregisterListener(in INotificationListener listener, int userid)137 void unregisterListener(in INotificationListener listener, int userid); 138 cancelNotificationFromListener(in INotificationListener token, String pkg, String tag, int id)139 void cancelNotificationFromListener(in INotificationListener token, String pkg, String tag, int id); cancelNotificationsFromListener(in INotificationListener token, in String[] keys)140 void cancelNotificationsFromListener(in INotificationListener token, in String[] keys); 141 snoozeNotificationUntilContextFromListener(in INotificationListener token, String key, String snoozeCriterionId)142 void snoozeNotificationUntilContextFromListener(in INotificationListener token, String key, String snoozeCriterionId); snoozeNotificationUntilFromListener(in INotificationListener token, String key, long until)143 void snoozeNotificationUntilFromListener(in INotificationListener token, String key, long until); 144 requestBindListener(in ComponentName component)145 void requestBindListener(in ComponentName component); requestUnbindListener(in INotificationListener token)146 void requestUnbindListener(in INotificationListener token); requestBindProvider(in ComponentName component)147 void requestBindProvider(in ComponentName component); requestUnbindProvider(in IConditionProvider token)148 void requestUnbindProvider(in IConditionProvider token); 149 setNotificationsShownFromListener(in INotificationListener token, in String[] keys)150 void setNotificationsShownFromListener(in INotificationListener token, in String[] keys); 151 getActiveNotificationsFromListener(in INotificationListener token, in String[] keys, int trim)152 ParceledListSlice getActiveNotificationsFromListener(in INotificationListener token, in String[] keys, int trim); getSnoozedNotificationsFromListener(in INotificationListener token, int trim)153 ParceledListSlice getSnoozedNotificationsFromListener(in INotificationListener token, int trim); clearRequestedListenerHints(in INotificationListener token)154 void clearRequestedListenerHints(in INotificationListener token); requestHintsFromListener(in INotificationListener token, int hints)155 void requestHintsFromListener(in INotificationListener token, int hints); getHintsFromListener(in INotificationListener token)156 int getHintsFromListener(in INotificationListener token); requestInterruptionFilterFromListener(in INotificationListener token, int interruptionFilter)157 void requestInterruptionFilterFromListener(in INotificationListener token, int interruptionFilter); getInterruptionFilterFromListener(in INotificationListener token)158 int getInterruptionFilterFromListener(in INotificationListener token); setOnNotificationPostedTrimFromListener(in INotificationListener token, int trim)159 void setOnNotificationPostedTrimFromListener(in INotificationListener token, int trim); setInterruptionFilter(String pkg, int interruptionFilter)160 void setInterruptionFilter(String pkg, int interruptionFilter); 161 updateNotificationChannelGroupFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user, in NotificationChannelGroup group)162 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)163 void updateNotificationChannelFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user, in NotificationChannel channel); getNotificationChannelsFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user)164 ParceledListSlice getNotificationChannelsFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user); getNotificationChannelGroupsFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user)165 ParceledListSlice getNotificationChannelGroupsFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user); 166 applyEnqueuedAdjustmentFromAssistant(in INotificationListener token, in Adjustment adjustment)167 void applyEnqueuedAdjustmentFromAssistant(in INotificationListener token, in Adjustment adjustment); applyAdjustmentFromAssistant(in INotificationListener token, in Adjustment adjustment)168 void applyAdjustmentFromAssistant(in INotificationListener token, in Adjustment adjustment); applyAdjustmentsFromAssistant(in INotificationListener token, in List<Adjustment> adjustments)169 void applyAdjustmentsFromAssistant(in INotificationListener token, in List<Adjustment> adjustments); unsnoozeNotificationFromAssistant(in INotificationListener token, String key)170 void unsnoozeNotificationFromAssistant(in INotificationListener token, String key); unsnoozeNotificationFromSystemListener(in INotificationListener token, String key)171 void unsnoozeNotificationFromSystemListener(in INotificationListener token, String key); 172 getEffectsSuppressor()173 ComponentName getEffectsSuppressor(); matchesCallFilter(in Bundle extras)174 boolean matchesCallFilter(in Bundle extras); isSystemConditionProviderEnabled(String path)175 boolean isSystemConditionProviderEnabled(String path); 176 isNotificationListenerAccessGranted(in ComponentName listener)177 boolean isNotificationListenerAccessGranted(in ComponentName listener); isNotificationListenerAccessGrantedForUser(in ComponentName listener, int userId)178 boolean isNotificationListenerAccessGrantedForUser(in ComponentName listener, int userId); isNotificationAssistantAccessGranted(in ComponentName assistant)179 boolean isNotificationAssistantAccessGranted(in ComponentName assistant); setNotificationListenerAccessGranted(in ComponentName listener, boolean enabled)180 void setNotificationListenerAccessGranted(in ComponentName listener, boolean enabled); setNotificationAssistantAccessGranted(in ComponentName assistant, boolean enabled)181 void setNotificationAssistantAccessGranted(in ComponentName assistant, boolean enabled); setNotificationListenerAccessGrantedForUser(in ComponentName listener, int userId, boolean enabled)182 void setNotificationListenerAccessGrantedForUser(in ComponentName listener, int userId, boolean enabled); setNotificationAssistantAccessGrantedForUser(in ComponentName assistant, int userId, boolean enabled)183 void setNotificationAssistantAccessGrantedForUser(in ComponentName assistant, int userId, boolean enabled); getEnabledNotificationListenerPackages()184 List<String> getEnabledNotificationListenerPackages(); getEnabledNotificationListeners(int userId)185 List<ComponentName> getEnabledNotificationListeners(int userId); getAllowedNotificationAssistantForUser(int userId)186 ComponentName getAllowedNotificationAssistantForUser(int userId); getAllowedNotificationAssistant()187 ComponentName getAllowedNotificationAssistant(); 188 189 @UnsupportedAppUsage getZenMode()190 int getZenMode(); 191 @UnsupportedAppUsage getZenModeConfig()192 ZenModeConfig getZenModeConfig(); getConsolidatedNotificationPolicy()193 NotificationManager.Policy getConsolidatedNotificationPolicy(); setZenMode(int mode, in Uri conditionId, String reason)194 oneway void setZenMode(int mode, in Uri conditionId, String reason); notifyConditions(String pkg, in IConditionProvider provider, in Condition[] conditions)195 oneway void notifyConditions(String pkg, in IConditionProvider provider, in Condition[] conditions); isNotificationPolicyAccessGranted(String pkg)196 boolean isNotificationPolicyAccessGranted(String pkg); getNotificationPolicy(String pkg)197 NotificationManager.Policy getNotificationPolicy(String pkg); setNotificationPolicy(String pkg, in NotificationManager.Policy policy)198 void setNotificationPolicy(String pkg, in NotificationManager.Policy policy); isNotificationPolicyAccessGrantedForPackage(String pkg)199 boolean isNotificationPolicyAccessGrantedForPackage(String pkg); setNotificationPolicyAccessGranted(String pkg, boolean granted)200 void setNotificationPolicyAccessGranted(String pkg, boolean granted); setNotificationPolicyAccessGrantedForUser(String pkg, int userId, boolean granted)201 void setNotificationPolicyAccessGrantedForUser(String pkg, int userId, boolean granted); getAutomaticZenRule(String id)202 AutomaticZenRule getAutomaticZenRule(String id); getZenRules()203 List<ZenModeConfig.ZenRule> getZenRules(); addAutomaticZenRule(in AutomaticZenRule automaticZenRule)204 String addAutomaticZenRule(in AutomaticZenRule automaticZenRule); updateAutomaticZenRule(String id, in AutomaticZenRule automaticZenRule)205 boolean updateAutomaticZenRule(String id, in AutomaticZenRule automaticZenRule); removeAutomaticZenRule(String id)206 boolean removeAutomaticZenRule(String id); removeAutomaticZenRules(String packageName)207 boolean removeAutomaticZenRules(String packageName); getRuleInstanceCount(in ComponentName owner)208 int getRuleInstanceCount(in ComponentName owner); setAutomaticZenRuleState(String id, in Condition condition)209 void setAutomaticZenRuleState(String id, in Condition condition); 210 getBackupPayload(int user)211 byte[] getBackupPayload(int user); applyRestore(in byte[] payload, int user)212 void applyRestore(in byte[] payload, int user); 213 getAppActiveNotifications(String callingPkg, int userId)214 ParceledListSlice getAppActiveNotifications(String callingPkg, int userId); 215 setNotificationDelegate(String callingPkg, String delegate)216 void setNotificationDelegate(String callingPkg, String delegate); getNotificationDelegate(String callingPkg)217 String getNotificationDelegate(String callingPkg); canNotifyAsPackage(String callingPkg, String targetPkg, int userId)218 boolean canNotifyAsPackage(String callingPkg, String targetPkg, int userId); 219 setPrivateNotificationsAllowed(boolean allow)220 void setPrivateNotificationsAllowed(boolean allow); getPrivateNotificationsAllowed()221 boolean getPrivateNotificationsAllowed(); 222 pullStats(long startNs, int report, boolean doAgg, out List<ParcelFileDescriptor> stats)223 long pullStats(long startNs, int report, boolean doAgg, out List<ParcelFileDescriptor> stats); 224 } 225