CommandQueue.java revision 2992ea782fa61780d8e0de7a36a2a84622f8694b
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 380cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato private static final int MSG_MASK = 0xffff0000; 390cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato private static final int INDEX_MASK = 0x0000ffff; 400cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato 410cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato private static final int MSG_ICON = 0x00010000; 420cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato private static final int OP_SET_ICON = 1; 430cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato private static final int OP_REMOVE_ICON = 2; 440cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato 45a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato private static final int MSG_ADD_NOTIFICATION = 0x00020000; 46a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato private static final int MSG_UPDATE_NOTIFICATION = 0x00030000; 47a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato private static final int MSG_REMOVE_NOTIFICATION = 0x00040000; 48f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato 49a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato private static final int MSG_DISABLE = 0x00050000; 50a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato 51a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato private static final int MSG_SET_VISIBILITY = 0x00060000; 524762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato private static final int OP_EXPAND = 1; 534762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato private static final int OP_COLLAPSE = 2; 544762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato 559305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato private static final int MSG_SET_LIGHTS_ON = 0x00070000; 569305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato 57e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler private static final int MSG_SHOW_MENU = 0x00080000; 5806487a58be22b100daf3f950b9a1d25c3ea42aa2satok private static final int MSG_SHOW_IME_BUTTON = 0x00090000; 592992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown private static final int MSG_SET_HARD_KEYBOARD_STATUS = 0x000a0000; 60e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler 610cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato private StatusBarIconList mList; 620cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato private Callbacks mCallbacks; 630cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato private Handler mHandler = new H(); 640cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato 65a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato private class NotificationQueueEntry { 66a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato IBinder key; 67a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato StatusBarNotification notification; 68a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato } 69a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato 700cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato /** 710cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato * These methods are called back on the main thread. 720cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato */ 730cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato public interface Callbacks { 740cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato public void addIcon(String slot, int index, int viewIndex, StatusBarIcon icon); 750cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato public void updateIcon(String slot, int index, int viewIndex, 760cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato StatusBarIcon old, StatusBarIcon icon); 770cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato public void removeIcon(String slot, int index, int viewIndex); 78a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato public void addNotification(IBinder key, StatusBarNotification notification); 79a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato public void updateNotification(IBinder key, StatusBarNotification notification); 80a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato public void removeNotification(IBinder key); 81f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato public void disable(int state); 824762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato public void animateExpand(); 834762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato public void animateCollapse(); 849305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato public void setLightsOn(boolean on); 85e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler public void setMenuKeyVisible(boolean visible); 86857fd9b8562c29913e03ed29288bd1802d37dc60Joe Onorato public void setImeWindowStatus(IBinder token, int vis, int backDisposition); 872992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown public void setHardKeyboardStatus(boolean available, boolean enabled); 880cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 890cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato 900cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato public CommandQueue(Callbacks callbacks, StatusBarIconList list) { 910cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato mCallbacks = callbacks; 920cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato mList = list; 930cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 940cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato 950cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato public void setIcon(int index, StatusBarIcon icon) { 960cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato synchronized (mList) { 970cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato int what = MSG_ICON | index; 980cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato mHandler.removeMessages(what); 990cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato mHandler.obtainMessage(what, OP_SET_ICON, 0, icon.clone()).sendToTarget(); 1000cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 1010cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 1020cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato 1030cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato public void removeIcon(int index) { 1040cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato synchronized (mList) { 1050cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato int what = MSG_ICON | index; 1060cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato mHandler.removeMessages(what); 1070cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato mHandler.obtainMessage(what, OP_REMOVE_ICON, 0, null).sendToTarget(); 1080cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 1090cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 1100cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato 111a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato public void addNotification(IBinder key, StatusBarNotification notification) { 112a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato synchronized (mList) { 113a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato NotificationQueueEntry ne = new NotificationQueueEntry(); 114a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato ne.key = key; 115a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato ne.notification = notification; 116a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato mHandler.obtainMessage(MSG_ADD_NOTIFICATION, 0, 0, ne).sendToTarget(); 117a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato } 118a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato } 119a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato 120a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato public void updateNotification(IBinder key, StatusBarNotification notification) { 121a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato synchronized (mList) { 122a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato NotificationQueueEntry ne = new NotificationQueueEntry(); 123a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato ne.key = key; 124a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato ne.notification = notification; 125a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato mHandler.obtainMessage(MSG_UPDATE_NOTIFICATION, 0, 0, ne).sendToTarget(); 126a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato } 127a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato } 128a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato 129a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato public void removeNotification(IBinder key) { 130a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato synchronized (mList) { 131a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato mHandler.obtainMessage(MSG_REMOVE_NOTIFICATION, 0, 0, key).sendToTarget(); 132a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato } 133a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato } 134a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato 135f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato public void disable(int state) { 136f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato synchronized (mList) { 137f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato mHandler.removeMessages(MSG_DISABLE); 138f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato mHandler.obtainMessage(MSG_DISABLE, state, 0, null).sendToTarget(); 139f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato } 140f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato } 141f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato 1424762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato public void animateExpand() { 1434762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato synchronized (mList) { 1444762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato mHandler.removeMessages(MSG_SET_VISIBILITY); 1454762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato mHandler.obtainMessage(MSG_SET_VISIBILITY, OP_EXPAND, 0, null).sendToTarget(); 1464762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato } 1474762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato } 1484762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato 1494762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato public void animateCollapse() { 1504762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato synchronized (mList) { 1514762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato mHandler.removeMessages(MSG_SET_VISIBILITY); 1524762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato mHandler.obtainMessage(MSG_SET_VISIBILITY, OP_COLLAPSE, 0, null).sendToTarget(); 1534762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato } 1544762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato } 1554762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato 1569305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato public void setLightsOn(boolean on) { 1579305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato synchronized (mList) { 1589305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato mHandler.removeMessages(MSG_SET_LIGHTS_ON); 1599305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato mHandler.obtainMessage(MSG_SET_LIGHTS_ON, on ? 1 : 0, 0, null).sendToTarget(); 1609305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato } 1619305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato } 1629305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato 163e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler public void setMenuKeyVisible(boolean visible) { 164e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler synchronized (mList) { 165e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler mHandler.removeMessages(MSG_SHOW_MENU); 166e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler mHandler.obtainMessage(MSG_SHOW_MENU, visible ? 1 : 0, 0, null).sendToTarget(); 167e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler } 168e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler } 169e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler 170857fd9b8562c29913e03ed29288bd1802d37dc60Joe Onorato public void setImeWindowStatus(IBinder token, int vis, int backDisposition) { 17106487a58be22b100daf3f950b9a1d25c3ea42aa2satok synchronized (mList) { 17206487a58be22b100daf3f950b9a1d25c3ea42aa2satok mHandler.removeMessages(MSG_SHOW_IME_BUTTON); 173857fd9b8562c29913e03ed29288bd1802d37dc60Joe Onorato mHandler.obtainMessage(MSG_SHOW_IME_BUTTON, vis, backDisposition, token) 174857fd9b8562c29913e03ed29288bd1802d37dc60Joe Onorato .sendToTarget(); 17506487a58be22b100daf3f950b9a1d25c3ea42aa2satok } 17606487a58be22b100daf3f950b9a1d25c3ea42aa2satok } 17706487a58be22b100daf3f950b9a1d25c3ea42aa2satok 1782992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown public void setHardKeyboardStatus(boolean available, boolean enabled) { 1792992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown synchronized (mList) { 1802992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown mHandler.removeMessages(MSG_SET_HARD_KEYBOARD_STATUS); 1812992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown mHandler.obtainMessage(MSG_SET_HARD_KEYBOARD_STATUS, 1822992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown available ? 1 : 0, enabled ? 1 : 0).sendToTarget(); 1832992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown } 1842992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown } 1852992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown 1860cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato private final class H extends Handler { 1870cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato public void handleMessage(Message msg) { 188f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato final int what = msg.what & MSG_MASK; 18966d7d01ed91968f4ed2e2669fd306aa2af61cd16Joe Onorato switch (what) { 1900cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato case MSG_ICON: { 191f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato final int index = msg.what & INDEX_MASK; 192f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato final int viewIndex = mList.getViewIndex(index); 1930cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato switch (msg.arg1) { 1940cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato case OP_SET_ICON: { 1950cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato StatusBarIcon icon = (StatusBarIcon)msg.obj; 1960cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato StatusBarIcon old = mList.getIcon(index); 1970cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato if (old == null) { 1980cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato mList.setIcon(index, icon); 1990cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato mCallbacks.addIcon(mList.getSlot(index), index, viewIndex, icon); 2000cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } else { 2010cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato mList.setIcon(index, icon); 2020cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato mCallbacks.updateIcon(mList.getSlot(index), index, viewIndex, 2030cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato old, icon); 2040cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 2050cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato break; 2060cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 2070cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato case OP_REMOVE_ICON: 208795f2840b4a70bf188c2f24c8c06f73a492b338cJoe Onorato if (mList.getIcon(index) != null) { 209795f2840b4a70bf188c2f24c8c06f73a492b338cJoe Onorato mList.removeIcon(index); 210795f2840b4a70bf188c2f24c8c06f73a492b338cJoe Onorato mCallbacks.removeIcon(mList.getSlot(index), index, viewIndex); 211795f2840b4a70bf188c2f24c8c06f73a492b338cJoe Onorato } 2120cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato break; 2130cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 2140cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato break; 215f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato } 216a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato case MSG_ADD_NOTIFICATION: { 217a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato final NotificationQueueEntry ne = (NotificationQueueEntry)msg.obj; 218a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato mCallbacks.addNotification(ne.key, ne.notification); 219a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato break; 220a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato } 221a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato case MSG_UPDATE_NOTIFICATION: { 222a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato final NotificationQueueEntry ne = (NotificationQueueEntry)msg.obj; 223a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato mCallbacks.updateNotification(ne.key, ne.notification); 224a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato break; 225a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato } 226a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato case MSG_REMOVE_NOTIFICATION: { 227a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato mCallbacks.removeNotification((IBinder)msg.obj); 228a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato break; 229a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato } 230f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato case MSG_DISABLE: 231f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato mCallbacks.disable(msg.arg1); 232f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato break; 2334762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato case MSG_SET_VISIBILITY: 2344762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato if (msg.arg1 == OP_EXPAND) { 2354762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato mCallbacks.animateExpand(); 2364762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato } else { 2374762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato mCallbacks.animateCollapse(); 2384762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato } 2399305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato break; 2409305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato case MSG_SET_LIGHTS_ON: 2419305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato mCallbacks.setLightsOn(msg.arg1 != 0); 2429305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato break; 243e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler case MSG_SHOW_MENU: 244e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler mCallbacks.setMenuKeyVisible(msg.arg1 != 0); 245e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler break; 24606487a58be22b100daf3f950b9a1d25c3ea42aa2satok case MSG_SHOW_IME_BUTTON: 247857fd9b8562c29913e03ed29288bd1802d37dc60Joe Onorato mCallbacks.setImeWindowStatus((IBinder)msg.obj, msg.arg1, msg.arg2); 24806487a58be22b100daf3f950b9a1d25c3ea42aa2satok break; 2492992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown case MSG_SET_HARD_KEYBOARD_STATUS: 2502992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown mCallbacks.setHardKeyboardStatus(msg.arg1 != 0, msg.arg2 != 0); 2512992ea782fa61780d8e0de7a36a2a84622f8694bJeff Brown break; 2520cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 2530cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 2540cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato } 2550cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato} 2560cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato 257