blob: 60fc0fa862ec944890960d69ea5498685689e5f3 [file] [log] [blame]
Joe Onorato0cbda992010-05-02 16:28:15 -07001/*
2 * Copyright (C) 2010 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
Joe Onorato79de0c52010-05-26 17:03:26 -040017package com.android.systemui.statusbar;
Joe Onorato0cbda992010-05-02 16:28:15 -070018
Jorim Jaggi165ce062015-07-06 16:18:11 -070019import android.os.Bundle;
Joe Onorato0cbda992010-05-02 16:28:15 -070020import android.os.Handler;
Joe Onoratoa0c56fe2010-05-20 10:21:52 -070021import android.os.IBinder;
Joe Onorato0cbda992010-05-02 16:28:15 -070022import android.os.Message;
Jorim Jaggi24bec7c2015-02-04 12:40:14 +010023import android.util.Pair;
Winsonc0d70582016-01-29 10:24:39 -080024
Joe Onorato0cbda992010-05-02 16:28:15 -070025import com.android.internal.statusbar.IStatusBar;
26import com.android.internal.statusbar.StatusBarIcon;
Joe Onorato0cbda992010-05-02 16:28:15 -070027
Joe Onoratof3f0e052010-05-14 18:49:29 -070028/**
29 * This class takes the functions from IStatusBar that come in on
30 * binder pool threads and posts messages to get them onto the main
31 * thread, and calls onto Callbacks. It also takes care of
Joe Onorato4762c2d2010-05-17 15:42:59 -070032 * coalescing these calls so they don't stack up. For the calls
33 * are coalesced, note that they are all idempotent.
Joe Onoratof3f0e052010-05-14 18:49:29 -070034 */
Joe Onorato808182d2010-07-09 18:52:06 -040035public class CommandQueue extends IStatusBar.Stub {
Daniel Sandler1d4d30a2011-04-28 12:35:29 -040036 private static final int INDEX_MASK = 0xffff;
37 private static final int MSG_SHIFT = 16;
38 private static final int MSG_MASK = 0xffff << MSG_SHIFT;
Joe Onorato0cbda992010-05-02 16:28:15 -070039
Daniel Sandler1d4d30a2011-04-28 12:35:29 -040040 private static final int OP_SET_ICON = 1;
Joe Onorato0cbda992010-05-02 16:28:15 -070041 private static final int OP_REMOVE_ICON = 2;
42
Svetoslav Ganove20a1772012-09-25 16:07:46 -070043 private static final int MSG_ICON = 1 << MSG_SHIFT;
Christoph Studere71fefc2014-06-24 16:16:49 +020044 private static final int MSG_DISABLE = 2 << MSG_SHIFT;
45 private static final int MSG_EXPAND_NOTIFICATIONS = 3 << MSG_SHIFT;
46 private static final int MSG_COLLAPSE_PANELS = 4 << MSG_SHIFT;
47 private static final int MSG_EXPAND_SETTINGS = 5 << MSG_SHIFT;
48 private static final int MSG_SET_SYSTEMUI_VISIBILITY = 6 << MSG_SHIFT;
49 private static final int MSG_TOP_APP_WINDOW_CHANGED = 7 << MSG_SHIFT;
50 private static final int MSG_SHOW_IME_BUTTON = 8 << MSG_SHIFT;
Michael Wright665366a2014-08-07 15:44:40 -070051 private static final int MSG_TOGGLE_RECENT_APPS = 9 << MSG_SHIFT;
52 private static final int MSG_PRELOAD_RECENT_APPS = 10 << MSG_SHIFT;
53 private static final int MSG_CANCEL_PRELOAD_RECENT_APPS = 11 << MSG_SHIFT;
54 private static final int MSG_SET_WINDOW_STATE = 12 << MSG_SHIFT;
55 private static final int MSG_SHOW_RECENT_APPS = 13 << MSG_SHIFT;
56 private static final int MSG_HIDE_RECENT_APPS = 14 << MSG_SHIFT;
57 private static final int MSG_BUZZ_BEEP_BLINKED = 15 << MSG_SHIFT;
58 private static final int MSG_NOTIFICATION_LIGHT_OFF = 16 << MSG_SHIFT;
59 private static final int MSG_NOTIFICATION_LIGHT_PULSE = 17 << MSG_SHIFT;
Jason Monk5565cb42014-09-12 10:59:21 -040060 private static final int MSG_SHOW_SCREEN_PIN_REQUEST = 18 << MSG_SHIFT;
Jorim Jaggi24bec7c2015-02-04 12:40:14 +010061 private static final int MSG_APP_TRANSITION_PENDING = 19 << MSG_SHIFT;
62 private static final int MSG_APP_TRANSITION_CANCELLED = 20 << MSG_SHIFT;
63 private static final int MSG_APP_TRANSITION_STARTING = 21 << MSG_SHIFT;
Adrian Roos4f43dc02015-06-17 16:43:38 -070064 private static final int MSG_ASSIST_DISCLOSURE = 22 << MSG_SHIFT;
Jorim Jaggi165ce062015-07-06 16:18:11 -070065 private static final int MSG_START_ASSIST = 23 << MSG_SHIFT;
Selim Cinek372d1bd2015-08-14 13:19:37 -070066 private static final int MSG_CAMERA_LAUNCH_GESTURE = 24 << MSG_SHIFT;
Andrei Stingaceanuc22ab792016-01-07 12:39:38 +000067 private static final int MSG_TOGGLE_KEYBOARD_SHORTCUTS = 25 << MSG_SHIFT;
Daniel Sandler328310c2011-09-23 15:56:52 -040068
Jim Miller9a720f52012-05-30 03:19:43 -070069 public static final int FLAG_EXCLUDE_NONE = 0;
70 public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0;
71 public static final int FLAG_EXCLUDE_RECENTS_PANEL = 1 << 1;
72 public static final int FLAG_EXCLUDE_NOTIFICATION_PANEL = 1 << 2;
73 public static final int FLAG_EXCLUDE_INPUT_METHODS_PANEL = 1 << 3;
74 public static final int FLAG_EXCLUDE_COMPAT_MODE_PANEL = 1 << 4;
75
Jason Monkb605fec2014-05-02 17:04:10 -040076 private static final String SHOW_IME_SWITCHER_KEY = "showImeSwitcherKey";
77
Jason Monk07473ce2016-01-05 14:59:19 -050078 private final Object mLock = new Object();
Joe Onorato0cbda992010-05-02 16:28:15 -070079 private Callbacks mCallbacks;
80 private Handler mHandler = new H();
81
82 /**
83 * These methods are called back on the main thread.
84 */
85 public interface Callbacks {
Jason Monk07473ce2016-01-05 14:59:19 -050086 public void setIcon(String slot, StatusBarIcon icon);
87 public void removeIcon(String slot);
Benjamin Franzcde0a2a2015-04-23 17:19:48 +010088 public void disable(int state1, int state2, boolean animate);
Daniel Sandler11cf1782012-09-27 14:03:08 -040089 public void animateExpandNotificationsPanel();
90 public void animateCollapsePanels(int flags);
Jason Monka9927322015-12-13 16:22:37 -050091 public void animateExpandSettingsPanel(String obj);
Dianne Hackborn3a3a6cf2012-03-26 10:24:04 -070092 public void setSystemUiVisibility(int vis, int mask);
Dianne Hackborn7d049322011-06-14 15:00:32 -070093 public void topAppWindowChanged(boolean visible);
Jason Monkb605fec2014-05-02 17:04:10 -040094 public void setImeWindowStatus(IBinder token, int vis, int backDisposition,
95 boolean showImeSwitcher);
Winson Chung1e8d71b2014-05-16 17:05:22 -070096 public void showRecentApps(boolean triggeredFromAltTab);
Winson Chungcdcd4872014-08-05 18:00:13 -070097 public void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey);
Michael Jurka3b1fc472011-06-13 10:54:40 -070098 public void toggleRecentApps();
Michael Jurka7f2668c2012-03-27 07:49:52 -070099 public void preloadRecentApps();
Andrei Stingaceanuc22ab792016-01-07 12:39:38 +0000100 public void toggleKeyboardShortcutsMenu();
Winson Chung1e8d71b2014-05-16 17:05:22 -0700101 public void cancelPreloadRecentApps();
John Spurlock97642182013-07-29 17:58:39 -0400102 public void setWindowState(int window, int state);
John Spurlockcad57682014-07-26 17:09:56 -0400103 public void buzzBeepBlinked();
John Spurlockcb566aa2014-08-03 22:58:28 -0400104 public void notificationLightOff();
105 public void notificationLightPulse(int argb, int onMillis, int offMillis);
Jason Monk5565cb42014-09-12 10:59:21 -0400106 public void showScreenPinningRequest();
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100107 public void appTransitionPending();
108 public void appTransitionCancelled();
109 public void appTransitionStarting(long startTime, long duration);
Adrian Roos4f43dc02015-06-17 16:43:38 -0700110 public void showAssistDisclosure();
Jorim Jaggi165ce062015-07-06 16:18:11 -0700111 public void startAssist(Bundle args);
Jorim Jaggi40aa8812015-09-23 12:59:22 -0700112 public void onCameraLaunchGestureDetected(int source);
Joe Onorato0cbda992010-05-02 16:28:15 -0700113 }
114
Jason Monk07473ce2016-01-05 14:59:19 -0500115 public CommandQueue(Callbacks callbacks) {
Joe Onorato0cbda992010-05-02 16:28:15 -0700116 mCallbacks = callbacks;
Joe Onorato0cbda992010-05-02 16:28:15 -0700117 }
118
Jason Monk07473ce2016-01-05 14:59:19 -0500119 public void setIcon(String slot, StatusBarIcon icon) {
120 synchronized (mLock) {
121 // don't coalesce these
122 mHandler.obtainMessage(MSG_ICON, OP_SET_ICON, 0,
123 new Pair<String, StatusBarIcon>(slot, icon)).sendToTarget();
Joe Onorato0cbda992010-05-02 16:28:15 -0700124 }
125 }
126
Jason Monk07473ce2016-01-05 14:59:19 -0500127 public void removeIcon(String slot) {
128 synchronized (mLock) {
129 // don't coalesce these
130 mHandler.obtainMessage(MSG_ICON, OP_REMOVE_ICON, 0, slot).sendToTarget();
Joe Onorato0cbda992010-05-02 16:28:15 -0700131 }
132 }
133
Benjamin Franzcde0a2a2015-04-23 17:19:48 +0100134 public void disable(int state1, int state2) {
Jason Monk07473ce2016-01-05 14:59:19 -0500135 synchronized (mLock) {
Joe Onoratof3f0e052010-05-14 18:49:29 -0700136 mHandler.removeMessages(MSG_DISABLE);
Benjamin Franzcde0a2a2015-04-23 17:19:48 +0100137 mHandler.obtainMessage(MSG_DISABLE, state1, state2, null).sendToTarget();
Joe Onoratof3f0e052010-05-14 18:49:29 -0700138 }
139 }
140
Daniel Sandler11cf1782012-09-27 14:03:08 -0400141 public void animateExpandNotificationsPanel() {
Jason Monk07473ce2016-01-05 14:59:19 -0500142 synchronized (mLock) {
Svetoslav Ganove20a1772012-09-25 16:07:46 -0700143 mHandler.removeMessages(MSG_EXPAND_NOTIFICATIONS);
144 mHandler.sendEmptyMessage(MSG_EXPAND_NOTIFICATIONS);
Joe Onorato4762c2d2010-05-17 15:42:59 -0700145 }
146 }
147
Daniel Sandler11cf1782012-09-27 14:03:08 -0400148 public void animateCollapsePanels() {
Jason Monk07473ce2016-01-05 14:59:19 -0500149 synchronized (mLock) {
Daniel Sandler11cf1782012-09-27 14:03:08 -0400150 mHandler.removeMessages(MSG_COLLAPSE_PANELS);
151 mHandler.sendEmptyMessage(MSG_COLLAPSE_PANELS);
Svetoslav Ganove20a1772012-09-25 16:07:46 -0700152 }
Jim Miller9a720f52012-05-30 03:19:43 -0700153 }
154
Jason Monka9927322015-12-13 16:22:37 -0500155 public void animateExpandSettingsPanel(String subPanel) {
Jason Monk07473ce2016-01-05 14:59:19 -0500156 synchronized (mLock) {
Daniel Sandler11cf1782012-09-27 14:03:08 -0400157 mHandler.removeMessages(MSG_EXPAND_SETTINGS);
Jason Monka9927322015-12-13 16:22:37 -0500158 mHandler.obtainMessage(MSG_EXPAND_SETTINGS, subPanel).sendToTarget();
Joe Onorato4762c2d2010-05-17 15:42:59 -0700159 }
160 }
161
Dianne Hackborn3a3a6cf2012-03-26 10:24:04 -0700162 public void setSystemUiVisibility(int vis, int mask) {
Jason Monk07473ce2016-01-05 14:59:19 -0500163 synchronized (mLock) {
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -0700164 // Don't coalesce these, since it might have one time flags set such as
165 // STATUS_BAR_UNHIDE which might get lost.
Dianne Hackborn3a3a6cf2012-03-26 10:24:04 -0700166 mHandler.obtainMessage(MSG_SET_SYSTEMUI_VISIBILITY, vis, mask, null).sendToTarget();
Joe Onorato93056472010-09-10 10:30:46 -0400167 }
168 }
169
Dianne Hackborn7d049322011-06-14 15:00:32 -0700170 public void topAppWindowChanged(boolean menuVisible) {
Jason Monk07473ce2016-01-05 14:59:19 -0500171 synchronized (mLock) {
Dianne Hackborn7d049322011-06-14 15:00:32 -0700172 mHandler.removeMessages(MSG_TOP_APP_WINDOW_CHANGED);
173 mHandler.obtainMessage(MSG_TOP_APP_WINDOW_CHANGED, menuVisible ? 1 : 0, 0,
174 null).sendToTarget();
Daniel Sandlere02d8082010-10-08 15:13:22 -0400175 }
176 }
177
Jason Monkb605fec2014-05-02 17:04:10 -0400178 public void setImeWindowStatus(IBinder token, int vis, int backDisposition,
179 boolean showImeSwitcher) {
Jason Monk07473ce2016-01-05 14:59:19 -0500180 synchronized (mLock) {
satok06487a52010-10-29 11:37:18 +0900181 mHandler.removeMessages(MSG_SHOW_IME_BUTTON);
Jason Monkb605fec2014-05-02 17:04:10 -0400182 Message m = mHandler.obtainMessage(MSG_SHOW_IME_BUTTON, vis, backDisposition, token);
183 m.getData().putBoolean(SHOW_IME_SWITCHER_KEY, showImeSwitcher);
184 m.sendToTarget();
satok06487a52010-10-29 11:37:18 +0900185 }
186 }
187
Winson Chung1e8d71b2014-05-16 17:05:22 -0700188 public void showRecentApps(boolean triggeredFromAltTab) {
Jason Monk07473ce2016-01-05 14:59:19 -0500189 synchronized (mLock) {
Winson Chung1e8d71b2014-05-16 17:05:22 -0700190 mHandler.removeMessages(MSG_SHOW_RECENT_APPS);
191 mHandler.obtainMessage(MSG_SHOW_RECENT_APPS,
192 triggeredFromAltTab ? 1 : 0, 0, null).sendToTarget();
193 }
194 }
195
Winson Chungcdcd4872014-08-05 18:00:13 -0700196 public void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
Jason Monk07473ce2016-01-05 14:59:19 -0500197 synchronized (mLock) {
Winson Chung1e8d71b2014-05-16 17:05:22 -0700198 mHandler.removeMessages(MSG_HIDE_RECENT_APPS);
Winson Chung6cb485f2014-05-19 10:30:43 -0700199 mHandler.obtainMessage(MSG_HIDE_RECENT_APPS,
Winson Chungcdcd4872014-08-05 18:00:13 -0700200 triggeredFromAltTab ? 1 : 0, triggeredFromHomeKey ? 1 : 0,
201 null).sendToTarget();
Winson Chung1e8d71b2014-05-16 17:05:22 -0700202 }
203 }
204
Michael Jurka3b1fc472011-06-13 10:54:40 -0700205 public void toggleRecentApps() {
Jason Monk07473ce2016-01-05 14:59:19 -0500206 synchronized (mLock) {
Michael Jurka3b1fc472011-06-13 10:54:40 -0700207 mHandler.removeMessages(MSG_TOGGLE_RECENT_APPS);
208 mHandler.obtainMessage(MSG_TOGGLE_RECENT_APPS, 0, 0, null).sendToTarget();
209 }
210 }
211
Michael Jurka7f2668c2012-03-27 07:49:52 -0700212 public void preloadRecentApps() {
Jason Monk07473ce2016-01-05 14:59:19 -0500213 synchronized (mLock) {
Michael Jurka7f2668c2012-03-27 07:49:52 -0700214 mHandler.removeMessages(MSG_PRELOAD_RECENT_APPS);
215 mHandler.obtainMessage(MSG_PRELOAD_RECENT_APPS, 0, 0, null).sendToTarget();
216 }
217 }
218
219 public void cancelPreloadRecentApps() {
Jason Monk07473ce2016-01-05 14:59:19 -0500220 synchronized (mLock) {
Michael Jurka7f2668c2012-03-27 07:49:52 -0700221 mHandler.removeMessages(MSG_CANCEL_PRELOAD_RECENT_APPS);
222 mHandler.obtainMessage(MSG_CANCEL_PRELOAD_RECENT_APPS, 0, 0, null).sendToTarget();
223 }
224 }
225
Clara Bayarrif2debb12015-07-10 14:47:17 +0100226 @Override
Andrei Stingaceanuc22ab792016-01-07 12:39:38 +0000227 public void toggleKeyboardShortcutsMenu() {
Jason Monk07473ce2016-01-05 14:59:19 -0500228 synchronized (mLock) {
Andrei Stingaceanuc22ab792016-01-07 12:39:38 +0000229 mHandler.removeMessages(MSG_TOGGLE_KEYBOARD_SHORTCUTS);
230 mHandler.obtainMessage(MSG_TOGGLE_KEYBOARD_SHORTCUTS).sendToTarget();
Clara Bayarrif2debb12015-07-10 14:47:17 +0100231 }
232 }
233
John Spurlock97642182013-07-29 17:58:39 -0400234 public void setWindowState(int window, int state) {
Jason Monk07473ce2016-01-05 14:59:19 -0500235 synchronized (mLock) {
John Spurlock5b9145b2013-08-20 15:13:47 -0400236 // don't coalesce these
John Spurlock97642182013-07-29 17:58:39 -0400237 mHandler.obtainMessage(MSG_SET_WINDOW_STATE, window, state, null).sendToTarget();
238 }
239 }
240
John Spurlockcad57682014-07-26 17:09:56 -0400241 public void buzzBeepBlinked() {
Jason Monk07473ce2016-01-05 14:59:19 -0500242 synchronized (mLock) {
John Spurlockcad57682014-07-26 17:09:56 -0400243 mHandler.removeMessages(MSG_BUZZ_BEEP_BLINKED);
244 mHandler.sendEmptyMessage(MSG_BUZZ_BEEP_BLINKED);
245 }
246 }
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100247
John Spurlockcb566aa2014-08-03 22:58:28 -0400248 public void notificationLightOff() {
Jason Monk07473ce2016-01-05 14:59:19 -0500249 synchronized (mLock) {
John Spurlockcb566aa2014-08-03 22:58:28 -0400250 mHandler.sendEmptyMessage(MSG_NOTIFICATION_LIGHT_OFF);
251 }
252 }
253
254 public void notificationLightPulse(int argb, int onMillis, int offMillis) {
Jason Monk07473ce2016-01-05 14:59:19 -0500255 synchronized (mLock) {
John Spurlockcb566aa2014-08-03 22:58:28 -0400256 mHandler.obtainMessage(MSG_NOTIFICATION_LIGHT_PULSE, onMillis, offMillis, argb)
257 .sendToTarget();
258 }
259 }
260
Jason Monk5565cb42014-09-12 10:59:21 -0400261 public void showScreenPinningRequest() {
Jason Monk07473ce2016-01-05 14:59:19 -0500262 synchronized (mLock) {
Jason Monk5565cb42014-09-12 10:59:21 -0400263 mHandler.sendEmptyMessage(MSG_SHOW_SCREEN_PIN_REQUEST);
264 }
265 }
266
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100267 public void appTransitionPending() {
Jason Monk07473ce2016-01-05 14:59:19 -0500268 synchronized (mLock) {
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100269 mHandler.removeMessages(MSG_APP_TRANSITION_PENDING);
270 mHandler.sendEmptyMessage(MSG_APP_TRANSITION_PENDING);
271 }
272 }
273
274 public void appTransitionCancelled() {
Jason Monk07473ce2016-01-05 14:59:19 -0500275 synchronized (mLock) {
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100276 mHandler.removeMessages(MSG_APP_TRANSITION_PENDING);
277 mHandler.sendEmptyMessage(MSG_APP_TRANSITION_PENDING);
278 }
279 }
280
281 public void appTransitionStarting(long startTime, long duration) {
Jason Monk07473ce2016-01-05 14:59:19 -0500282 synchronized (mLock) {
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100283 mHandler.removeMessages(MSG_APP_TRANSITION_STARTING);
284 mHandler.obtainMessage(MSG_APP_TRANSITION_STARTING, Pair.create(startTime, duration))
285 .sendToTarget();
286 }
287 }
288
Adrian Roos4f43dc02015-06-17 16:43:38 -0700289 public void showAssistDisclosure() {
Jason Monk07473ce2016-01-05 14:59:19 -0500290 synchronized (mLock) {
Adrian Roos4f43dc02015-06-17 16:43:38 -0700291 mHandler.removeMessages(MSG_ASSIST_DISCLOSURE);
292 mHandler.obtainMessage(MSG_ASSIST_DISCLOSURE).sendToTarget();
293 }
294 }
295
Jorim Jaggi165ce062015-07-06 16:18:11 -0700296 public void startAssist(Bundle args) {
Jason Monk07473ce2016-01-05 14:59:19 -0500297 synchronized (mLock) {
Jorim Jaggi165ce062015-07-06 16:18:11 -0700298 mHandler.removeMessages(MSG_START_ASSIST);
299 mHandler.obtainMessage(MSG_START_ASSIST, args).sendToTarget();
300 }
301 }
302
Selim Cinek372d1bd2015-08-14 13:19:37 -0700303 @Override
Jorim Jaggi40aa8812015-09-23 12:59:22 -0700304 public void onCameraLaunchGestureDetected(int source) {
Jason Monk07473ce2016-01-05 14:59:19 -0500305 synchronized (mLock) {
Selim Cinek372d1bd2015-08-14 13:19:37 -0700306 mHandler.removeMessages(MSG_CAMERA_LAUNCH_GESTURE);
Jorim Jaggi40aa8812015-09-23 12:59:22 -0700307 mHandler.obtainMessage(MSG_CAMERA_LAUNCH_GESTURE, source, 0).sendToTarget();
Selim Cinek372d1bd2015-08-14 13:19:37 -0700308 }
309 }
310
Joe Onorato0cbda992010-05-02 16:28:15 -0700311 private final class H extends Handler {
312 public void handleMessage(Message msg) {
Joe Onoratof3f0e052010-05-14 18:49:29 -0700313 final int what = msg.what & MSG_MASK;
Joe Onorato66d7d012010-05-14 10:05:10 -0700314 switch (what) {
Joe Onorato0cbda992010-05-02 16:28:15 -0700315 case MSG_ICON: {
Joe Onorato0cbda992010-05-02 16:28:15 -0700316 switch (msg.arg1) {
317 case OP_SET_ICON: {
Jason Monk07473ce2016-01-05 14:59:19 -0500318 Pair<String, StatusBarIcon> p = (Pair<String, StatusBarIcon>) msg.obj;
319 mCallbacks.setIcon(p.first, p.second);
Joe Onorato0cbda992010-05-02 16:28:15 -0700320 break;
321 }
322 case OP_REMOVE_ICON:
Jason Monk07473ce2016-01-05 14:59:19 -0500323 mCallbacks.removeIcon((String) msg.obj);
Joe Onorato0cbda992010-05-02 16:28:15 -0700324 break;
325 }
326 break;
Joe Onoratof3f0e052010-05-14 18:49:29 -0700327 }
328 case MSG_DISABLE:
Benjamin Franzcde0a2a2015-04-23 17:19:48 +0100329 mCallbacks.disable(msg.arg1, msg.arg2, true /* animate */);
Joe Onoratof3f0e052010-05-14 18:49:29 -0700330 break;
Svetoslav Ganove20a1772012-09-25 16:07:46 -0700331 case MSG_EXPAND_NOTIFICATIONS:
Daniel Sandler11cf1782012-09-27 14:03:08 -0400332 mCallbacks.animateExpandNotificationsPanel();
Svetoslav Ganove20a1772012-09-25 16:07:46 -0700333 break;
Daniel Sandler11cf1782012-09-27 14:03:08 -0400334 case MSG_COLLAPSE_PANELS:
335 mCallbacks.animateCollapsePanels(0);
Svetoslav Ganove20a1772012-09-25 16:07:46 -0700336 break;
Daniel Sandler11cf1782012-09-27 14:03:08 -0400337 case MSG_EXPAND_SETTINGS:
Jason Monka9927322015-12-13 16:22:37 -0500338 mCallbacks.animateExpandSettingsPanel((String) msg.obj);
Joe Onorato93056472010-09-10 10:30:46 -0400339 break;
Daniel Sandler60ee2562011-07-22 12:34:33 -0400340 case MSG_SET_SYSTEMUI_VISIBILITY:
Dianne Hackborn3a3a6cf2012-03-26 10:24:04 -0700341 mCallbacks.setSystemUiVisibility(msg.arg1, msg.arg2);
Joe Onorato93056472010-09-10 10:30:46 -0400342 break;
Dianne Hackborn7d049322011-06-14 15:00:32 -0700343 case MSG_TOP_APP_WINDOW_CHANGED:
344 mCallbacks.topAppWindowChanged(msg.arg1 != 0);
Daniel Sandlere02d8082010-10-08 15:13:22 -0400345 break;
satok06487a52010-10-29 11:37:18 +0900346 case MSG_SHOW_IME_BUTTON:
Jason Monkb605fec2014-05-02 17:04:10 -0400347 mCallbacks.setImeWindowStatus((IBinder) msg.obj, msg.arg1, msg.arg2,
348 msg.getData().getBoolean(SHOW_IME_SWITCHER_KEY, false));
satok06487a52010-10-29 11:37:18 +0900349 break;
Winson Chung1e8d71b2014-05-16 17:05:22 -0700350 case MSG_SHOW_RECENT_APPS:
351 mCallbacks.showRecentApps(msg.arg1 != 0);
352 break;
353 case MSG_HIDE_RECENT_APPS:
Winson Chungcdcd4872014-08-05 18:00:13 -0700354 mCallbacks.hideRecentApps(msg.arg1 != 0, msg.arg2 != 0);
Winson Chung1e8d71b2014-05-16 17:05:22 -0700355 break;
Michael Jurka3b1fc472011-06-13 10:54:40 -0700356 case MSG_TOGGLE_RECENT_APPS:
357 mCallbacks.toggleRecentApps();
358 break;
Michael Jurka7f2668c2012-03-27 07:49:52 -0700359 case MSG_PRELOAD_RECENT_APPS:
360 mCallbacks.preloadRecentApps();
361 break;
362 case MSG_CANCEL_PRELOAD_RECENT_APPS:
363 mCallbacks.cancelPreloadRecentApps();
364 break;
Andrei Stingaceanuc22ab792016-01-07 12:39:38 +0000365 case MSG_TOGGLE_KEYBOARD_SHORTCUTS:
366 mCallbacks.toggleKeyboardShortcutsMenu();
Clara Bayarrif2debb12015-07-10 14:47:17 +0100367 break;
John Spurlock97642182013-07-29 17:58:39 -0400368 case MSG_SET_WINDOW_STATE:
369 mCallbacks.setWindowState(msg.arg1, msg.arg2);
370 break;
John Spurlockcad57682014-07-26 17:09:56 -0400371 case MSG_BUZZ_BEEP_BLINKED:
372 mCallbacks.buzzBeepBlinked();
373 break;
John Spurlockcb566aa2014-08-03 22:58:28 -0400374 case MSG_NOTIFICATION_LIGHT_OFF:
375 mCallbacks.notificationLightOff();
376 break;
377 case MSG_NOTIFICATION_LIGHT_PULSE:
378 mCallbacks.notificationLightPulse((Integer) msg.obj, msg.arg1, msg.arg2);
379 break;
Jason Monk5565cb42014-09-12 10:59:21 -0400380 case MSG_SHOW_SCREEN_PIN_REQUEST:
381 mCallbacks.showScreenPinningRequest();
382 break;
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100383 case MSG_APP_TRANSITION_PENDING:
384 mCallbacks.appTransitionPending();
385 break;
386 case MSG_APP_TRANSITION_CANCELLED:
387 mCallbacks.appTransitionCancelled();
388 break;
389 case MSG_APP_TRANSITION_STARTING:
390 Pair<Long, Long> data = (Pair<Long, Long>) msg.obj;
391 mCallbacks.appTransitionStarting(data.first, data.second);
392 break;
Adrian Roos4f43dc02015-06-17 16:43:38 -0700393 case MSG_ASSIST_DISCLOSURE:
394 mCallbacks.showAssistDisclosure();
395 break;
Jorim Jaggi165ce062015-07-06 16:18:11 -0700396 case MSG_START_ASSIST:
397 mCallbacks.startAssist((Bundle) msg.obj);
398 break;
Selim Cinek372d1bd2015-08-14 13:19:37 -0700399 case MSG_CAMERA_LAUNCH_GESTURE:
Jorim Jaggi40aa8812015-09-23 12:59:22 -0700400 mCallbacks.onCameraLaunchGestureDetected(msg.arg1);
Selim Cinek372d1bd2015-08-14 13:19:37 -0700401 break;
Joe Onorato0cbda992010-05-02 16:28:15 -0700402 }
403 }
404 }
405}
406