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