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