1 /*
2  * Copyright (C) 2012 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 
17 package com.android.systemui.statusbar.tv;
18 
19 import android.content.ComponentName;
20 import android.graphics.Rect;
21 import android.os.IBinder;
22 import android.os.RemoteException;
23 import android.service.notification.NotificationListenerService.RankingMap;
24 import android.service.notification.StatusBarNotification;
25 import android.view.View;
26 
27 import com.android.internal.statusbar.StatusBarIcon;
28 import com.android.systemui.statusbar.ActivatableNotificationView;
29 import com.android.systemui.statusbar.BaseStatusBar;
30 import com.android.systemui.statusbar.NotificationData;
31 import com.android.systemui.tv.pip.PipManager;
32 
33 /**
34  * Status bar implementation for "large screen" products that mostly present no on-screen nav
35  */
36 
37 public class TvStatusBar extends BaseStatusBar {
38 
39     /**
40      * Tracking calls to View.setSystemUiVisibility().
41      */
42     int mSystemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE;
43 
44     /**
45      * Last value sent to window manager.
46      */
47     private int mLastDispatchedSystemUiVisibility = ~View.SYSTEM_UI_FLAG_VISIBLE;
48 
49     @Override
setIcon(String slot, StatusBarIcon icon)50     public void setIcon(String slot, StatusBarIcon icon) {
51     }
52 
53     @Override
removeIcon(String slot)54     public void removeIcon(String slot) {
55     }
56 
57     @Override
addNotification(StatusBarNotification notification, RankingMap ranking, NotificationData.Entry entry)58     public void addNotification(StatusBarNotification notification, RankingMap ranking,
59             NotificationData.Entry entry) {
60     }
61 
62     @Override
updateNotificationRanking(RankingMap ranking)63     protected void updateNotificationRanking(RankingMap ranking) {
64     }
65 
66     @Override
removeNotification(String key, RankingMap ranking)67     public void removeNotification(String key, RankingMap ranking) {
68     }
69 
70     @Override
disable(int state1, int state2, boolean animate)71     public void disable(int state1, int state2, boolean animate) {
72     }
73 
74     @Override
animateExpandNotificationsPanel()75     public void animateExpandNotificationsPanel() {
76     }
77 
78     @Override
animateCollapsePanels(int flags)79     public void animateCollapsePanels(int flags) {
80     }
81 
82     @Override
setSystemUiVisibility(int vis, int fullscreenStackVis, int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds)83     public void setSystemUiVisibility(int vis, int fullscreenStackVis, int dockedStackVis,
84             int mask, Rect fullscreenStackBounds, Rect dockedStackBounds) {
85     }
86 
87     @Override
topAppWindowChanged(boolean visible)88     public void topAppWindowChanged(boolean visible) {
89     }
90 
91     @Override
setImeWindowStatus(IBinder token, int vis, int backDisposition, boolean showImeSwitcher)92     public void setImeWindowStatus(IBinder token, int vis, int backDisposition,
93             boolean showImeSwitcher) {
94     }
95 
96     @Override // CommandQueue
setWindowState(int window, int state)97     public void setWindowState(int window, int state) {
98     }
99 
100     @Override // CommandQueue
buzzBeepBlinked()101     public void buzzBeepBlinked() {
102     }
103 
104     @Override // CommandQueue
notificationLightOff()105     public void notificationLightOff() {
106     }
107 
108     @Override // CommandQueue
notificationLightPulse(int argb, int onMillis, int offMillis)109     public void notificationLightPulse(int argb, int onMillis, int offMillis) {
110     }
111 
112     @Override
setAreThereNotifications()113     protected void setAreThereNotifications() {
114     }
115 
116     @Override
updateNotifications()117     protected void updateNotifications() {
118     }
119 
120     @Override
shouldDisableNavbarGestures()121     public boolean shouldDisableNavbarGestures() {
122         return true;
123     }
124 
getStatusBarView()125     public View getStatusBarView() {
126         return null;
127     }
128 
129     @Override
toggleSplitScreenMode(int metricsDockAction, int metricsUndockAction)130     protected void toggleSplitScreenMode(int metricsDockAction, int metricsUndockAction) {
131     }
132 
133     @Override
maybeEscalateHeadsUp()134     public void maybeEscalateHeadsUp() {
135     }
136 
137     @Override
isPanelFullyCollapsed()138     public boolean isPanelFullyCollapsed() {
139         return false;
140     }
141 
142     @Override
getMaxKeyguardNotifications(boolean recompute)143     protected int getMaxKeyguardNotifications(boolean recompute) {
144         return 0;
145     }
146 
147     @Override
animateExpandSettingsPanel(String subPanel)148     public void animateExpandSettingsPanel(String subPanel) {
149     }
150 
151     @Override
createAndAddWindows()152     protected void createAndAddWindows() {
153     }
154 
155     @Override
refreshLayout(int layoutDirection)156     protected void refreshLayout(int layoutDirection) {
157     }
158 
159     @Override
onActivated(ActivatableNotificationView view)160     public void onActivated(ActivatableNotificationView view) {
161     }
162 
163     @Override
onActivationReset(ActivatableNotificationView view)164     public void onActivationReset(ActivatableNotificationView view) {
165     }
166 
167     @Override
showScreenPinningRequest(int taskId)168     public void showScreenPinningRequest(int taskId) {
169     }
170 
171     @Override
appTransitionPending()172     public void appTransitionPending() {
173     }
174 
175     @Override
appTransitionCancelled()176     public void appTransitionCancelled() {
177     }
178 
179     @Override
appTransitionStarting(long startTime, long duration)180     public void appTransitionStarting(long startTime, long duration) {
181     }
182 
183     @Override
appTransitionFinished()184     public void appTransitionFinished() {
185     }
186 
187     @Override
onCameraLaunchGestureDetected(int source)188     public void onCameraLaunchGestureDetected(int source) {
189     }
190 
191     @Override
showTvPictureInPictureMenu()192     public void showTvPictureInPictureMenu() {
193         PipManager.getInstance().showTvPictureInPictureMenu();
194     }
195 
196     @Override
updateHeadsUp(String key, NotificationData.Entry entry, boolean shouldPeek, boolean alertAgain)197     protected void updateHeadsUp(String key, NotificationData.Entry entry, boolean shouldPeek,
198             boolean alertAgain) {
199     }
200 
201     @Override
setHeadsUpUser(int newUserId)202     protected void setHeadsUpUser(int newUserId) {
203     }
204 
isSnoozedPackage(StatusBarNotification sbn)205     protected boolean isSnoozedPackage(StatusBarNotification sbn) {
206         return false;
207     }
208 
209     @Override
addQsTile(ComponentName tile)210     public void addQsTile(ComponentName tile) {
211     }
212 
213     @Override
remQsTile(ComponentName tile)214     public void remQsTile(ComponentName tile) {
215     }
216 
217     @Override
clickTile(ComponentName tile)218     public void clickTile(ComponentName tile) {
219     }
220 
221     @Override
start()222     public void start() {
223         super.start();
224         putComponent(TvStatusBar.class, this);
225     }
226 
227     /**
228      * Updates the visibility of the picture-in-picture.
229      */
updatePipVisibility(boolean visible)230     public void updatePipVisibility(boolean visible) {
231         if (visible) {
232             mSystemUiVisibility |= View.TV_PICTURE_IN_PICTURE_VISIBLE;
233         } else {
234             mSystemUiVisibility &= ~View.TV_PICTURE_IN_PICTURE_VISIBLE;
235         }
236         notifyUiVisibilityChanged(mSystemUiVisibility);
237     }
238 
239     /**
240      * Updates the visibility of the Recents
241      */
updateRecentsVisibility(boolean visible)242     public void updateRecentsVisibility(boolean visible) {
243         if (visible) {
244             mSystemUiVisibility |= View.RECENT_APPS_VISIBLE;
245         } else {
246             mSystemUiVisibility &= ~View.RECENT_APPS_VISIBLE;
247         }
248         notifyUiVisibilityChanged(mSystemUiVisibility);
249     }
250 
notifyUiVisibilityChanged(int vis)251     private void notifyUiVisibilityChanged(int vis) {
252         try {
253             if (mLastDispatchedSystemUiVisibility != vis) {
254                 mWindowManagerService.statusBarVisibilityChanged(vis);
255                 mLastDispatchedSystemUiVisibility = vis;
256             }
257         } catch (RemoteException ex) {
258         }
259     }
260 }
261