|
33 | 33 | * are coalesced, note that they are all idempotent. |
34 | 34 | */ |
35 | 35 | public class CommandQueue extends IStatusBar.Stub { |
36 | | - private static final String TAG = "StatusBar.CommandQueue"; |
37 | | - |
38 | 36 | private static final int INDEX_MASK = 0xffff; |
39 | 37 | private static final int MSG_SHIFT = 16; |
40 | 38 | private static final int MSG_MASK = 0xffff << MSG_SHIFT; |
41 | 39 |
|
42 | | - |
43 | | - private static final int MSG_ICON = 1 << MSG_SHIFT; |
44 | 40 | private static final int OP_SET_ICON = 1; |
45 | 41 | private static final int OP_REMOVE_ICON = 2; |
46 | 42 |
|
47 | | - private static final int MSG_ADD_NOTIFICATION = 2 << MSG_SHIFT; |
48 | | - private static final int MSG_UPDATE_NOTIFICATION = 3 << MSG_SHIFT; |
49 | | - private static final int MSG_REMOVE_NOTIFICATION = 4 << MSG_SHIFT; |
50 | | - |
51 | | - private static final int MSG_DISABLE = 5 << MSG_SHIFT; |
52 | | - |
53 | | - private static final int MSG_SET_VISIBILITY = 6 << MSG_SHIFT; |
54 | | - private static final int OP_EXPAND = 1; |
55 | | - private static final int OP_COLLAPSE = 2; |
56 | | - |
57 | | - private static final int MSG_SET_SYSTEMUI_VISIBILITY = 7 << MSG_SHIFT; |
58 | | - |
59 | | - private static final int MSG_TOP_APP_WINDOW_CHANGED = 8 << MSG_SHIFT; |
60 | | - private static final int MSG_SHOW_IME_BUTTON = 9 << MSG_SHIFT; |
61 | | - private static final int MSG_SET_HARD_KEYBOARD_STATUS = 10 << MSG_SHIFT; |
62 | | - |
63 | | - private static final int MSG_TOGGLE_RECENT_APPS = 11 << MSG_SHIFT; |
64 | | - private static final int MSG_PRELOAD_RECENT_APPS = 12 << MSG_SHIFT; |
65 | | - private static final int MSG_CANCEL_PRELOAD_RECENT_APPS = 13 << MSG_SHIFT; |
66 | | - |
67 | | - private static final int MSG_SET_NAVIGATION_ICON_HINTS = 14 << MSG_SHIFT; |
| 43 | + private static final int MSG_ICON = 1 << MSG_SHIFT; |
| 44 | + private static final int MSG_ADD_NOTIFICATION = 2 << MSG_SHIFT; |
| 45 | + private static final int MSG_UPDATE_NOTIFICATION = 3 << MSG_SHIFT; |
| 46 | + private static final int MSG_REMOVE_NOTIFICATION = 4 << MSG_SHIFT; |
| 47 | + private static final int MSG_DISABLE = 5 << MSG_SHIFT; |
| 48 | + private static final int MSG_EXPAND_NOTIFICATIONS = 6 << MSG_SHIFT; |
| 49 | + private static final int MSG_COLLAPSE_NOTIFICATIONS = 7 << MSG_SHIFT; |
| 50 | + private static final int MSG_EXPAND_QUICK_SETTINGS = 8 << MSG_SHIFT; |
| 51 | + private static final int MSG_COLLAPSE_QUICK_SETTINGS = 9 << MSG_SHIFT; |
| 52 | + private static final int MSG_SET_SYSTEMUI_VISIBILITY = 10 << MSG_SHIFT; |
| 53 | + private static final int MSG_TOP_APP_WINDOW_CHANGED = 11 << MSG_SHIFT; |
| 54 | + private static final int MSG_SHOW_IME_BUTTON = 12 << MSG_SHIFT; |
| 55 | + private static final int MSG_SET_HARD_KEYBOARD_STATUS = 13 << MSG_SHIFT; |
| 56 | + private static final int MSG_TOGGLE_RECENT_APPS = 14 << MSG_SHIFT; |
| 57 | + private static final int MSG_PRELOAD_RECENT_APPS = 15 << MSG_SHIFT; |
| 58 | + private static final int MSG_CANCEL_PRELOAD_RECENT_APPS = 16 << MSG_SHIFT; |
| 59 | + private static final int MSG_SET_NAVIGATION_ICON_HINTS = 17 << MSG_SHIFT; |
68 | 60 |
|
69 | 61 | public static final int FLAG_EXCLUDE_NONE = 0; |
70 | 62 | public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0; |
@@ -94,8 +86,10 @@ public void updateIcon(String slot, int index, int viewIndex, |
94 | 86 | public void updateNotification(IBinder key, StatusBarNotification notification); |
95 | 87 | public void removeNotification(IBinder key); |
96 | 88 | public void disable(int state); |
97 | | - public void animateExpand(); |
98 | | - public void animateCollapse(int flags); |
| 89 | + public void animateExpandNotifications(); |
| 90 | + public void animateCollapseNotifications(int flags); |
| 91 | + public void animateExpandQuickSettings(); |
| 92 | + public void animateCollapseQuickSettings(); |
99 | 93 | public void setSystemUiVisibility(int vis, int mask); |
100 | 94 | public void topAppWindowChanged(boolean visible); |
101 | 95 | public void setImeWindowStatus(IBinder token, int vis, int backDisposition); |
@@ -160,21 +154,31 @@ public void disable(int state) { |
160 | 154 | } |
161 | 155 | } |
162 | 156 |
|
163 | | - public void animateExpand() { |
| 157 | + public void animateExpandNotifications() { |
| 158 | + synchronized (mList) { |
| 159 | + mHandler.removeMessages(MSG_EXPAND_NOTIFICATIONS); |
| 160 | + mHandler.sendEmptyMessage(MSG_EXPAND_NOTIFICATIONS); |
| 161 | + } |
| 162 | + } |
| 163 | + |
| 164 | + public void animateCollapseNotifications() { |
164 | 165 | synchronized (mList) { |
165 | | - mHandler.removeMessages(MSG_SET_VISIBILITY); |
166 | | - mHandler.obtainMessage(MSG_SET_VISIBILITY, OP_EXPAND, 0, null).sendToTarget(); |
| 166 | + mHandler.removeMessages(MSG_COLLAPSE_NOTIFICATIONS); |
| 167 | + mHandler.sendEmptyMessage(MSG_COLLAPSE_NOTIFICATIONS); |
167 | 168 | } |
168 | 169 | } |
169 | 170 |
|
170 | | - public void animateCollapse() { |
171 | | - animateCollapse(CommandQueue.FLAG_EXCLUDE_NONE); |
| 171 | + public void animateExpandQuickSettings() { |
| 172 | + synchronized (mList) { |
| 173 | + mHandler.removeMessages(MSG_EXPAND_QUICK_SETTINGS); |
| 174 | + mHandler.sendEmptyMessage(MSG_EXPAND_QUICK_SETTINGS); |
| 175 | + } |
172 | 176 | } |
173 | 177 |
|
174 | | - public void animateCollapse(int flags) { |
| 178 | + public void animateCollapseQuickSettings() { |
175 | 179 | synchronized (mList) { |
176 | | - mHandler.removeMessages(MSG_SET_VISIBILITY); |
177 | | - mHandler.obtainMessage(MSG_SET_VISIBILITY, OP_COLLAPSE, flags, null).sendToTarget(); |
| 180 | + mHandler.removeMessages(MSG_COLLAPSE_QUICK_SETTINGS); |
| 181 | + mHandler.sendEmptyMessage(MSG_COLLAPSE_QUICK_SETTINGS); |
178 | 182 | } |
179 | 183 | } |
180 | 184 |
|
@@ -284,12 +288,17 @@ public void handleMessage(Message msg) { |
284 | 288 | case MSG_DISABLE: |
285 | 289 | mCallbacks.disable(msg.arg1); |
286 | 290 | break; |
287 | | - case MSG_SET_VISIBILITY: |
288 | | - if (msg.arg1 == OP_EXPAND) { |
289 | | - mCallbacks.animateExpand(); |
290 | | - } else { |
291 | | - mCallbacks.animateCollapse(msg.arg2); |
292 | | - } |
| 291 | + case MSG_EXPAND_NOTIFICATIONS: |
| 292 | + mCallbacks.animateExpandNotifications(); |
| 293 | + break; |
| 294 | + case MSG_COLLAPSE_NOTIFICATIONS: |
| 295 | + mCallbacks.animateCollapseNotifications(0); |
| 296 | + break; |
| 297 | + case MSG_EXPAND_QUICK_SETTINGS: |
| 298 | + mCallbacks.animateExpandQuickSettings(); |
| 299 | + break; |
| 300 | + case MSG_COLLAPSE_QUICK_SETTINGS: |
| 301 | + mCallbacks.animateCollapseQuickSettings(); |
293 | 302 | break; |
294 | 303 | case MSG_SET_SYSTEMUI_VISIBILITY: |
295 | 304 | mCallbacks.setSystemUiVisibility(msg.arg1, msg.arg2); |
|
0 commit comments