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