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.Notification;
22 import android.app.NotificationChannel;
23 import android.app.NotificationChannelGroup;
24 import android.app.NotificationManager;
25 import android.content.ComponentName;
26 import android.content.Intent;
27 import android.content.pm.ParceledListSlice;
28 import android.net.Uri;
29 import android.os.Bundle;
30 import android.os.UserHandle;
31 import android.service.notification.Adjustment;
32 import android.service.notification.Condition;
33 import android.service.notification.IConditionListener;
34 import android.service.notification.IConditionProvider;
35 import android.service.notification.INotificationListener;
36 import android.service.notification.StatusBarNotification;
37 import android.app.AutomaticZenRule;
38 import android.service.notification.ZenModeConfig;
39 
40 /** {@hide} */
41 interface INotificationManager
42 {
cancelAllNotifications(String pkg, int userId)43     void cancelAllNotifications(String pkg, int userId);
44 
clearData(String pkg, int uid, boolean fromApp)45     void clearData(String pkg, int uid, boolean fromApp);
enqueueToast(String pkg, ITransientNotification callback, int duration)46     void enqueueToast(String pkg, ITransientNotification callback, int duration);
cancelToast(String pkg, ITransientNotification callback)47     void cancelToast(String pkg, ITransientNotification callback);
finishToken(String pkg, ITransientNotification callback)48     void finishToken(String pkg, ITransientNotification callback);
49 
enqueueNotificationWithTag(String pkg, String opPkg, String tag, int id, in Notification notification, int userId)50     void enqueueNotificationWithTag(String pkg, String opPkg, String tag, int id,
51             in Notification notification, int userId);
cancelNotificationWithTag(String pkg, String tag, int id, int userId)52     void cancelNotificationWithTag(String pkg, String tag, int id, int userId);
53 
setShowBadge(String pkg, int uid, boolean showBadge)54     void setShowBadge(String pkg, int uid, boolean showBadge);
canShowBadge(String pkg, int uid)55     boolean canShowBadge(String pkg, int uid);
setNotificationsEnabledForPackage(String pkg, int uid, boolean enabled)56     void setNotificationsEnabledForPackage(String pkg, int uid, boolean enabled);
57     /**
58      * Updates the notification's enabled state. Additionally locks importance for all of the
59      * notifications belonging to the app, such that future notifications aren't reconsidered for
60      * blocking helper.
61      */
setNotificationsEnabledWithImportanceLockForPackage(String pkg, int uid, boolean enabled)62     void setNotificationsEnabledWithImportanceLockForPackage(String pkg, int uid, boolean enabled);
63 
areNotificationsEnabledForPackage(String pkg, int uid)64     boolean areNotificationsEnabledForPackage(String pkg, int uid);
areNotificationsEnabled(String pkg)65     boolean areNotificationsEnabled(String pkg);
getPackageImportance(String pkg)66     int getPackageImportance(String pkg);
67 
createNotificationChannelGroups(String pkg, in ParceledListSlice channelGroupList)68     void createNotificationChannelGroups(String pkg, in ParceledListSlice channelGroupList);
createNotificationChannels(String pkg, in ParceledListSlice channelsList)69     void createNotificationChannels(String pkg, in ParceledListSlice channelsList);
createNotificationChannelsForPackage(String pkg, int uid, in ParceledListSlice channelsList)70     void createNotificationChannelsForPackage(String pkg, int uid, in ParceledListSlice channelsList);
getNotificationChannelGroupsForPackage(String pkg, int uid, boolean includeDeleted)71     ParceledListSlice getNotificationChannelGroupsForPackage(String pkg, int uid, boolean includeDeleted);
getNotificationChannelGroupForPackage(String groupId, String pkg, int uid)72     NotificationChannelGroup getNotificationChannelGroupForPackage(String groupId, String pkg, int uid);
getPopulatedNotificationChannelGroupForPackage(String pkg, int uid, String groupId, boolean includeDeleted)73     NotificationChannelGroup getPopulatedNotificationChannelGroupForPackage(String pkg, int uid, String groupId, boolean includeDeleted);
updateNotificationChannelGroupForPackage(String pkg, int uid, in NotificationChannelGroup group)74     void updateNotificationChannelGroupForPackage(String pkg, int uid, in NotificationChannelGroup group);
updateNotificationChannelForPackage(String pkg, int uid, in NotificationChannel channel)75     void updateNotificationChannelForPackage(String pkg, int uid, in NotificationChannel channel);
getNotificationChannel(String pkg, String channelId)76     NotificationChannel getNotificationChannel(String pkg, String channelId);
getNotificationChannelForPackage(String pkg, int uid, String channelId, boolean includeDeleted)77     NotificationChannel getNotificationChannelForPackage(String pkg, int uid, String channelId, boolean includeDeleted);
deleteNotificationChannel(String pkg, String channelId)78     void deleteNotificationChannel(String pkg, String channelId);
getNotificationChannels(String pkg)79     ParceledListSlice getNotificationChannels(String pkg);
getNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted)80     ParceledListSlice getNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted);
getNumNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted)81     int getNumNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted);
getDeletedChannelCount(String pkg, int uid)82     int getDeletedChannelCount(String pkg, int uid);
getBlockedChannelCount(String pkg, int uid)83     int getBlockedChannelCount(String pkg, int uid);
deleteNotificationChannelGroup(String pkg, String channelGroupId)84     void deleteNotificationChannelGroup(String pkg, String channelGroupId);
getNotificationChannelGroup(String pkg, String channelGroupId)85     NotificationChannelGroup getNotificationChannelGroup(String pkg, String channelGroupId);
getNotificationChannelGroups(String pkg)86     ParceledListSlice getNotificationChannelGroups(String pkg);
onlyHasDefaultChannel(String pkg, int uid)87     boolean onlyHasDefaultChannel(String pkg, int uid);
getRecentNotifyingAppsForUser(int userId)88     ParceledListSlice getRecentNotifyingAppsForUser(int userId);
getBlockedAppCount(int userId)89     int getBlockedAppCount(int userId);
areChannelsBypassingDnd()90     boolean areChannelsBypassingDnd();
91 
92     // TODO: Remove this when callers have been migrated to the equivalent
93     // INotificationListener method.
getActiveNotifications(String callingPkg)94     StatusBarNotification[] getActiveNotifications(String callingPkg);
getHistoricalNotifications(String callingPkg, int count)95     StatusBarNotification[] getHistoricalNotifications(String callingPkg, int count);
96 
registerListener(in INotificationListener listener, in ComponentName component, int userid)97     void registerListener(in INotificationListener listener, in ComponentName component, int userid);
unregisterListener(in INotificationListener listener, int userid)98     void unregisterListener(in INotificationListener listener, int userid);
99 
cancelNotificationFromListener(in INotificationListener token, String pkg, String tag, int id)100     void cancelNotificationFromListener(in INotificationListener token, String pkg, String tag, int id);
cancelNotificationsFromListener(in INotificationListener token, in String[] keys)101     void cancelNotificationsFromListener(in INotificationListener token, in String[] keys);
102 
snoozeNotificationUntilContextFromListener(in INotificationListener token, String key, String snoozeCriterionId)103     void snoozeNotificationUntilContextFromListener(in INotificationListener token, String key, String snoozeCriterionId);
snoozeNotificationUntilFromListener(in INotificationListener token, String key, long until)104     void snoozeNotificationUntilFromListener(in INotificationListener token, String key, long until);
105 
requestBindListener(in ComponentName component)106     void requestBindListener(in ComponentName component);
requestUnbindListener(in INotificationListener token)107     void requestUnbindListener(in INotificationListener token);
requestBindProvider(in ComponentName component)108     void requestBindProvider(in ComponentName component);
requestUnbindProvider(in IConditionProvider token)109     void requestUnbindProvider(in IConditionProvider token);
110 
setNotificationsShownFromListener(in INotificationListener token, in String[] keys)111     void setNotificationsShownFromListener(in INotificationListener token, in String[] keys);
112 
getActiveNotificationsFromListener(in INotificationListener token, in String[] keys, int trim)113     ParceledListSlice getActiveNotificationsFromListener(in INotificationListener token, in String[] keys, int trim);
getSnoozedNotificationsFromListener(in INotificationListener token, int trim)114     ParceledListSlice getSnoozedNotificationsFromListener(in INotificationListener token, int trim);
requestHintsFromListener(in INotificationListener token, int hints)115     void requestHintsFromListener(in INotificationListener token, int hints);
getHintsFromListener(in INotificationListener token)116     int getHintsFromListener(in INotificationListener token);
requestInterruptionFilterFromListener(in INotificationListener token, int interruptionFilter)117     void requestInterruptionFilterFromListener(in INotificationListener token, int interruptionFilter);
getInterruptionFilterFromListener(in INotificationListener token)118     int getInterruptionFilterFromListener(in INotificationListener token);
setOnNotificationPostedTrimFromListener(in INotificationListener token, int trim)119     void setOnNotificationPostedTrimFromListener(in INotificationListener token, int trim);
setInterruptionFilter(String pkg, int interruptionFilter)120     void setInterruptionFilter(String pkg, int interruptionFilter);
121 
updateNotificationChannelGroupFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user, in NotificationChannelGroup group)122     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)123     void updateNotificationChannelFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user, in NotificationChannel channel);
getNotificationChannelsFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user)124     ParceledListSlice getNotificationChannelsFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user);
getNotificationChannelGroupsFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user)125     ParceledListSlice getNotificationChannelGroupsFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user);
126 
applyEnqueuedAdjustmentFromAssistant(in INotificationListener token, in Adjustment adjustment)127     void applyEnqueuedAdjustmentFromAssistant(in INotificationListener token, in Adjustment adjustment);
applyAdjustmentFromAssistant(in INotificationListener token, in Adjustment adjustment)128     void applyAdjustmentFromAssistant(in INotificationListener token, in Adjustment adjustment);
applyAdjustmentsFromAssistant(in INotificationListener token, in List<Adjustment> adjustments)129     void applyAdjustmentsFromAssistant(in INotificationListener token, in List<Adjustment> adjustments);
unsnoozeNotificationFromAssistant(in INotificationListener token, String key)130     void unsnoozeNotificationFromAssistant(in INotificationListener token, String key);
131 
getEffectsSuppressor()132     ComponentName getEffectsSuppressor();
matchesCallFilter(in Bundle extras)133     boolean matchesCallFilter(in Bundle extras);
isSystemConditionProviderEnabled(String path)134     boolean isSystemConditionProviderEnabled(String path);
135 
isNotificationListenerAccessGranted(in ComponentName listener)136     boolean isNotificationListenerAccessGranted(in ComponentName listener);
isNotificationListenerAccessGrantedForUser(in ComponentName listener, int userId)137     boolean isNotificationListenerAccessGrantedForUser(in ComponentName listener, int userId);
isNotificationAssistantAccessGranted(in ComponentName assistant)138     boolean isNotificationAssistantAccessGranted(in ComponentName assistant);
setNotificationListenerAccessGranted(in ComponentName listener, boolean enabled)139     void setNotificationListenerAccessGranted(in ComponentName listener, boolean enabled);
setNotificationAssistantAccessGranted(in ComponentName assistant, boolean enabled)140     void setNotificationAssistantAccessGranted(in ComponentName assistant, boolean enabled);
setNotificationListenerAccessGrantedForUser(in ComponentName listener, int userId, boolean enabled)141     void setNotificationListenerAccessGrantedForUser(in ComponentName listener, int userId, boolean enabled);
setNotificationAssistantAccessGrantedForUser(in ComponentName assistant, int userId, boolean enabled)142     void setNotificationAssistantAccessGrantedForUser(in ComponentName assistant, int userId, boolean enabled);
getEnabledNotificationListenerPackages()143     List<String> getEnabledNotificationListenerPackages();
getEnabledNotificationListeners(int userId)144     List<ComponentName> getEnabledNotificationListeners(int userId);
145 
getZenMode()146     int getZenMode();
getZenModeConfig()147     ZenModeConfig getZenModeConfig();
setZenMode(int mode, in Uri conditionId, String reason)148     oneway void setZenMode(int mode, in Uri conditionId, String reason);
notifyConditions(String pkg, in IConditionProvider provider, in Condition[] conditions)149     oneway void notifyConditions(String pkg, in IConditionProvider provider, in Condition[] conditions);
isNotificationPolicyAccessGranted(String pkg)150     boolean isNotificationPolicyAccessGranted(String pkg);
getNotificationPolicy(String pkg)151     NotificationManager.Policy getNotificationPolicy(String pkg);
setNotificationPolicy(String pkg, in NotificationManager.Policy policy)152     void setNotificationPolicy(String pkg, in NotificationManager.Policy policy);
isNotificationPolicyAccessGrantedForPackage(String pkg)153     boolean isNotificationPolicyAccessGrantedForPackage(String pkg);
setNotificationPolicyAccessGranted(String pkg, boolean granted)154     void setNotificationPolicyAccessGranted(String pkg, boolean granted);
setNotificationPolicyAccessGrantedForUser(String pkg, int userId, boolean granted)155     void setNotificationPolicyAccessGrantedForUser(String pkg, int userId, boolean granted);
getAutomaticZenRule(String id)156     AutomaticZenRule getAutomaticZenRule(String id);
getZenRules()157     List<ZenModeConfig.ZenRule> getZenRules();
addAutomaticZenRule(in AutomaticZenRule automaticZenRule)158     String addAutomaticZenRule(in AutomaticZenRule automaticZenRule);
updateAutomaticZenRule(String id, in AutomaticZenRule automaticZenRule)159     boolean updateAutomaticZenRule(String id, in AutomaticZenRule automaticZenRule);
removeAutomaticZenRule(String id)160     boolean removeAutomaticZenRule(String id);
removeAutomaticZenRules(String packageName)161     boolean removeAutomaticZenRules(String packageName);
getRuleInstanceCount(in ComponentName owner)162     int getRuleInstanceCount(in ComponentName owner);
163 
getBackupPayload(int user)164     byte[] getBackupPayload(int user);
applyRestore(in byte[] payload, int user)165     void applyRestore(in byte[] payload, int user);
166 
getAppActiveNotifications(String callingPkg, int userId)167     ParceledListSlice getAppActiveNotifications(String callingPkg, int userId);
168 }
169