CommandQueue.java revision 3b1fc47d004f6b29af8f40d181baa3460b1e3b15
10cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato/* 20cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato * Copyright (C) 2010 The Android Open Source Project 30cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato * 40cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato * Licensed under the Apache License, Version 2.0 (the "License"); 50cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato * you may not use this file except in compliance with the License. 60cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato * You may obtain a copy of the License at 70cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato * 80cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato * http://www.apache.org/licenses/LICENSE-2.0 90cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato * 100cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato * Unless required by applicable law or agreed to in writing, software 110cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato * distributed under the License is distributed on an "AS IS" BASIS, 120cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 130cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato * See the License for the specific language governing permissions and 140cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato * limitations under the License. 150cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato */ 160cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato 1779de0c550037a5328bbc7f4fddaf02f192a5c283Joe Onoratopackage com.android.systemui.statusbar; 180cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato 190cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onoratoimport android.os.Handler; 20a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onoratoimport android.os.IBinder; 210cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onoratoimport android.os.Message; 220cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato 230cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onoratoimport com.android.internal.statusbar.IStatusBar; 240cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onoratoimport com.android.internal.statusbar.StatusBarIcon; 250cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onoratoimport com.android.internal.statusbar.StatusBarIconList; 26a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onoratoimport com.android.internal.statusbar.StatusBarNotification; 270cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato 28f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato/** 29f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato * This class takes the functions from IStatusBar that come in on 30f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato * binder pool threads and posts messages to get them onto the main 31f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato * thread, and calls onto Callbacks. It also takes care of 324762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato * coalescing these calls so they don't stack up. For the calls 334762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato * are coalesced, note that they are all idempotent. 34f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato */ 35808182dc874e93582da38d013a4a790d6bc08fc9Joe Onoratopublic class CommandQueue extends IStatusBar.Stub { 36514ad663f0a8b239cc59409175e0bd489c591aa0Joe Onorato private static final String TAG = "StatusBar.CommandQueue"; 370cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato 381d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler private static final int INDEX_MASK = 0xffff; 391d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler private static final int MSG_SHIFT = 16; 401d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler private static final int MSG_MASK = 0xffff << MSG_SHIFT; 410cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato 421d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler 431d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler private static final int MSG_ICON = 1 << MSG_SHIFT; 441d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler private static final int OP_SET_ICON = 1; 450cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato private static final int OP_REMOVE_ICON = 2; 460cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato 471d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler private static final int MSG_ADD_NOTIFICATION = 2 << MSG_SHIFT; 481d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler private static final int MSG_UPDATE_NOTIFICATION = 3 << MSG_SHIFT; 491d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler private static final int MSG_REMOVE_NOTIFICATION = 4 << MSG_SHIFT; 501d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler 511d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler private static final int MSG_DISABLE = 5 << MSG_SHIFT; 52f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato 531d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler private static final int MSG_SET_VISIBILITY = 6 << MSG_SHIFT; 541d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler private static final int OP_EXPAND = 1; 551d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler private static final int OP_COLLAPSE = 2; 56a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato 571d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler private static final int MSG_SET_LIGHTS_ON = 7 << MSG_SHIFT; 584762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato 593fe9cc5ea6a9e1acd52144c8ae6cb0492dba34baDianne Hackborn private static final int MSG_TOP_APP_WINDOW_CHANGED = 8 << MSG_SHIFT; 601d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler private static final int MSG_SHOW_IME_BUTTON = 9 << MSG_SHIFT; 611d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler private static final int MSG_SET_HARD_KEYBOARD_STATUS = 10 << MSG_SHIFT; 621d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler 631d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler private static final int MSG_USER_ACTIVITY = 11 << MSG_SHIFT; 643b1fc47d004f6b29af8f40d181baa3460b1e3b15Michael Jurka private static final int MSG_TOGGLE_RECENT_APPS = 12 << MSG_SHIFT; 659305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato 660cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato private StatusBarIconList mList; 670cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato private Callbacks mCallbacks; 680cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato private Handler mHandler = new H(); 690cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato 70a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato private class NotificationQueueEntry { 71a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato IBinder key; 72a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato StatusBarNotification notification; 73a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato } 74a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato 750cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato /** 760cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato * These methods are called back on the main thread. 770cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato */ 780cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato public interface Callbacks { 790cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato public void addIcon(String slot, int index, int viewIndex, StatusBarIcon icon); 800cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato public void updateIcon(String slot, int index, int viewIndex, 810cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato StatusBarIcon old, StatusBarIcon icon); 820cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato public void removeIcon(String slot, int index, int viewIndex); 83a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato public void addNotification(IBinder key, StatusBarNotification notification); 84a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato public void updateNotification(IBinder key, StatusBarNotification notification); 85a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato public void removeNotification(IBinder key); 86f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato public void disable(int state); 874762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato public void animateExpand(); 884762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato public void animateCollapse(); 899305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato public void setLightsOn(boolean on); 907d04932ef5c001769ccef244f551b75773f1666bDianne Hackborn public void topAppWindowChanged(boolean visible); 91857fd9b8562c29913e03ed29288bd1802d37dc60Joe Onorato public void setImeWindowStatus(IBinder token, int vis, int backDisposition); 922992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown public void setHardKeyboardStatus(boolean available, boolean enabled); 931d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler public void userActivity(); 943b1fc47d004f6b29af8f40d181baa3460b1e3b15Michael Jurka public void toggleRecentApps(); 950cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 960cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato 970cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato public CommandQueue(Callbacks callbacks, StatusBarIconList list) { 980cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato mCallbacks = callbacks; 990cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato mList = list; 1000cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 1010cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato 1020cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato public void setIcon(int index, StatusBarIcon icon) { 1030cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato synchronized (mList) { 1040cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato int what = MSG_ICON | index; 1050cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato mHandler.removeMessages(what); 1060cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato mHandler.obtainMessage(what, OP_SET_ICON, 0, icon.clone()).sendToTarget(); 1070cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 1080cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 1090cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato 1100cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato public void removeIcon(int index) { 1110cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato synchronized (mList) { 1120cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato int what = MSG_ICON | index; 1130cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato mHandler.removeMessages(what); 1140cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato mHandler.obtainMessage(what, OP_REMOVE_ICON, 0, null).sendToTarget(); 1150cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 1160cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 1170cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato 118a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato public void addNotification(IBinder key, StatusBarNotification notification) { 119a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato synchronized (mList) { 120a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato NotificationQueueEntry ne = new NotificationQueueEntry(); 121a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato ne.key = key; 122a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato ne.notification = notification; 123a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato mHandler.obtainMessage(MSG_ADD_NOTIFICATION, 0, 0, ne).sendToTarget(); 124a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato } 125a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato } 126a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato 127a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato public void updateNotification(IBinder key, StatusBarNotification notification) { 128a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato synchronized (mList) { 129a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato NotificationQueueEntry ne = new NotificationQueueEntry(); 130a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato ne.key = key; 131a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato ne.notification = notification; 132a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato mHandler.obtainMessage(MSG_UPDATE_NOTIFICATION, 0, 0, ne).sendToTarget(); 133a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato } 134a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato } 135a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato 136a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato public void removeNotification(IBinder key) { 137a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato synchronized (mList) { 138a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato mHandler.obtainMessage(MSG_REMOVE_NOTIFICATION, 0, 0, key).sendToTarget(); 139a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato } 140a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato } 141a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato 142f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato public void disable(int state) { 143f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato synchronized (mList) { 144f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato mHandler.removeMessages(MSG_DISABLE); 145f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato mHandler.obtainMessage(MSG_DISABLE, state, 0, null).sendToTarget(); 146f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato } 147f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato } 148f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato 1494762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato public void animateExpand() { 1504762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato synchronized (mList) { 1514762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato mHandler.removeMessages(MSG_SET_VISIBILITY); 1524762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato mHandler.obtainMessage(MSG_SET_VISIBILITY, OP_EXPAND, 0, null).sendToTarget(); 1534762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato } 1544762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato } 1554762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato 1564762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato public void animateCollapse() { 1574762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato synchronized (mList) { 1584762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato mHandler.removeMessages(MSG_SET_VISIBILITY); 1594762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato mHandler.obtainMessage(MSG_SET_VISIBILITY, OP_COLLAPSE, 0, null).sendToTarget(); 1604762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato } 1614762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato } 1624762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato 1639305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato public void setLightsOn(boolean on) { 1649305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato synchronized (mList) { 1659305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato mHandler.removeMessages(MSG_SET_LIGHTS_ON); 1669305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato mHandler.obtainMessage(MSG_SET_LIGHTS_ON, on ? 1 : 0, 0, null).sendToTarget(); 1679305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato } 1689305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato } 1699305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato 1707d04932ef5c001769ccef244f551b75773f1666bDianne Hackborn public void topAppWindowChanged(boolean menuVisible) { 171e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler synchronized (mList) { 1727d04932ef5c001769ccef244f551b75773f1666bDianne Hackborn mHandler.removeMessages(MSG_TOP_APP_WINDOW_CHANGED); 1737d04932ef5c001769ccef244f551b75773f1666bDianne Hackborn mHandler.obtainMessage(MSG_TOP_APP_WINDOW_CHANGED, menuVisible ? 1 : 0, 0, 1747d04932ef5c001769ccef244f551b75773f1666bDianne Hackborn null).sendToTarget(); 175e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler } 176e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler } 177e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler 178857fd9b8562c29913e03ed29288bd1802d37dc60Joe Onorato public void setImeWindowStatus(IBinder token, int vis, int backDisposition) { 17906487a58be22b100daf3f950b9a1d25c3ea42aa2satok synchronized (mList) { 18006487a58be22b100daf3f950b9a1d25c3ea42aa2satok mHandler.removeMessages(MSG_SHOW_IME_BUTTON); 181857fd9b8562c29913e03ed29288bd1802d37dc60Joe Onorato mHandler.obtainMessage(MSG_SHOW_IME_BUTTON, vis, backDisposition, token) 182857fd9b8562c29913e03ed29288bd1802d37dc60Joe Onorato .sendToTarget(); 18306487a58be22b100daf3f950b9a1d25c3ea42aa2satok } 18406487a58be22b100daf3f950b9a1d25c3ea42aa2satok } 18506487a58be22b100daf3f950b9a1d25c3ea42aa2satok 1862992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown public void setHardKeyboardStatus(boolean available, boolean enabled) { 1872992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown synchronized (mList) { 1882992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown mHandler.removeMessages(MSG_SET_HARD_KEYBOARD_STATUS); 1892992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown mHandler.obtainMessage(MSG_SET_HARD_KEYBOARD_STATUS, 1902992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown available ? 1 : 0, enabled ? 1 : 0).sendToTarget(); 1912992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown } 1922992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown } 1932992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown 1941d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler public void userActivity() { 1951d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler synchronized (mList) { 1961d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler mHandler.removeMessages(MSG_USER_ACTIVITY); 1971d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler mHandler.obtainMessage(MSG_USER_ACTIVITY, 0, 0, null).sendToTarget(); 1981d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler } 1991d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler } 2001d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler 2013b1fc47d004f6b29af8f40d181baa3460b1e3b15Michael Jurka public void toggleRecentApps() { 2023b1fc47d004f6b29af8f40d181baa3460b1e3b15Michael Jurka synchronized (mList) { 2033b1fc47d004f6b29af8f40d181baa3460b1e3b15Michael Jurka mHandler.removeMessages(MSG_TOGGLE_RECENT_APPS); 2043b1fc47d004f6b29af8f40d181baa3460b1e3b15Michael Jurka mHandler.obtainMessage(MSG_TOGGLE_RECENT_APPS, 0, 0, null).sendToTarget(); 2053b1fc47d004f6b29af8f40d181baa3460b1e3b15Michael Jurka } 2063b1fc47d004f6b29af8f40d181baa3460b1e3b15Michael Jurka } 2073b1fc47d004f6b29af8f40d181baa3460b1e3b15Michael Jurka 2080cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato private final class H extends Handler { 2090cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato public void handleMessage(Message msg) { 210f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato final int what = msg.what & MSG_MASK; 21166d7d01ed91968f4ed2e2669fd306aa2af61cd16Joe Onorato switch (what) { 2120cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato case MSG_ICON: { 213f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato final int index = msg.what & INDEX_MASK; 214f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato final int viewIndex = mList.getViewIndex(index); 2150cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato switch (msg.arg1) { 2160cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato case OP_SET_ICON: { 2170cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato StatusBarIcon icon = (StatusBarIcon)msg.obj; 2180cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato StatusBarIcon old = mList.getIcon(index); 2190cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato if (old == null) { 2200cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato mList.setIcon(index, icon); 2210cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato mCallbacks.addIcon(mList.getSlot(index), index, viewIndex, icon); 2220cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } else { 2230cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato mList.setIcon(index, icon); 2240cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato mCallbacks.updateIcon(mList.getSlot(index), index, viewIndex, 2250cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato old, icon); 2260cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 2270cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato break; 2280cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 2290cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato case OP_REMOVE_ICON: 230795f2840b4a70bf188c2f24c8c06f73a492b338cJoe Onorato if (mList.getIcon(index) != null) { 231795f2840b4a70bf188c2f24c8c06f73a492b338cJoe Onorato mList.removeIcon(index); 232795f2840b4a70bf188c2f24c8c06f73a492b338cJoe Onorato mCallbacks.removeIcon(mList.getSlot(index), index, viewIndex); 233795f2840b4a70bf188c2f24c8c06f73a492b338cJoe Onorato } 2340cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato break; 2350cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 2360cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato break; 237f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato } 238a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato case MSG_ADD_NOTIFICATION: { 239a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato final NotificationQueueEntry ne = (NotificationQueueEntry)msg.obj; 240a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato mCallbacks.addNotification(ne.key, ne.notification); 241a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato break; 242a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato } 243a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato case MSG_UPDATE_NOTIFICATION: { 244a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato final NotificationQueueEntry ne = (NotificationQueueEntry)msg.obj; 245a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato mCallbacks.updateNotification(ne.key, ne.notification); 246a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato break; 247a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato } 248a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato case MSG_REMOVE_NOTIFICATION: { 249a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato mCallbacks.removeNotification((IBinder)msg.obj); 250a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato break; 251a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato } 252f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato case MSG_DISABLE: 253f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato mCallbacks.disable(msg.arg1); 254f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato break; 2554762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato case MSG_SET_VISIBILITY: 2564762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato if (msg.arg1 == OP_EXPAND) { 2574762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato mCallbacks.animateExpand(); 2584762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato } else { 2594762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato mCallbacks.animateCollapse(); 2604762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato } 2619305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato break; 2629305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato case MSG_SET_LIGHTS_ON: 2639305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato mCallbacks.setLightsOn(msg.arg1 != 0); 2649305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato break; 2657d04932ef5c001769ccef244f551b75773f1666bDianne Hackborn case MSG_TOP_APP_WINDOW_CHANGED: 2667d04932ef5c001769ccef244f551b75773f1666bDianne Hackborn mCallbacks.topAppWindowChanged(msg.arg1 != 0); 267e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler break; 26806487a58be22b100daf3f950b9a1d25c3ea42aa2satok case MSG_SHOW_IME_BUTTON: 269857fd9b8562c29913e03ed29288bd1802d37dc60Joe Onorato mCallbacks.setImeWindowStatus((IBinder)msg.obj, msg.arg1, msg.arg2); 27006487a58be22b100daf3f950b9a1d25c3ea42aa2satok break; 2712992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown case MSG_SET_HARD_KEYBOARD_STATUS: 2722992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown mCallbacks.setHardKeyboardStatus(msg.arg1 != 0, msg.arg2 != 0); 2732992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown break; 2741d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler case MSG_USER_ACTIVITY: 2751d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler mCallbacks.userActivity(); 2761d4d30aebd2c22627131819cabfe95f97def2c83Daniel Sandler break; 2773b1fc47d004f6b29af8f40d181baa3460b1e3b15Michael Jurka case MSG_TOGGLE_RECENT_APPS: 2783b1fc47d004f6b29af8f40d181baa3460b1e3b15Michael Jurka mCallbacks.toggleRecentApps(); 2793b1fc47d004f6b29af8f40d181baa3460b1e3b15Michael Jurka break; 2800cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 2810cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 2820cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 2830cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato} 2840cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato 285