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.statusbar; 16 17 import android.content.pm.UserInfo; 18 import android.util.SparseArray; 19 20 import com.android.systemui.statusbar.notification.collection.NotificationEntry; 21 22 public interface NotificationLockscreenUserManager { 23 String PERMISSION_SELF = "com.android.systemui.permission.SELF"; 24 String NOTIFICATION_UNLOCKED_BY_WORK_CHALLENGE_ACTION 25 = "com.android.systemui.statusbar.work_challenge_unlocked_notification_action"; 26 shouldAllowLockscreenRemoteInput()27 boolean shouldAllowLockscreenRemoteInput(); 28 29 /** 30 * @param userId user Id 31 * @return true if we re on a secure lock screen 32 */ isLockscreenPublicMode(int userId)33 boolean isLockscreenPublicMode(int userId); 34 35 /** 36 * Does a user require a separate work challenge? If so, the unlock mechanism is decoupled from 37 * the current user and has to be solved separately. 38 */ needsSeparateWorkChallenge(int userId)39 default boolean needsSeparateWorkChallenge(int userId) { 40 return false; 41 } 42 setUpWithPresenter(NotificationPresenter presenter)43 void setUpWithPresenter(NotificationPresenter presenter); 44 getCurrentUserId()45 int getCurrentUserId(); 46 isCurrentProfile(int userId)47 boolean isCurrentProfile(int userId); 48 49 /** Adds a listener to be notified when the current user changes. */ addUserChangedListener(UserChangedListener listener)50 void addUserChangedListener(UserChangedListener listener); 51 52 /** 53 * Registers a [KeyguardNotificationSuppressor] that will be consulted during 54 * {@link #shouldShowOnKeyguard(NotificationEntry)} 55 */ addKeyguardNotificationSuppressor(KeyguardNotificationSuppressor suppressor)56 void addKeyguardNotificationSuppressor(KeyguardNotificationSuppressor suppressor); 57 58 /** 59 * Removes a listener previously registered with 60 * {@link #addUserChangedListener(UserChangedListener)} 61 */ removeUserChangedListener(UserChangedListener listener)62 void removeUserChangedListener(UserChangedListener listener); 63 getCurrentProfiles()64 SparseArray<UserInfo> getCurrentProfiles(); 65 setLockscreenPublicMode(boolean isProfilePublic, int userId)66 void setLockscreenPublicMode(boolean isProfilePublic, int userId); 67 shouldShowLockscreenNotifications()68 boolean shouldShowLockscreenNotifications(); 69 shouldHideNotifications(int userId)70 boolean shouldHideNotifications(int userId); shouldHideNotifications(String key)71 boolean shouldHideNotifications(String key); shouldShowOnKeyguard(NotificationEntry entry)72 boolean shouldShowOnKeyguard(NotificationEntry entry); 73 isAnyProfilePublicMode()74 boolean isAnyProfilePublicMode(); 75 updatePublicMode()76 void updatePublicMode(); 77 needsRedaction(NotificationEntry entry)78 boolean needsRedaction(NotificationEntry entry); 79 80 /** 81 * Has the given user chosen to allow their private (full) notifications to be shown even 82 * when the lockscreen is in "public" (secure & locked) mode? 83 */ userAllowsPrivateNotificationsInPublic(int currentUserId)84 boolean userAllowsPrivateNotificationsInPublic(int currentUserId); 85 86 /** 87 * Has the given user chosen to allow notifications to be shown even when the lockscreen is in 88 * "public" (secure & locked) mode? 89 */ userAllowsNotificationsInPublic(int userId)90 boolean userAllowsNotificationsInPublic(int userId); 91 92 /** Notified when the current user changes. */ 93 interface UserChangedListener { onUserChanged(int userId)94 default void onUserChanged(int userId) {} onCurrentProfilesChanged(SparseArray<UserInfo> currentProfiles)95 default void onCurrentProfilesChanged(SparseArray<UserInfo> currentProfiles) {} 96 } 97 98 /** Used to hide notifications on the lockscreen */ 99 interface KeyguardNotificationSuppressor { shouldSuppressOnKeyguard(NotificationEntry entry)100 boolean shouldSuppressOnKeyguard(NotificationEntry entry); 101 } 102 } 103