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