diff options
author | Joe Onorato <joeo@android.com> | 2010-05-14 18:49:29 -0700 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2010-06-02 14:48:42 -0700 |
commit | f3f0e053f0cc66249a11639eb67d0cdc2da26ded (patch) | |
tree | 4a2c42a832abe775b672c1b5d25277592a182699 /packages | |
parent | 5368017294ab5d4c37c48d4169da33acbf004e83 (diff) | |
download | frameworks_base-f3f0e053f0cc66249a11639eb67d0cdc2da26ded.zip frameworks_base-f3f0e053f0cc66249a11639eb67d0cdc2da26ded.tar.gz frameworks_base-f3f0e053f0cc66249a11639eb67d0cdc2da26ded.tar.bz2 |
Make disable() work.
Change-Id: I93fea37e777b3e04fe7f9171d5b84821587c24f5
Diffstat (limited to 'packages')
-rw-r--r-- | packages/StatusBarPhone/src/com/android/policy/statusbar/phone/CommandQueue.java | 27 | ||||
-rw-r--r-- | packages/StatusBarPhone/src/com/android/policy/statusbar/phone/PhoneStatusBarService.java | 44 |
2 files changed, 63 insertions, 8 deletions
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 3357e10..90f17d5 100644 --- a/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/CommandQueue.java +++ b/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/CommandQueue.java @@ -24,6 +24,12 @@ import com.android.internal.statusbar.IStatusBar; import com.android.internal.statusbar.StatusBarIcon; import com.android.internal.statusbar.StatusBarIconList; +/** + * 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. + */ class CommandQueue extends IStatusBar.Stub { private static final String TAG = "StatusBar.CommandQueue"; @@ -34,6 +40,8 @@ class CommandQueue extends IStatusBar.Stub { private static final int OP_SET_ICON = 1; private static final int OP_REMOVE_ICON = 2; + private static final int MSG_DISABLE = 0x00020000; + private StatusBarIconList mList; private Callbacks mCallbacks; private Handler mHandler = new H(); @@ -46,6 +54,7 @@ class CommandQueue extends IStatusBar.Stub { public void updateIcon(String slot, int index, int viewIndex, StatusBarIcon old, StatusBarIcon icon); public void removeIcon(String slot, int index, int viewIndex); + public void disable(int state); } public CommandQueue(Callbacks callbacks, StatusBarIconList list) { @@ -69,13 +78,20 @@ class CommandQueue extends IStatusBar.Stub { } } + public void disable(int state) { + synchronized (mList) { + mHandler.removeMessages(MSG_DISABLE); + mHandler.obtainMessage(MSG_DISABLE, state, 0, null).sendToTarget(); + } + } + private final class H extends Handler { public void handleMessage(Message msg) { - int what = msg.what & MSG_MASK; + final int what = msg.what & MSG_MASK; switch (what) { case MSG_ICON: { - int index = msg.what & INDEX_MASK; - int viewIndex = mList.getViewIndex(index); + final int index = msg.what & INDEX_MASK; + final int viewIndex = mList.getViewIndex(index); switch (msg.arg1) { case OP_SET_ICON: { StatusBarIcon icon = (StatusBarIcon)msg.obj; @@ -96,7 +112,10 @@ class CommandQueue extends IStatusBar.Stub { break; } break; - } + } + case MSG_DISABLE: + mCallbacks.disable(msg.arg1); + break; } } } diff --git a/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/PhoneStatusBarService.java b/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/PhoneStatusBarService.java index 8291d70..6ae632b 100644 --- a/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/PhoneStatusBarService.java +++ b/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/PhoneStatusBarService.java @@ -101,7 +101,7 @@ public class PhoneStatusBarService extends StatusBarService { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_BACK: if (!down) { - //TODO PhoneStatusBarService.this.deactivate(); + //TODO PhoneStatusBarService.this.collapse(); } return true; } @@ -329,6 +329,42 @@ public class PhoneStatusBarService extends StatusBarService { Slog.d(TAG, "removeIcon slot=" + slot + " index=" + index + " viewIndex=" + viewIndex); mStatusIcons.removeViewAt(viewIndex); } + + /** + * State is one or more of the DISABLE constants from StatusBarManager. + */ + public void disable(int state) { + final int old = mDisabled; + final int diff = state ^ old; + mDisabled = state; + + if ((diff & StatusBarManager.DISABLE_EXPAND) != 0) { + if ((state & StatusBarManager.DISABLE_EXPAND) != 0) { + Slog.d(TAG, "DISABLE_EXPAND: yes"); + animateCollapse(); + } + } + if ((diff & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) { + if ((state & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) { + Slog.d(TAG, "DISABLE_NOTIFICATION_ICONS: yes"); + if (mTicking) { + mTicker.halt(); + } else { + setNotificationIconVisibility(false, com.android.internal.R.anim.fade_out); + } + } else { + Slog.d(TAG, "DISABLE_NOTIFICATION_ICONS: no"); + if (!mExpandedVisible) { + setNotificationIconVisibility(true, com.android.internal.R.anim.fade_in); + } + } + } else if ((diff & StatusBarManager.DISABLE_NOTIFICATION_TICKER) != 0) { + if (mTicking && (state & StatusBarManager.DISABLE_NOTIFICATION_TICKER) != 0) { + Slog.d(TAG, "DISABLE_NOTIFICATION_TICKER: yes"); + mTicker.halt(); + } + } + } /** * All changes to the status bar and notifications funnel through here and are batched. @@ -854,7 +890,7 @@ public class PhoneStatusBarService extends StatusBarService { // the stack trace isn't very helpful here. Just log the exception message. Slog.w(TAG, "Sending contentIntent failed: " + e); } - //deactivate(); + //collapse(); } } @@ -1224,7 +1260,7 @@ public class PhoneStatusBarService extends StatusBarService { if ((diff & StatusBarManager.DISABLE_EXPAND) != 0) { if ((net & StatusBarManager.DISABLE_EXPAND) != 0) { Slog.d(TAG, "DISABLE_EXPAND: yes"); - animateCollapse(); + //animateCollapse(); } } if ((diff & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) { @@ -1261,7 +1297,7 @@ public class PhoneStatusBarService extends StatusBarService { String action = intent.getAction(); if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action) || Intent.ACTION_SCREEN_OFF.equals(action)) { - //deactivate(); + //collapse(); } else if (Telephony.Intents.SPN_STRINGS_UPDATED_ACTION.equals(action)) { updateNetworkName(intent.getBooleanExtra(Telephony.Intents.EXTRA_SHOW_SPN, false), |