Home | History | Annotate | Download | only in statusbar
      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 com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
     19 import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
     20 
     21 /**
     22  * An abstraction of something that presents notifications, e.g. StatusBar. Contains methods
     23  * for both querying the state of the system (some modularised piece of functionality may
     24  * want to act differently based on e.g. whether the presenter is visible to the user or not) and
     25  * for affecting the state of the system (e.g. starting an intent, given that the presenter may
     26  * want to perform some action before doing so).
     27  */
     28 public interface NotificationPresenter extends ExpandableNotificationRow.OnExpandClickListener,
     29         ActivatableNotificationView.OnActivatedListener {
     30     /**
     31      * Returns true if the presenter is not visible. For example, it may not be necessary to do
     32      * animations if this returns true.
     33      */
     34     boolean isPresenterFullyCollapsed();
     35 
     36     /**
     37      * Refresh or remove lockscreen artwork from media metadata or the lockscreen wallpaper.
     38      */
     39     void updateMediaMetaData(boolean metaDataChanged, boolean allowEnterAnimation);
     40 
     41     /**
     42      * Called when the current user changes.
     43      * @param newUserId new user id
     44      */
     45     void onUserSwitched(int newUserId);
     46 
     47     /**
     48      * @return true iff the device is in vr mode
     49      */
     50     boolean isDeviceInVrMode();
     51 
     52     /**
     53      * Updates the visual representation of the notifications.
     54      */
     55     void updateNotificationViews();
     56 
     57     /**
     58      * Returns the maximum number of notifications to show while locked.
     59      *
     60      * @param recompute whether something has changed that means we should recompute this value
     61      * @return the maximum number of notifications to show while locked
     62      */
     63     int getMaxNotificationsWhileLocked(boolean recompute);
     64 
     65     /**
     66      * True if the presenter is currently locked.
     67      */
     68     boolean isPresenterLocked();
     69 
     70     /**
     71      * Called when the row states are updated by {@link NotificationViewHierarchyManager}.
     72      */
     73     void onUpdateRowStates();
     74 
     75     /**
     76      * @return true if the shade is collapsing.
     77      */
     78     boolean isCollapsing();
     79 }
     80