1 /* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file 5 * except in compliance with the License. You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software distributed under the 10 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 11 * KIND, either express or implied. See the License for the specific language governing 12 * permissions and limitations under the License. 13 */ 14 15 package com.android.systemui; 16 17 import android.annotation.Nullable; 18 import android.service.notification.StatusBarNotification; 19 import android.util.ArraySet; 20 21 public interface ForegroundServiceController { 22 /** 23 * @param sbn notification that was just posted 24 * @param importance 25 */ 26 void addNotification(StatusBarNotification sbn, int importance); 27 28 /** 29 * @param sbn notification that was just changed in some way 30 * @param newImportance 31 */ 32 void updateNotification(StatusBarNotification sbn, int newImportance); 33 34 /** 35 * @param sbn notification that was just canceled 36 */ 37 boolean removeNotification(StatusBarNotification sbn); 38 39 /** 40 * @param userId 41 * @return true if this user has services missing notifications and therefore needs a 42 * disclosure notification. 43 */ 44 boolean isDungeonNeededForUser(int userId); 45 46 /** 47 * @param sbn 48 * @return true if sbn is the system-provided "dungeon" (list of running foreground services). 49 */ 50 boolean isDungeonNotification(StatusBarNotification sbn); 51 52 /** 53 * @return true if sbn is one of the window manager "drawing over other apps" notifications 54 */ 55 boolean isSystemAlertNotification(StatusBarNotification sbn); 56 57 /** 58 * Returns the key of the foreground service from this package using the standard template, 59 * if one exists. 60 */ 61 @Nullable String getStandardLayoutKey(int userId, String pkg); 62 63 /** 64 * @return true if this user/pkg has a missing or custom layout notification and therefore needs 65 * a disclosure notification for system alert windows. 66 */ 67 boolean isSystemAlertWarningNeeded(int userId, String pkg); 68 69 /** 70 * Records active app ops. App Ops are stored in FSC in addition to NotificationData in 71 * case they change before we have a notification to tag. 72 */ 73 void onAppOpChanged(int code, int uid, String packageName, boolean active); 74 75 /** 76 * Gets active app ops for this user and package 77 */ 78 @Nullable ArraySet<Integer> getAppOps(int userId, String packageName); 79 } 80