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
17package com.android.systemui.statusbar.tv;
18
19import android.content.ComponentName;
20import android.graphics.Rect;
21import android.os.IBinder;
22import android.os.RemoteException;
23import android.service.notification.NotificationListenerService.RankingMap;
24import android.service.notification.StatusBarNotification;
25import android.view.View;
26
27import com.android.internal.statusbar.StatusBarIcon;
28import com.android.systemui.statusbar.ActivatableNotificationView;
29import com.android.systemui.statusbar.BaseStatusBar;
30import com.android.systemui.statusbar.NotificationData;
31import 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
37public 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
50    public void setIcon(String slot, StatusBarIcon icon) {
51    }
52
53    @Override
54    public void removeIcon(String slot) {
55    }
56
57    @Override
58    public void addNotification(StatusBarNotification notification, RankingMap ranking,
59            NotificationData.Entry entry) {
60    }
61
62    @Override
63    protected void updateNotificationRanking(RankingMap ranking) {
64    }
65
66    @Override
67    public void removeNotification(String key, RankingMap ranking) {
68    }
69
70    @Override
71    public void disable(int state1, int state2, boolean animate) {
72    }
73
74    @Override
75    public void animateExpandNotificationsPanel() {
76    }
77
78    @Override
79    public void animateCollapsePanels(int flags) {
80    }
81
82    @Override
83    public void setSystemUiVisibility(int vis, int fullscreenStackVis, int dockedStackVis,
84            int mask, Rect fullscreenStackBounds, Rect dockedStackBounds) {
85    }
86
87    @Override
88    public void topAppWindowChanged(boolean visible) {
89    }
90
91    @Override
92    public void setImeWindowStatus(IBinder token, int vis, int backDisposition,
93            boolean showImeSwitcher) {
94    }
95
96    @Override // CommandQueue
97    public void setWindowState(int window, int state) {
98    }
99
100    @Override // CommandQueue
101    public void buzzBeepBlinked() {
102    }
103
104    @Override // CommandQueue
105    public void notificationLightOff() {
106    }
107
108    @Override // CommandQueue
109    public void notificationLightPulse(int argb, int onMillis, int offMillis) {
110    }
111
112    @Override
113    protected void setAreThereNotifications() {
114    }
115
116    @Override
117    protected void updateNotifications() {
118    }
119
120    @Override
121    public boolean shouldDisableNavbarGestures() {
122        return true;
123    }
124
125    public View getStatusBarView() {
126        return null;
127    }
128
129    @Override
130    protected void toggleSplitScreenMode(int metricsDockAction, int metricsUndockAction) {
131    }
132
133    @Override
134    public void maybeEscalateHeadsUp() {
135    }
136
137    @Override
138    public boolean isPanelFullyCollapsed() {
139        return false;
140    }
141
142    @Override
143    protected int getMaxKeyguardNotifications(boolean recompute) {
144        return 0;
145    }
146
147    @Override
148    public void animateExpandSettingsPanel(String subPanel) {
149    }
150
151    @Override
152    protected void createAndAddWindows() {
153    }
154
155    @Override
156    protected void refreshLayout(int layoutDirection) {
157    }
158
159    @Override
160    public void onActivated(ActivatableNotificationView view) {
161    }
162
163    @Override
164    public void onActivationReset(ActivatableNotificationView view) {
165    }
166
167    @Override
168    public void showScreenPinningRequest(int taskId) {
169    }
170
171    @Override
172    public void appTransitionPending() {
173    }
174
175    @Override
176    public void appTransitionCancelled() {
177    }
178
179    @Override
180    public void appTransitionStarting(long startTime, long duration) {
181    }
182
183    @Override
184    public void appTransitionFinished() {
185    }
186
187    @Override
188    public void onCameraLaunchGestureDetected(int source) {
189    }
190
191    @Override
192    public void showTvPictureInPictureMenu() {
193        PipManager.getInstance().showTvPictureInPictureMenu();
194    }
195
196    @Override
197    protected void updateHeadsUp(String key, NotificationData.Entry entry, boolean shouldPeek,
198            boolean alertAgain) {
199    }
200
201    @Override
202    protected void setHeadsUpUser(int newUserId) {
203    }
204
205    protected boolean isSnoozedPackage(StatusBarNotification sbn) {
206        return false;
207    }
208
209    @Override
210    public void addQsTile(ComponentName tile) {
211    }
212
213    @Override
214    public void remQsTile(ComponentName tile) {
215    }
216
217    @Override
218    public void clickTile(ComponentName tile) {
219    }
220
221    @Override
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     */
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     */
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
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