Eliot Courtney | 47098cb | 2017-10-18 17:30:30 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 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 | package com.android.systemui.statusbar; |
| 17 | |
| 18 | import android.content.Intent; |
Eliot Courtney | 0932228 | 2017-11-09 15:31:19 +0900 | [diff] [blame] | 19 | import android.os.Handler; |
Eliot Courtney | e77edea | 2017-11-15 14:25:21 +0900 | [diff] [blame] | 20 | import android.view.View; |
Eliot Courtney | 47098cb | 2017-10-18 17:30:30 +0900 | [diff] [blame] | 21 | |
| 22 | /** |
| 23 | * An abstraction of something that presents notifications, e.g. StatusBar. Contains methods |
| 24 | * for both querying the state of the system (some modularised piece of functionality may |
| 25 | * want to act differently based on e.g. whether the presenter is visible to the user or not) and |
| 26 | * for affecting the state of the system (e.g. starting an intent, given that the presenter may |
| 27 | * want to perform some action before doing so). |
| 28 | */ |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 29 | public interface NotificationPresenter extends NotificationData.Environment, |
| 30 | NotificationRemoteInputManager.Callback, |
| 31 | ExpandableNotificationRow.OnExpandClickListener, |
| 32 | ActivatableNotificationView.OnActivatedListener, |
| 33 | NotificationEntryManager.Callback { |
Eliot Courtney | 47098cb | 2017-10-18 17:30:30 +0900 | [diff] [blame] | 34 | /** |
| 35 | * Returns true if the presenter is not visible. For example, it may not be necessary to do |
| 36 | * animations if this returns true. |
| 37 | */ |
| 38 | boolean isPresenterFullyCollapsed(); |
| 39 | |
| 40 | /** |
| 41 | * Returns true if the presenter is locked. For example, if the keyguard is active. |
| 42 | */ |
| 43 | boolean isPresenterLocked(); |
| 44 | |
| 45 | /** |
Eliot Courtney | 47098cb | 2017-10-18 17:30:30 +0900 | [diff] [blame] | 46 | * Runs the given intent. The presenter may want to run some animations or close itself when |
| 47 | * this happens. |
| 48 | */ |
Selim Cinek | 2627d72 | 2018-01-19 12:16:49 -0800 | [diff] [blame] | 49 | void startNotificationGutsIntent(Intent intent, int appUid, ExpandableNotificationRow row); |
Eliot Courtney | 47098cb | 2017-10-18 17:30:30 +0900 | [diff] [blame] | 50 | |
Eliot Courtney | 3ebbccd | 2017-11-08 09:59:38 +0900 | [diff] [blame] | 51 | /** |
Eliot Courtney | 0932228 | 2017-11-09 15:31:19 +0900 | [diff] [blame] | 52 | * Returns the Handler for NotificationPresenter. |
| 53 | */ |
| 54 | Handler getHandler(); |
| 55 | |
Eliot Courtney | 3ebbccd | 2017-11-08 09:59:38 +0900 | [diff] [blame] | 56 | /** |
| 57 | * Refresh or remove lockscreen artwork from media metadata or the lockscreen wallpaper. |
| 58 | */ |
| 59 | void updateMediaMetaData(boolean metaDataChanged, boolean allowEnterAnimation); |
| 60 | |
Eliot Courtney | 0932228 | 2017-11-09 15:31:19 +0900 | [diff] [blame] | 61 | /** |
| 62 | * Called when the locked status of the device is changed for a work profile. |
| 63 | */ |
| 64 | void onWorkChallengeChanged(); |
| 65 | |
| 66 | /** |
| 67 | * Called when the current user changes. |
| 68 | * @param newUserId new user id |
| 69 | */ |
| 70 | void onUserSwitched(int newUserId); |
| 71 | |
| 72 | /** |
| 73 | * Gets the NotificationLockscreenUserManager for this Presenter. |
| 74 | */ |
| 75 | NotificationLockscreenUserManager getNotificationLockscreenUserManager(); |
Eliot Courtney | e77edea | 2017-11-15 14:25:21 +0900 | [diff] [blame] | 76 | |
| 77 | /** |
| 78 | * Wakes the device up if dozing. |
| 79 | * |
| 80 | * @param time the time when the request to wake up was issued |
| 81 | * @param where which view caused this wake up request |
| 82 | */ |
| 83 | void wakeUpIfDozing(long time, View where); |
| 84 | |
| 85 | /** |
| 86 | * True if the device currently requires a PIN, pattern, or password to unlock. |
| 87 | * |
| 88 | * @param userId user id to query about |
| 89 | * @return true iff the device is locked |
| 90 | */ |
| 91 | boolean isDeviceLocked(int userId); |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 92 | |
| 93 | /** |
| 94 | * @return true iff the device is in vr mode |
| 95 | */ |
| 96 | boolean isDeviceInVrMode(); |
| 97 | |
| 98 | /** |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 99 | * Updates the visual representation of the notifications. |
| 100 | */ |
| 101 | void updateNotificationViews(); |
| 102 | |
| 103 | /** |
| 104 | * @return true iff the device is dozing |
| 105 | */ |
| 106 | boolean isDozing(); |
Eliot Courtney | 2b4c3a0 | 2017-11-27 13:27:46 +0900 | [diff] [blame] | 107 | |
| 108 | /** |
| 109 | * Returns the maximum number of notifications to show while locked. |
| 110 | * |
| 111 | * @param recompute whether something has changed that means we should recompute this value |
| 112 | * @return the maximum number of notifications to show while locked |
| 113 | */ |
| 114 | int getMaxNotificationsWhileLocked(boolean recompute); |
| 115 | |
| 116 | /** |
| 117 | * Called when the row states are updated by NotificationViewHierarchyManager. |
| 118 | */ |
| 119 | void onUpdateRowStates(); |
Eliot Courtney | 47098cb | 2017-10-18 17:30:30 +0900 | [diff] [blame] | 120 | } |