1 /** 2 * Copyright (c) 2013, The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.server.notification; 18 19 import android.app.Notification; 20 import android.net.Uri; 21 import android.os.Bundle; 22 import android.os.UserHandle; 23 import android.service.notification.NotificationStats; 24 25 import com.android.internal.statusbar.NotificationVisibility; 26 27 public interface NotificationDelegate { onSetDisabled(int status)28 void onSetDisabled(int status); onClearAll(int callingUid, int callingPid, int userId)29 void onClearAll(int callingUid, int callingPid, int userId); onNotificationClick(int callingUid, int callingPid, String key, NotificationVisibility nv)30 void onNotificationClick(int callingUid, int callingPid, String key, 31 NotificationVisibility nv); onNotificationActionClick(int callingUid, int callingPid, String key, int actionIndex, Notification.Action action, NotificationVisibility nv, boolean generatedByAssistant)32 void onNotificationActionClick(int callingUid, int callingPid, String key, int actionIndex, 33 Notification.Action action, NotificationVisibility nv, boolean generatedByAssistant); onNotificationClear(int callingUid, int callingPid, String pkg, int userId, String key, @NotificationStats.DismissalSurface int dismissalSurface, @NotificationStats.DismissalSentiment int dismissalSentiment, NotificationVisibility nv)34 void onNotificationClear(int callingUid, int callingPid, 35 String pkg, int userId, String key, 36 @NotificationStats.DismissalSurface int dismissalSurface, 37 @NotificationStats.DismissalSentiment int dismissalSentiment, 38 NotificationVisibility nv); onNotificationError(int callingUid, int callingPid, String pkg, String tag, int id, int uid, int initialPid, String message, int userId)39 void onNotificationError(int callingUid, int callingPid, 40 String pkg, String tag, int id, 41 int uid, int initialPid, String message, int userId); onPanelRevealed(boolean clearEffects, int numItems)42 void onPanelRevealed(boolean clearEffects, int numItems); onPanelHidden()43 void onPanelHidden(); clearEffects()44 void clearEffects(); onNotificationVisibilityChanged( NotificationVisibility[] newlyVisibleKeys, NotificationVisibility[] noLongerVisibleKeys)45 void onNotificationVisibilityChanged( 46 NotificationVisibility[] newlyVisibleKeys, 47 NotificationVisibility[] noLongerVisibleKeys); onNotificationExpansionChanged(String key, boolean userAction, boolean expanded, int notificationLocation)48 void onNotificationExpansionChanged(String key, boolean userAction, boolean expanded, 49 int notificationLocation); onNotificationDirectReplied(String key)50 void onNotificationDirectReplied(String key); onNotificationSettingsViewed(String key)51 void onNotificationSettingsViewed(String key); 52 /** 53 * Called when the state of {@link Notification#FLAG_BUBBLE} is changed. 54 * 55 * @param key the notification key 56 * @param isBubble whether the notification should have {@link Notification#FLAG_BUBBLE} applied 57 * @param flags the flags to apply to the notification's {@link Notification.BubbleMetadata} 58 */ onNotificationBubbleChanged(String key, boolean isBubble, int flags)59 void onNotificationBubbleChanged(String key, boolean isBubble, int flags); 60 /** 61 * Called when the flags on {@link Notification.BubbleMetadata} are changed. 62 */ onBubbleMetadataFlagChanged(String key, int flags)63 void onBubbleMetadataFlagChanged(String key, int flags); 64 65 /** 66 * Grant permission to read the specified URI to the package associated with the 67 * NotificationRecord associated with the given key. 68 */ grantInlineReplyUriPermission(String key, Uri uri, UserHandle user, String packageName, int callingUid)69 void grantInlineReplyUriPermission(String key, Uri uri, UserHandle user, String packageName, 70 int callingUid); 71 72 /** 73 * Clear inline URI grants associated with the given notification. 74 */ clearInlineReplyUriPermissions(String key, int callingUid)75 void clearInlineReplyUriPermissions(String key, int callingUid); 76 77 /** 78 * Notifies that smart replies and actions have been added to the UI. 79 */ onNotificationSmartSuggestionsAdded(String key, int smartReplyCount, int smartActionCount, boolean generatedByAssistant, boolean editBeforeSending)80 void onNotificationSmartSuggestionsAdded(String key, int smartReplyCount, int smartActionCount, 81 boolean generatedByAssistant, boolean editBeforeSending); 82 83 /** 84 * Notifies a smart reply is sent. 85 * 86 * @param key the notification key 87 * @param clickedIndex the index of clicked reply 88 * @param reply the reply that is sent 89 * @param notificationLocation the location of the notification containing the smart reply 90 * @param modifiedBeforeSending whether the user changed the smart reply before sending 91 */ onNotificationSmartReplySent(String key, int clickedIndex, CharSequence reply, int notificationLocation, boolean modifiedBeforeSending)92 void onNotificationSmartReplySent(String key, int clickedIndex, CharSequence reply, 93 int notificationLocation, boolean modifiedBeforeSending); 94 95 /** 96 * Notifies a user feedback is provided. 97 * 98 * @param key the notification key 99 * @param feedback the feedback detail 100 */ onNotificationFeedbackReceived(String key, Bundle feedback)101 void onNotificationFeedbackReceived(String key, Bundle feedback); 102 prepareForPossibleShutdown()103 void prepareForPossibleShutdown(); 104 } 105