• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 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.phone;
16 
17 import android.view.View;
18 
19 import com.android.systemui.statusbar.StatusBarState;
20 
21 /**
22  * {@link ShadeController} is an abstraction of the work that used to be hard-coded in
23  * {@link StatusBar}. The shade itself represents the concept of the status bar window state, and
24  * can be in multiple states: dozing, locked, showing the bouncer, occluded, etc. All/some of these
25  * are coordinated with {@link StatusBarKeyguardViewManager} via
26  * {@link com.android.systemui.keyguard.KeyguardViewMediator} and others.
27  */
28 public interface ShadeController {
29 
30     /**
31      * Make our window larger and the panel expanded
32      */
instantExpandNotificationsPanel()33     void instantExpandNotificationsPanel();
34 
35     /** See {@link #animateCollapsePanels(int, boolean)}. */
animateCollapsePanels()36     void animateCollapsePanels();
37 
38     /** See {@link #animateCollapsePanels(int, boolean)}. */
animateCollapsePanels(int flags)39     void animateCollapsePanels(int flags);
40 
41     /**
42      * Collapse the shade animated, showing the bouncer when on {@link StatusBarState#KEYGUARD} or
43      * dismissing {@link StatusBar} when on {@link StatusBarState#SHADE}.
44      */
animateCollapsePanels(int flags, boolean force)45     void animateCollapsePanels(int flags, boolean force);
46 
47     /** See {@link #animateCollapsePanels(int, boolean)}. */
animateCollapsePanels(int flags, boolean force, boolean delayed)48     void animateCollapsePanels(int flags, boolean force, boolean delayed);
49 
50     /** See {@link #animateCollapsePanels(int, boolean)}. */
animateCollapsePanels(int flags, boolean force, boolean delayed, float speedUpFactor)51     void animateCollapsePanels(int flags, boolean force, boolean delayed, float speedUpFactor);
52 
53     /**
54      * If the notifications panel is not fully expanded, collapse it animated.
55      *
56      * @return Seems to always return false
57      */
closeShadeIfOpen()58     boolean closeShadeIfOpen();
59 
60     /**
61      * Add a runnable for NotificationPanelView to post when the panel is expanded.
62      *
63      * @param action the action to post
64      */
postOnShadeExpanded(Runnable action)65     void postOnShadeExpanded(Runnable action);
66 
67     /**
68      * Add a runnable to be executed after the shade collapses. Post-collapse runnables are
69      * aggregated and run serially.
70      *
71      * @param action the action to execute
72      */
addPostCollapseAction(Runnable action)73     void addPostCollapseAction(Runnable action);
74 
75     /**
76      * Run all of the runnables added by {@link #addPostCollapseAction}.
77      */
runPostCollapseRunnables()78     void runPostCollapseRunnables();
79 
80     /**
81      * If secure with redaction: Show bouncer, go to unlocked shade.
82      *
83      * <p>If secure without redaction or no security: Go to {@link StatusBarState#SHADE_LOCKED}.</p>
84      *
85      * @param startingChild The view to expand after going to the shade.
86      */
goToLockedShade(View startingChild)87     void goToLockedShade(View startingChild);
88 
89     /**
90      * Close the shade if it was open
91      *
92      * @return true if the shade was open, else false
93      */
collapsePanel()94     boolean collapsePanel();
95 
96     /**
97      * If {@param animate}, does the same as {@link #collapsePanel()}. Otherwise, instantly collapse
98      * the panel. Post collapse runnables will be executed
99      *
100      * @param animate
101      */
collapsePanel(boolean animate)102     void collapsePanel(boolean animate);
103 }
104