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