CommandQueue.java revision 857fd9b8562c29913e03ed29288bd1802d37dc60
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;
59e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler
600cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato    private StatusBarIconList mList;
610cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato    private Callbacks mCallbacks;
620cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato    private Handler mHandler = new H();
630cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato
64a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato    private class NotificationQueueEntry {
65a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato        IBinder key;
66a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato        StatusBarNotification notification;
67a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato    }
68a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato
690cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato    /**
700cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato     * These methods are called back on the main thread.
710cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato     */
720cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato    public interface Callbacks {
730cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato        public void addIcon(String slot, int index, int viewIndex, StatusBarIcon icon);
740cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato        public void updateIcon(String slot, int index, int viewIndex,
750cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato                StatusBarIcon old, StatusBarIcon icon);
760cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato        public void removeIcon(String slot, int index, int viewIndex);
77a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato        public void addNotification(IBinder key, StatusBarNotification notification);
78a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato        public void updateNotification(IBinder key, StatusBarNotification notification);
79a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato        public void removeNotification(IBinder key);
80f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato        public void disable(int state);
814762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato        public void animateExpand();
824762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato        public void animateCollapse();
839305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato        public void setLightsOn(boolean on);
84e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler        public void setMenuKeyVisible(boolean visible);
85857fd9b8562c29913e03ed29288bd1802d37dc60Joe Onorato        public void setImeWindowStatus(IBinder token, int vis, int backDisposition);
860cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato    }
870cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato
880cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato    public CommandQueue(Callbacks callbacks, StatusBarIconList list) {
890cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato        mCallbacks = callbacks;
900cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato        mList = list;
910cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato    }
920cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato
930cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato    public void setIcon(int index, StatusBarIcon icon) {
940cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato        synchronized (mList) {
950cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato            int what = MSG_ICON | index;
960cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato            mHandler.removeMessages(what);
970cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato            mHandler.obtainMessage(what, OP_SET_ICON, 0, icon.clone()).sendToTarget();
980cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato        }
990cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato    }
1000cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato
1010cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato    public void removeIcon(int index) {
1020cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato        synchronized (mList) {
1030cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato            int what = MSG_ICON | index;
1040cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato            mHandler.removeMessages(what);
1050cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato            mHandler.obtainMessage(what, OP_REMOVE_ICON, 0, null).sendToTarget();
1060cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato        }
1070cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato    }
1080cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato
109a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato    public void addNotification(IBinder key, StatusBarNotification notification) {
110a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato        synchronized (mList) {
111a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato            NotificationQueueEntry ne = new NotificationQueueEntry();
112a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato            ne.key = key;
113a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato            ne.notification = notification;
114a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato            mHandler.obtainMessage(MSG_ADD_NOTIFICATION, 0, 0, ne).sendToTarget();
115a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato        }
116a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato    }
117a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato
118a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato    public void updateNotification(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_UPDATE_NOTIFICATION, 0, 0, ne).sendToTarget();
124a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato        }
125a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato    }
126a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato
127a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato    public void removeNotification(IBinder key) {
128a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato        synchronized (mList) {
129a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato            mHandler.obtainMessage(MSG_REMOVE_NOTIFICATION, 0, 0, key).sendToTarget();
130a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato        }
131a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato    }
132a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato
133f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato    public void disable(int state) {
134f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato        synchronized (mList) {
135f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato            mHandler.removeMessages(MSG_DISABLE);
136f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato            mHandler.obtainMessage(MSG_DISABLE, state, 0, null).sendToTarget();
137f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato        }
138f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato    }
139f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato
1404762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato    public void animateExpand() {
1414762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato        synchronized (mList) {
1424762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato            mHandler.removeMessages(MSG_SET_VISIBILITY);
1434762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato            mHandler.obtainMessage(MSG_SET_VISIBILITY, OP_EXPAND, 0, null).sendToTarget();
1444762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato        }
1454762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato    }
1464762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato
1474762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato    public void animateCollapse() {
1484762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato        synchronized (mList) {
1494762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato            mHandler.removeMessages(MSG_SET_VISIBILITY);
1504762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato            mHandler.obtainMessage(MSG_SET_VISIBILITY, OP_COLLAPSE, 0, null).sendToTarget();
1514762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato        }
1524762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato    }
1534762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato
1549305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato    public void setLightsOn(boolean on) {
1559305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato        synchronized (mList) {
1569305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato            mHandler.removeMessages(MSG_SET_LIGHTS_ON);
1579305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato            mHandler.obtainMessage(MSG_SET_LIGHTS_ON, on ? 1 : 0, 0, null).sendToTarget();
1589305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato        }
1599305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato    }
1609305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato
161e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler    public void setMenuKeyVisible(boolean visible) {
162e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler        synchronized (mList) {
163e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler            mHandler.removeMessages(MSG_SHOW_MENU);
164e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler            mHandler.obtainMessage(MSG_SHOW_MENU, visible ? 1 : 0, 0, null).sendToTarget();
165e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler        }
166e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler    }
167e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler
168857fd9b8562c29913e03ed29288bd1802d37dc60Joe Onorato    public void setImeWindowStatus(IBinder token, int vis, int backDisposition) {
16906487a58be22b100daf3f950b9a1d25c3ea42aa2satok        synchronized (mList) {
17006487a58be22b100daf3f950b9a1d25c3ea42aa2satok            mHandler.removeMessages(MSG_SHOW_IME_BUTTON);
171857fd9b8562c29913e03ed29288bd1802d37dc60Joe Onorato            mHandler.obtainMessage(MSG_SHOW_IME_BUTTON, vis, backDisposition, token)
172857fd9b8562c29913e03ed29288bd1802d37dc60Joe Onorato                    .sendToTarget();
17306487a58be22b100daf3f950b9a1d25c3ea42aa2satok        }
17406487a58be22b100daf3f950b9a1d25c3ea42aa2satok    }
17506487a58be22b100daf3f950b9a1d25c3ea42aa2satok
1760cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato    private final class H extends Handler {
1770cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato        public void handleMessage(Message msg) {
178f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato            final int what = msg.what & MSG_MASK;
17966d7d01ed91968f4ed2e2669fd306aa2af61cd16Joe Onorato            switch (what) {
1800cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato                case MSG_ICON: {
181f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato                    final int index = msg.what & INDEX_MASK;
182f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato                    final int viewIndex = mList.getViewIndex(index);
1830cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato                    switch (msg.arg1) {
1840cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato                        case OP_SET_ICON: {
1850cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato                            StatusBarIcon icon = (StatusBarIcon)msg.obj;
1860cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato                            StatusBarIcon old = mList.getIcon(index);
1870cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato                            if (old == null) {
1880cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato                                mList.setIcon(index, icon);
1890cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato                                mCallbacks.addIcon(mList.getSlot(index), index, viewIndex, icon);
1900cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato                            } else {
1910cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato                                mList.setIcon(index, icon);
1920cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato                                mCallbacks.updateIcon(mList.getSlot(index), index, viewIndex,
1930cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato                                        old, icon);
1940cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato                            }
1950cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato                            break;
1960cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato                        }
1970cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato                        case OP_REMOVE_ICON:
198795f2840b4a70bf188c2f24c8c06f73a492b338cJoe Onorato                            if (mList.getIcon(index) != null) {
199795f2840b4a70bf188c2f24c8c06f73a492b338cJoe Onorato                                mList.removeIcon(index);
200795f2840b4a70bf188c2f24c8c06f73a492b338cJoe Onorato                                mCallbacks.removeIcon(mList.getSlot(index), index, viewIndex);
201795f2840b4a70bf188c2f24c8c06f73a492b338cJoe Onorato                            }
2020cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato                            break;
2030cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato                    }
2040cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato                    break;
205f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato                }
206a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato                case MSG_ADD_NOTIFICATION: {
207a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato                    final NotificationQueueEntry ne = (NotificationQueueEntry)msg.obj;
208a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato                    mCallbacks.addNotification(ne.key, ne.notification);
209a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato                    break;
210a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato                }
211a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato                case MSG_UPDATE_NOTIFICATION: {
212a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato                    final NotificationQueueEntry ne = (NotificationQueueEntry)msg.obj;
213a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato                    mCallbacks.updateNotification(ne.key, ne.notification);
214a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato                    break;
215a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato                }
216a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato                case MSG_REMOVE_NOTIFICATION: {
217a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato                    mCallbacks.removeNotification((IBinder)msg.obj);
218a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato                    break;
219a0c56fe93925d20d9c0b830b9664699ce557e78cJoe Onorato                }
220f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato                case MSG_DISABLE:
221f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato                    mCallbacks.disable(msg.arg1);
222f3f0e053f0cc66249a11639eb67d0cdc2da26dedJoe Onorato                    break;
2234762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato                case MSG_SET_VISIBILITY:
2244762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato                    if (msg.arg1 == OP_EXPAND) {
2254762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato                        mCallbacks.animateExpand();
2264762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato                    } else {
2274762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato                        mCallbacks.animateCollapse();
2284762c2d75a55e0854bbff2f996748116d4ab1a37Joe Onorato                    }
2299305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato                    break;
2309305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato                case MSG_SET_LIGHTS_ON:
2319305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato                    mCallbacks.setLightsOn(msg.arg1 != 0);
2329305647eb61bb60a1f42481a0c0d208dc9bbe965Joe Onorato                    break;
233e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler                case MSG_SHOW_MENU:
234e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler                    mCallbacks.setMenuKeyVisible(msg.arg1 != 0);
235e02d808abf370965c3c4e4d38af11bc69110fde2Daniel Sandler                    break;
23606487a58be22b100daf3f950b9a1d25c3ea42aa2satok                case MSG_SHOW_IME_BUTTON:
237857fd9b8562c29913e03ed29288bd1802d37dc60Joe Onorato                    mCallbacks.setImeWindowStatus((IBinder)msg.obj, msg.arg1, msg.arg2);
23806487a58be22b100daf3f950b9a1d25c3ea42aa2satok                    break;
2390cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato            }
2400cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato        }
2410cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato    }
2420cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato}
2430cbda99f8721ad9b03ada04d2637fb75a2a0fecaJoe Onorato
244