blob: 5263bb4173a32f622f9f8dc5124fb14a35994286 [file] [log] [blame]
Eliot Courtney47098cb2017-10-18 17:30:30 +09001/*
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 */
16package com.android.systemui.statusbar;
17
18import android.content.Intent;
Eliot Courtney09322282017-11-09 15:31:19 +090019import android.os.Handler;
Eliot Courtneye77edea2017-11-15 14:25:21 +090020import android.view.View;
Eliot Courtney47098cb2017-10-18 17:30:30 +090021
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 Courtneya6d8cf22017-10-20 13:26:58 +090029public interface NotificationPresenter extends NotificationData.Environment,
30 NotificationRemoteInputManager.Callback,
31 ExpandableNotificationRow.OnExpandClickListener,
32 ActivatableNotificationView.OnActivatedListener,
33 NotificationEntryManager.Callback {
Eliot Courtney47098cb2017-10-18 17:30:30 +090034 /**
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 Courtney47098cb2017-10-18 17:30:30 +090046 * Runs the given intent. The presenter may want to run some animations or close itself when
47 * this happens.
48 */
Selim Cinek2627d722018-01-19 12:16:49 -080049 void startNotificationGutsIntent(Intent intent, int appUid, ExpandableNotificationRow row);
Eliot Courtney47098cb2017-10-18 17:30:30 +090050
Eliot Courtney3ebbccd2017-11-08 09:59:38 +090051 /**
Eliot Courtney09322282017-11-09 15:31:19 +090052 * Returns the Handler for NotificationPresenter.
53 */
54 Handler getHandler();
55
Eliot Courtney3ebbccd2017-11-08 09:59:38 +090056 /**
57 * Refresh or remove lockscreen artwork from media metadata or the lockscreen wallpaper.
58 */
59 void updateMediaMetaData(boolean metaDataChanged, boolean allowEnterAnimation);
60
Eliot Courtney09322282017-11-09 15:31:19 +090061 /**
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 Courtneye77edea2017-11-15 14:25:21 +090076
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 Courtneya6d8cf22017-10-20 13:26:58 +090092
93 /**
94 * @return true iff the device is in vr mode
95 */
96 boolean isDeviceInVrMode();
97
98 /**
Eliot Courtneya6d8cf22017-10-20 13:26:58 +090099 * 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 Courtney2b4c3a02017-11-27 13:27:46 +0900107
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 Courtney47098cb2017-10-18 17:30:30 +0900120}