Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 1 | /* |
| 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 Onorato | 79de0c5 | 2010-05-26 17:03:26 -0400 | [diff] [blame] | 17 | package com.android.systemui.statusbar; |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 18 | |
| 19 | import android.os.Handler; |
Joe Onorato | a0c56fe | 2010-05-20 10:21:52 -0700 | [diff] [blame] | 20 | import android.os.IBinder; |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 21 | import android.os.Message; |
Daniel Sandler | 5feceeb | 2013-03-22 18:29:23 -0700 | [diff] [blame] | 22 | import android.service.notification.StatusBarNotification; |
John Spurlock | de84f0e | 2013-06-12 12:41:00 -0400 | [diff] [blame] | 23 | |
Jorim Jaggi | 380ecb8 | 2014-03-14 17:25:20 +0100 | [diff] [blame] | 24 | import com.android.internal.policy.IKeyguardShowCallback; |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 25 | import com.android.internal.statusbar.IStatusBar; |
| 26 | import com.android.internal.statusbar.StatusBarIcon; |
| 27 | import com.android.internal.statusbar.StatusBarIconList; |
| 28 | |
Joe Onorato | f3f0e05 | 2010-05-14 18:49:29 -0700 | [diff] [blame] | 29 | /** |
| 30 | * This class takes the functions from IStatusBar that come in on |
| 31 | * binder pool threads and posts messages to get them onto the main |
| 32 | * thread, and calls onto Callbacks. It also takes care of |
Joe Onorato | 4762c2d | 2010-05-17 15:42:59 -0700 | [diff] [blame] | 33 | * coalescing these calls so they don't stack up. For the calls |
| 34 | * are coalesced, note that they are all idempotent. |
Joe Onorato | f3f0e05 | 2010-05-14 18:49:29 -0700 | [diff] [blame] | 35 | */ |
Joe Onorato | 808182d | 2010-07-09 18:52:06 -0400 | [diff] [blame] | 36 | public class CommandQueue extends IStatusBar.Stub { |
Daniel Sandler | 1d4d30a | 2011-04-28 12:35:29 -0400 | [diff] [blame] | 37 | private static final int INDEX_MASK = 0xffff; |
| 38 | private static final int MSG_SHIFT = 16; |
| 39 | private static final int MSG_MASK = 0xffff << MSG_SHIFT; |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 40 | |
Daniel Sandler | 1d4d30a | 2011-04-28 12:35:29 -0400 | [diff] [blame] | 41 | private static final int OP_SET_ICON = 1; |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 42 | private static final int OP_REMOVE_ICON = 2; |
| 43 | |
Svetoslav Ganov | e20a177 | 2012-09-25 16:07:46 -0700 | [diff] [blame] | 44 | private static final int MSG_ICON = 1 << MSG_SHIFT; |
| 45 | private static final int MSG_ADD_NOTIFICATION = 2 << MSG_SHIFT; |
| 46 | private static final int MSG_UPDATE_NOTIFICATION = 3 << MSG_SHIFT; |
| 47 | private static final int MSG_REMOVE_NOTIFICATION = 4 << MSG_SHIFT; |
| 48 | private static final int MSG_DISABLE = 5 << MSG_SHIFT; |
| 49 | private static final int MSG_EXPAND_NOTIFICATIONS = 6 << MSG_SHIFT; |
Daniel Sandler | 11cf178 | 2012-09-27 14:03:08 -0400 | [diff] [blame] | 50 | private static final int MSG_COLLAPSE_PANELS = 7 << MSG_SHIFT; |
| 51 | private static final int MSG_EXPAND_SETTINGS = 8 << MSG_SHIFT; |
| 52 | private static final int MSG_SET_SYSTEMUI_VISIBILITY = 9 << MSG_SHIFT; |
| 53 | private static final int MSG_TOP_APP_WINDOW_CHANGED = 10 << MSG_SHIFT; |
| 54 | private static final int MSG_SHOW_IME_BUTTON = 11 << MSG_SHIFT; |
| 55 | private static final int MSG_SET_HARD_KEYBOARD_STATUS = 12 << MSG_SHIFT; |
| 56 | private static final int MSG_TOGGLE_RECENT_APPS = 13 << MSG_SHIFT; |
| 57 | private static final int MSG_PRELOAD_RECENT_APPS = 14 << MSG_SHIFT; |
| 58 | private static final int MSG_CANCEL_PRELOAD_RECENT_APPS = 15 << MSG_SHIFT; |
John Spurlock | 56d007b | 2013-10-28 18:40:56 -0400 | [diff] [blame] | 59 | private static final int MSG_SET_WINDOW_STATE = 16 << MSG_SHIFT; |
Winson Chung | 1e8d71b | 2014-05-16 17:05:22 -0700 | [diff] [blame] | 60 | private static final int MSG_SHOW_RECENT_APPS = 17 << MSG_SHIFT; |
| 61 | private static final int MSG_HIDE_RECENT_APPS = 18 << MSG_SHIFT; |
Daniel Sandler | 328310c | 2011-09-23 15:56:52 -0400 | [diff] [blame] | 62 | |
Jim Miller | 9a720f5 | 2012-05-30 03:19:43 -0700 | [diff] [blame] | 63 | public static final int FLAG_EXCLUDE_NONE = 0; |
| 64 | public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0; |
| 65 | public static final int FLAG_EXCLUDE_RECENTS_PANEL = 1 << 1; |
| 66 | public static final int FLAG_EXCLUDE_NOTIFICATION_PANEL = 1 << 2; |
| 67 | public static final int FLAG_EXCLUDE_INPUT_METHODS_PANEL = 1 << 3; |
| 68 | public static final int FLAG_EXCLUDE_COMPAT_MODE_PANEL = 1 << 4; |
| 69 | |
Jason Monk | b605fec | 2014-05-02 17:04:10 -0400 | [diff] [blame] | 70 | private static final String SHOW_IME_SWITCHER_KEY = "showImeSwitcherKey"; |
| 71 | |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 72 | private StatusBarIconList mList; |
| 73 | private Callbacks mCallbacks; |
| 74 | private Handler mHandler = new H(); |
| 75 | |
Joe Onorato | a0c56fe | 2010-05-20 10:21:52 -0700 | [diff] [blame] | 76 | private class NotificationQueueEntry { |
| 77 | IBinder key; |
| 78 | StatusBarNotification notification; |
| 79 | } |
| 80 | |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 81 | /** |
| 82 | * These methods are called back on the main thread. |
| 83 | */ |
| 84 | public interface Callbacks { |
| 85 | public void addIcon(String slot, int index, int viewIndex, StatusBarIcon icon); |
| 86 | public void updateIcon(String slot, int index, int viewIndex, |
| 87 | StatusBarIcon old, StatusBarIcon icon); |
| 88 | public void removeIcon(String slot, int index, int viewIndex); |
Joe Onorato | a0c56fe | 2010-05-20 10:21:52 -0700 | [diff] [blame] | 89 | public void addNotification(IBinder key, StatusBarNotification notification); |
| 90 | public void updateNotification(IBinder key, StatusBarNotification notification); |
| 91 | public void removeNotification(IBinder key); |
Joe Onorato | f3f0e05 | 2010-05-14 18:49:29 -0700 | [diff] [blame] | 92 | public void disable(int state); |
Daniel Sandler | 11cf178 | 2012-09-27 14:03:08 -0400 | [diff] [blame] | 93 | public void animateExpandNotificationsPanel(); |
| 94 | public void animateCollapsePanels(int flags); |
| 95 | public void animateExpandSettingsPanel(); |
Dianne Hackborn | 3a3a6cf | 2012-03-26 10:24:04 -0700 | [diff] [blame] | 96 | public void setSystemUiVisibility(int vis, int mask); |
Dianne Hackborn | 7d04932 | 2011-06-14 15:00:32 -0700 | [diff] [blame] | 97 | public void topAppWindowChanged(boolean visible); |
Jason Monk | b605fec | 2014-05-02 17:04:10 -0400 | [diff] [blame] | 98 | public void setImeWindowStatus(IBinder token, int vis, int backDisposition, |
| 99 | boolean showImeSwitcher); |
Jeff Brown | 2992ea7 | 2011-01-28 22:04:14 -0800 | [diff] [blame] | 100 | public void setHardKeyboardStatus(boolean available, boolean enabled); |
Winson Chung | 1e8d71b | 2014-05-16 17:05:22 -0700 | [diff] [blame] | 101 | public void showRecentApps(boolean triggeredFromAltTab); |
Winson Chung | 6cb485f | 2014-05-19 10:30:43 -0700 | [diff] [blame^] | 102 | public void hideRecentApps(boolean triggeredFromAltTab); |
Michael Jurka | 3b1fc47 | 2011-06-13 10:54:40 -0700 | [diff] [blame] | 103 | public void toggleRecentApps(); |
Michael Jurka | 7f2668c | 2012-03-27 07:49:52 -0700 | [diff] [blame] | 104 | public void preloadRecentApps(); |
Winson Chung | 1e8d71b | 2014-05-16 17:05:22 -0700 | [diff] [blame] | 105 | public void cancelPreloadRecentApps(); |
Jim Miller | e898ac5 | 2012-04-06 17:10:57 -0700 | [diff] [blame] | 106 | public void showSearchPanel(); |
| 107 | public void hideSearchPanel(); |
John Spurlock | 9764218 | 2013-07-29 17:58:39 -0400 | [diff] [blame] | 108 | public void setWindowState(int window, int state); |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 109 | |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | public CommandQueue(Callbacks callbacks, StatusBarIconList list) { |
| 113 | mCallbacks = callbacks; |
| 114 | mList = list; |
| 115 | } |
| 116 | |
| 117 | public void setIcon(int index, StatusBarIcon icon) { |
| 118 | synchronized (mList) { |
| 119 | int what = MSG_ICON | index; |
| 120 | mHandler.removeMessages(what); |
| 121 | mHandler.obtainMessage(what, OP_SET_ICON, 0, icon.clone()).sendToTarget(); |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | public void removeIcon(int index) { |
| 126 | synchronized (mList) { |
| 127 | int what = MSG_ICON | index; |
| 128 | mHandler.removeMessages(what); |
| 129 | mHandler.obtainMessage(what, OP_REMOVE_ICON, 0, null).sendToTarget(); |
| 130 | } |
| 131 | } |
| 132 | |
Joe Onorato | a0c56fe | 2010-05-20 10:21:52 -0700 | [diff] [blame] | 133 | public void addNotification(IBinder key, StatusBarNotification notification) { |
| 134 | synchronized (mList) { |
| 135 | NotificationQueueEntry ne = new NotificationQueueEntry(); |
| 136 | ne.key = key; |
| 137 | ne.notification = notification; |
| 138 | mHandler.obtainMessage(MSG_ADD_NOTIFICATION, 0, 0, ne).sendToTarget(); |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | public void updateNotification(IBinder key, StatusBarNotification notification) { |
| 143 | synchronized (mList) { |
| 144 | NotificationQueueEntry ne = new NotificationQueueEntry(); |
| 145 | ne.key = key; |
| 146 | ne.notification = notification; |
| 147 | mHandler.obtainMessage(MSG_UPDATE_NOTIFICATION, 0, 0, ne).sendToTarget(); |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | public void removeNotification(IBinder key) { |
| 152 | synchronized (mList) { |
| 153 | mHandler.obtainMessage(MSG_REMOVE_NOTIFICATION, 0, 0, key).sendToTarget(); |
| 154 | } |
| 155 | } |
| 156 | |
Joe Onorato | f3f0e05 | 2010-05-14 18:49:29 -0700 | [diff] [blame] | 157 | public void disable(int state) { |
| 158 | synchronized (mList) { |
| 159 | mHandler.removeMessages(MSG_DISABLE); |
| 160 | mHandler.obtainMessage(MSG_DISABLE, state, 0, null).sendToTarget(); |
| 161 | } |
| 162 | } |
| 163 | |
Daniel Sandler | 11cf178 | 2012-09-27 14:03:08 -0400 | [diff] [blame] | 164 | public void animateExpandNotificationsPanel() { |
Joe Onorato | 4762c2d | 2010-05-17 15:42:59 -0700 | [diff] [blame] | 165 | synchronized (mList) { |
Svetoslav Ganov | e20a177 | 2012-09-25 16:07:46 -0700 | [diff] [blame] | 166 | mHandler.removeMessages(MSG_EXPAND_NOTIFICATIONS); |
| 167 | mHandler.sendEmptyMessage(MSG_EXPAND_NOTIFICATIONS); |
Joe Onorato | 4762c2d | 2010-05-17 15:42:59 -0700 | [diff] [blame] | 168 | } |
| 169 | } |
| 170 | |
Daniel Sandler | 11cf178 | 2012-09-27 14:03:08 -0400 | [diff] [blame] | 171 | public void animateCollapsePanels() { |
Svetoslav Ganov | e20a177 | 2012-09-25 16:07:46 -0700 | [diff] [blame] | 172 | synchronized (mList) { |
Daniel Sandler | 11cf178 | 2012-09-27 14:03:08 -0400 | [diff] [blame] | 173 | mHandler.removeMessages(MSG_COLLAPSE_PANELS); |
| 174 | mHandler.sendEmptyMessage(MSG_COLLAPSE_PANELS); |
Svetoslav Ganov | e20a177 | 2012-09-25 16:07:46 -0700 | [diff] [blame] | 175 | } |
Jim Miller | 9a720f5 | 2012-05-30 03:19:43 -0700 | [diff] [blame] | 176 | } |
| 177 | |
Daniel Sandler | 11cf178 | 2012-09-27 14:03:08 -0400 | [diff] [blame] | 178 | public void animateExpandSettingsPanel() { |
Joe Onorato | 4762c2d | 2010-05-17 15:42:59 -0700 | [diff] [blame] | 179 | synchronized (mList) { |
Daniel Sandler | 11cf178 | 2012-09-27 14:03:08 -0400 | [diff] [blame] | 180 | mHandler.removeMessages(MSG_EXPAND_SETTINGS); |
| 181 | mHandler.sendEmptyMessage(MSG_EXPAND_SETTINGS); |
Joe Onorato | 4762c2d | 2010-05-17 15:42:59 -0700 | [diff] [blame] | 182 | } |
| 183 | } |
| 184 | |
Dianne Hackborn | 3a3a6cf | 2012-03-26 10:24:04 -0700 | [diff] [blame] | 185 | public void setSystemUiVisibility(int vis, int mask) { |
Joe Onorato | 9305647 | 2010-09-10 10:30:46 -0400 | [diff] [blame] | 186 | synchronized (mList) { |
Daniel Sandler | 60ee256 | 2011-07-22 12:34:33 -0400 | [diff] [blame] | 187 | mHandler.removeMessages(MSG_SET_SYSTEMUI_VISIBILITY); |
Dianne Hackborn | 3a3a6cf | 2012-03-26 10:24:04 -0700 | [diff] [blame] | 188 | mHandler.obtainMessage(MSG_SET_SYSTEMUI_VISIBILITY, vis, mask, null).sendToTarget(); |
Joe Onorato | 9305647 | 2010-09-10 10:30:46 -0400 | [diff] [blame] | 189 | } |
| 190 | } |
| 191 | |
Dianne Hackborn | 7d04932 | 2011-06-14 15:00:32 -0700 | [diff] [blame] | 192 | public void topAppWindowChanged(boolean menuVisible) { |
Daniel Sandler | e02d808 | 2010-10-08 15:13:22 -0400 | [diff] [blame] | 193 | synchronized (mList) { |
Dianne Hackborn | 7d04932 | 2011-06-14 15:00:32 -0700 | [diff] [blame] | 194 | mHandler.removeMessages(MSG_TOP_APP_WINDOW_CHANGED); |
| 195 | mHandler.obtainMessage(MSG_TOP_APP_WINDOW_CHANGED, menuVisible ? 1 : 0, 0, |
| 196 | null).sendToTarget(); |
Daniel Sandler | e02d808 | 2010-10-08 15:13:22 -0400 | [diff] [blame] | 197 | } |
| 198 | } |
| 199 | |
Jason Monk | b605fec | 2014-05-02 17:04:10 -0400 | [diff] [blame] | 200 | public void setImeWindowStatus(IBinder token, int vis, int backDisposition, |
| 201 | boolean showImeSwitcher) { |
satok | 06487a5 | 2010-10-29 11:37:18 +0900 | [diff] [blame] | 202 | synchronized (mList) { |
| 203 | mHandler.removeMessages(MSG_SHOW_IME_BUTTON); |
Jason Monk | b605fec | 2014-05-02 17:04:10 -0400 | [diff] [blame] | 204 | Message m = mHandler.obtainMessage(MSG_SHOW_IME_BUTTON, vis, backDisposition, token); |
| 205 | m.getData().putBoolean(SHOW_IME_SWITCHER_KEY, showImeSwitcher); |
| 206 | m.sendToTarget(); |
satok | 06487a5 | 2010-10-29 11:37:18 +0900 | [diff] [blame] | 207 | } |
| 208 | } |
| 209 | |
Jeff Brown | 2992ea7 | 2011-01-28 22:04:14 -0800 | [diff] [blame] | 210 | public void setHardKeyboardStatus(boolean available, boolean enabled) { |
| 211 | synchronized (mList) { |
| 212 | mHandler.removeMessages(MSG_SET_HARD_KEYBOARD_STATUS); |
| 213 | mHandler.obtainMessage(MSG_SET_HARD_KEYBOARD_STATUS, |
| 214 | available ? 1 : 0, enabled ? 1 : 0).sendToTarget(); |
| 215 | } |
| 216 | } |
| 217 | |
Winson Chung | 1e8d71b | 2014-05-16 17:05:22 -0700 | [diff] [blame] | 218 | public void showRecentApps(boolean triggeredFromAltTab) { |
| 219 | synchronized (mList) { |
| 220 | mHandler.removeMessages(MSG_SHOW_RECENT_APPS); |
| 221 | mHandler.obtainMessage(MSG_SHOW_RECENT_APPS, |
| 222 | triggeredFromAltTab ? 1 : 0, 0, null).sendToTarget(); |
| 223 | } |
| 224 | } |
| 225 | |
Winson Chung | 6cb485f | 2014-05-19 10:30:43 -0700 | [diff] [blame^] | 226 | public void hideRecentApps(boolean triggeredFromAltTab) { |
Winson Chung | 1e8d71b | 2014-05-16 17:05:22 -0700 | [diff] [blame] | 227 | synchronized (mList) { |
| 228 | mHandler.removeMessages(MSG_HIDE_RECENT_APPS); |
Winson Chung | 6cb485f | 2014-05-19 10:30:43 -0700 | [diff] [blame^] | 229 | mHandler.obtainMessage(MSG_HIDE_RECENT_APPS, |
| 230 | triggeredFromAltTab ? 1 : 0, 0, null).sendToTarget(); |
Winson Chung | 1e8d71b | 2014-05-16 17:05:22 -0700 | [diff] [blame] | 231 | } |
| 232 | } |
| 233 | |
Michael Jurka | 3b1fc47 | 2011-06-13 10:54:40 -0700 | [diff] [blame] | 234 | public void toggleRecentApps() { |
| 235 | synchronized (mList) { |
| 236 | mHandler.removeMessages(MSG_TOGGLE_RECENT_APPS); |
| 237 | mHandler.obtainMessage(MSG_TOGGLE_RECENT_APPS, 0, 0, null).sendToTarget(); |
| 238 | } |
| 239 | } |
| 240 | |
Michael Jurka | 7f2668c | 2012-03-27 07:49:52 -0700 | [diff] [blame] | 241 | public void preloadRecentApps() { |
| 242 | synchronized (mList) { |
| 243 | mHandler.removeMessages(MSG_PRELOAD_RECENT_APPS); |
| 244 | mHandler.obtainMessage(MSG_PRELOAD_RECENT_APPS, 0, 0, null).sendToTarget(); |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | public void cancelPreloadRecentApps() { |
| 249 | synchronized (mList) { |
| 250 | mHandler.removeMessages(MSG_CANCEL_PRELOAD_RECENT_APPS); |
| 251 | mHandler.obtainMessage(MSG_CANCEL_PRELOAD_RECENT_APPS, 0, 0, null).sendToTarget(); |
| 252 | } |
| 253 | } |
| 254 | |
John Spurlock | 9764218 | 2013-07-29 17:58:39 -0400 | [diff] [blame] | 255 | public void setWindowState(int window, int state) { |
| 256 | synchronized (mList) { |
John Spurlock | 5b9145b | 2013-08-20 15:13:47 -0400 | [diff] [blame] | 257 | // don't coalesce these |
John Spurlock | 9764218 | 2013-07-29 17:58:39 -0400 | [diff] [blame] | 258 | mHandler.obtainMessage(MSG_SET_WINDOW_STATE, window, state, null).sendToTarget(); |
| 259 | } |
| 260 | } |
| 261 | |
Jorim Jaggi | 380ecb8 | 2014-03-14 17:25:20 +0100 | [diff] [blame] | 262 | |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 263 | private final class H extends Handler { |
| 264 | public void handleMessage(Message msg) { |
Joe Onorato | f3f0e05 | 2010-05-14 18:49:29 -0700 | [diff] [blame] | 265 | final int what = msg.what & MSG_MASK; |
Joe Onorato | 66d7d01 | 2010-05-14 10:05:10 -0700 | [diff] [blame] | 266 | switch (what) { |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 267 | case MSG_ICON: { |
Joe Onorato | f3f0e05 | 2010-05-14 18:49:29 -0700 | [diff] [blame] | 268 | final int index = msg.what & INDEX_MASK; |
| 269 | final int viewIndex = mList.getViewIndex(index); |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 270 | switch (msg.arg1) { |
| 271 | case OP_SET_ICON: { |
| 272 | StatusBarIcon icon = (StatusBarIcon)msg.obj; |
| 273 | StatusBarIcon old = mList.getIcon(index); |
| 274 | if (old == null) { |
| 275 | mList.setIcon(index, icon); |
| 276 | mCallbacks.addIcon(mList.getSlot(index), index, viewIndex, icon); |
| 277 | } else { |
| 278 | mList.setIcon(index, icon); |
| 279 | mCallbacks.updateIcon(mList.getSlot(index), index, viewIndex, |
| 280 | old, icon); |
| 281 | } |
| 282 | break; |
| 283 | } |
| 284 | case OP_REMOVE_ICON: |
Joe Onorato | 795f284 | 2010-09-27 11:34:46 -0700 | [diff] [blame] | 285 | if (mList.getIcon(index) != null) { |
| 286 | mList.removeIcon(index); |
| 287 | mCallbacks.removeIcon(mList.getSlot(index), index, viewIndex); |
| 288 | } |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 289 | break; |
| 290 | } |
| 291 | break; |
Joe Onorato | f3f0e05 | 2010-05-14 18:49:29 -0700 | [diff] [blame] | 292 | } |
Joe Onorato | a0c56fe | 2010-05-20 10:21:52 -0700 | [diff] [blame] | 293 | case MSG_ADD_NOTIFICATION: { |
| 294 | final NotificationQueueEntry ne = (NotificationQueueEntry)msg.obj; |
| 295 | mCallbacks.addNotification(ne.key, ne.notification); |
| 296 | break; |
| 297 | } |
| 298 | case MSG_UPDATE_NOTIFICATION: { |
| 299 | final NotificationQueueEntry ne = (NotificationQueueEntry)msg.obj; |
| 300 | mCallbacks.updateNotification(ne.key, ne.notification); |
| 301 | break; |
| 302 | } |
| 303 | case MSG_REMOVE_NOTIFICATION: { |
| 304 | mCallbacks.removeNotification((IBinder)msg.obj); |
| 305 | break; |
| 306 | } |
Joe Onorato | f3f0e05 | 2010-05-14 18:49:29 -0700 | [diff] [blame] | 307 | case MSG_DISABLE: |
| 308 | mCallbacks.disable(msg.arg1); |
| 309 | break; |
Svetoslav Ganov | e20a177 | 2012-09-25 16:07:46 -0700 | [diff] [blame] | 310 | case MSG_EXPAND_NOTIFICATIONS: |
Daniel Sandler | 11cf178 | 2012-09-27 14:03:08 -0400 | [diff] [blame] | 311 | mCallbacks.animateExpandNotificationsPanel(); |
Svetoslav Ganov | e20a177 | 2012-09-25 16:07:46 -0700 | [diff] [blame] | 312 | break; |
Daniel Sandler | 11cf178 | 2012-09-27 14:03:08 -0400 | [diff] [blame] | 313 | case MSG_COLLAPSE_PANELS: |
| 314 | mCallbacks.animateCollapsePanels(0); |
Svetoslav Ganov | e20a177 | 2012-09-25 16:07:46 -0700 | [diff] [blame] | 315 | break; |
Daniel Sandler | 11cf178 | 2012-09-27 14:03:08 -0400 | [diff] [blame] | 316 | case MSG_EXPAND_SETTINGS: |
| 317 | mCallbacks.animateExpandSettingsPanel(); |
Joe Onorato | 9305647 | 2010-09-10 10:30:46 -0400 | [diff] [blame] | 318 | break; |
Daniel Sandler | 60ee256 | 2011-07-22 12:34:33 -0400 | [diff] [blame] | 319 | case MSG_SET_SYSTEMUI_VISIBILITY: |
Dianne Hackborn | 3a3a6cf | 2012-03-26 10:24:04 -0700 | [diff] [blame] | 320 | mCallbacks.setSystemUiVisibility(msg.arg1, msg.arg2); |
Joe Onorato | 9305647 | 2010-09-10 10:30:46 -0400 | [diff] [blame] | 321 | break; |
Dianne Hackborn | 7d04932 | 2011-06-14 15:00:32 -0700 | [diff] [blame] | 322 | case MSG_TOP_APP_WINDOW_CHANGED: |
| 323 | mCallbacks.topAppWindowChanged(msg.arg1 != 0); |
Daniel Sandler | e02d808 | 2010-10-08 15:13:22 -0400 | [diff] [blame] | 324 | break; |
satok | 06487a5 | 2010-10-29 11:37:18 +0900 | [diff] [blame] | 325 | case MSG_SHOW_IME_BUTTON: |
Jason Monk | b605fec | 2014-05-02 17:04:10 -0400 | [diff] [blame] | 326 | mCallbacks.setImeWindowStatus((IBinder) msg.obj, msg.arg1, msg.arg2, |
| 327 | msg.getData().getBoolean(SHOW_IME_SWITCHER_KEY, false)); |
satok | 06487a5 | 2010-10-29 11:37:18 +0900 | [diff] [blame] | 328 | break; |
Jeff Brown | 2992ea7 | 2011-01-28 22:04:14 -0800 | [diff] [blame] | 329 | case MSG_SET_HARD_KEYBOARD_STATUS: |
| 330 | mCallbacks.setHardKeyboardStatus(msg.arg1 != 0, msg.arg2 != 0); |
| 331 | break; |
Winson Chung | 1e8d71b | 2014-05-16 17:05:22 -0700 | [diff] [blame] | 332 | case MSG_SHOW_RECENT_APPS: |
| 333 | mCallbacks.showRecentApps(msg.arg1 != 0); |
| 334 | break; |
| 335 | case MSG_HIDE_RECENT_APPS: |
Winson Chung | 6cb485f | 2014-05-19 10:30:43 -0700 | [diff] [blame^] | 336 | mCallbacks.hideRecentApps(msg.arg1 != 0); |
Winson Chung | 1e8d71b | 2014-05-16 17:05:22 -0700 | [diff] [blame] | 337 | break; |
Michael Jurka | 3b1fc47 | 2011-06-13 10:54:40 -0700 | [diff] [blame] | 338 | case MSG_TOGGLE_RECENT_APPS: |
| 339 | mCallbacks.toggleRecentApps(); |
| 340 | break; |
Michael Jurka | 7f2668c | 2012-03-27 07:49:52 -0700 | [diff] [blame] | 341 | case MSG_PRELOAD_RECENT_APPS: |
| 342 | mCallbacks.preloadRecentApps(); |
| 343 | break; |
| 344 | case MSG_CANCEL_PRELOAD_RECENT_APPS: |
| 345 | mCallbacks.cancelPreloadRecentApps(); |
| 346 | break; |
John Spurlock | 9764218 | 2013-07-29 17:58:39 -0400 | [diff] [blame] | 347 | case MSG_SET_WINDOW_STATE: |
| 348 | mCallbacks.setWindowState(msg.arg1, msg.arg2); |
| 349 | break; |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 350 | |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 351 | } |
| 352 | } |
| 353 | } |
| 354 | } |
| 355 | |