1 /* 2 * Copyright (C) 2014 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.app.NotificationChannel; 21 import android.app.NotificationChannelGroup; 22 import android.service.notification.DeviceEffectsApplier; 23 24 import java.util.Set; 25 26 public interface NotificationManagerInternal { getNotificationChannel(String pkg, int uid, String channelId)27 NotificationChannel getNotificationChannel(String pkg, int uid, String channelId); getNotificationChannelGroup(String pkg, int uid, String channelId)28 NotificationChannelGroup getNotificationChannelGroup(String pkg, int uid, String channelId); enqueueNotification(String pkg, String basePkg, int callingUid, int callingPid, String tag, int id, Notification notification, int userId)29 void enqueueNotification(String pkg, String basePkg, int callingUid, int callingPid, 30 String tag, int id, Notification notification, int userId); enqueueNotification(String pkg, String basePkg, int callingUid, int callingPid, String tag, int id, Notification notification, int userId, boolean byForegroundService)31 void enqueueNotification(String pkg, String basePkg, int callingUid, int callingPid, 32 String tag, int id, Notification notification, int userId, 33 boolean byForegroundService); cancelNotification(String pkg, String basePkg, int callingUid, int callingPid, String tag, int id, int userId)34 void cancelNotification(String pkg, String basePkg, int callingUid, int callingPid, 35 String tag, int id, int userId); 36 37 /** is the given notification currently showing? */ isNotificationShown(String pkg, String tag, int notificationId, int userId)38 boolean isNotificationShown(String pkg, String tag, int notificationId, int userId); 39 removeForegroundServiceFlagFromNotification(String pkg, int notificationId, int userId)40 void removeForegroundServiceFlagFromNotification(String pkg, int notificationId, int userId); 41 removeUserInitiatedJobFlagFromNotification(String pkg, int notificationId, int userId)42 void removeUserInitiatedJobFlagFromNotification(String pkg, int notificationId, int userId); 43 onConversationRemoved(String pkg, int uid, Set<String> shortcuts)44 void onConversationRemoved(String pkg, int uid, Set<String> shortcuts); 45 46 /** Get the number of notification channels for a given package */ getNumNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted)47 int getNumNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted); 48 49 /** Does the specified package/uid have permission to post notifications? */ areNotificationsEnabledForPackage(String pkg, int uid)50 boolean areNotificationsEnabledForPackage(String pkg, int uid); 51 52 /** Send a notification to the user prompting them to review their notification permissions. */ sendReviewPermissionsNotification()53 void sendReviewPermissionsNotification(); 54 cleanupHistoryFiles()55 void cleanupHistoryFiles(); 56 removeBitmaps()57 void removeBitmaps(); 58 59 /** 60 * Sets the {@link DeviceEffectsApplier} that will be used to apply the different 61 * {@link android.service.notification.ZenDeviceEffects} that are relevant for the platform 62 * when {@link android.service.notification.ZenModeConfig.ZenRule} instances are activated and 63 * deactivated. 64 * 65 * <p>This method is optional and needs only be called if the platform supports non-standard 66 * effects (i.e. any that are not <em>public APIs</em> in 67 * {@link android.service.notification.ZenDeviceEffects}, or if they must be applied in a 68 * non-standard fashion. If not used, a {@link DefaultDeviceEffectsApplier} will be invoked, 69 * which should be sufficient for most devices. 70 * 71 * <p>If this method is called, it <em>must</em> be during system startup and <em>before</em> 72 * the {@link com.android.server.SystemService#PHASE_THIRD_PARTY_APPS_CAN_START} boot phase. 73 * Otherwise an {@link IllegalStateException} will be thrown. 74 */ setDeviceEffectsApplier(DeviceEffectsApplier applier)75 void setDeviceEffectsApplier(DeviceEffectsApplier applier); 76 } 77