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