Add expand and collapse.
Change-Id: I58ad95c59b2c46d3f25349e137d5624aefc6c6cd
diff --git a/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/CommandQueue.java b/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/CommandQueue.java
index 90f17d5..00ad77c 100644
--- a/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/CommandQueue.java
+++ b/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/CommandQueue.java
@@ -28,7 +28,8 @@
* This class takes the functions from IStatusBar that come in on
* binder pool threads and posts messages to get them onto the main
* thread, and calls onto Callbacks. It also takes care of
- * coalescing these calls so they don't stack up.
+ * coalescing these calls so they don't stack up. For the calls
+ * are coalesced, note that they are all idempotent.
*/
class CommandQueue extends IStatusBar.Stub {
private static final String TAG = "StatusBar.CommandQueue";
@@ -42,6 +43,10 @@
private static final int MSG_DISABLE = 0x00020000;
+ private static final int MSG_SET_VISIBILITY = 0x00030000;
+ private static final int OP_EXPAND = 1;
+ private static final int OP_COLLAPSE = 2;
+
private StatusBarIconList mList;
private Callbacks mCallbacks;
private Handler mHandler = new H();
@@ -55,6 +60,8 @@
StatusBarIcon old, StatusBarIcon icon);
public void removeIcon(String slot, int index, int viewIndex);
public void disable(int state);
+ public void animateExpand();
+ public void animateCollapse();
}
public CommandQueue(Callbacks callbacks, StatusBarIconList list) {
@@ -85,9 +92,24 @@
}
}
+ public void animateExpand() {
+ synchronized (mList) {
+ mHandler.removeMessages(MSG_SET_VISIBILITY);
+ mHandler.obtainMessage(MSG_SET_VISIBILITY, OP_EXPAND, 0, null).sendToTarget();
+ }
+ }
+
+ public void animateCollapse() {
+ synchronized (mList) {
+ mHandler.removeMessages(MSG_SET_VISIBILITY);
+ mHandler.obtainMessage(MSG_SET_VISIBILITY, OP_COLLAPSE, 0, null).sendToTarget();
+ }
+ }
+
private final class H extends Handler {
public void handleMessage(Message msg) {
final int what = msg.what & MSG_MASK;
+ Slog.d(TAG, "handleMessage what=0x" + Integer.toHexString(what) + " arg1=" + msg.arg1);
switch (what) {
case MSG_ICON: {
final int index = msg.what & INDEX_MASK;
@@ -116,6 +138,12 @@
case MSG_DISABLE:
mCallbacks.disable(msg.arg1);
break;
+ case MSG_SET_VISIBILITY:
+ if (msg.arg1 == OP_EXPAND) {
+ mCallbacks.animateExpand();
+ } else {
+ mCallbacks.animateCollapse();
+ }
}
}
}