diff options
3 files changed, 26 insertions, 5 deletions
diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java index 51d7393..72ec616 100644 --- a/core/java/android/app/StatusBarManager.java +++ b/core/java/android/app/StatusBarManager.java @@ -31,12 +31,12 @@ import android.os.ServiceManager; public class StatusBarManager { /** * Flag for {@link #disable} to make the status bar not expandable. Unless you also - * set {@link #DISABLE_NOTIFICATIONS}, new notifications will continue to show. + * set {@link #DISABLE_NOTIFICATION_ICONS}, new notifications will continue to show. */ public static final int DISABLE_EXPAND = 0x00000001; /** - * Flag for {@link #disable} to hide notification icons and ticker text. + * Flag for {@link #disable} to hide notification icons and scrolling ticker text. */ public static final int DISABLE_NOTIFICATION_ICONS = 0x00000002; @@ -47,6 +47,12 @@ public class StatusBarManager { public static final int DISABLE_NOTIFICATION_ALERTS = 0x00000004; /** + * Flag for {@link #disable} to hide only the scrolling ticker. Note that + * {@link #DISABLE_NOTIFICATION_ICONS} implies {@link #DISABLE_NOTIFICATION_TICKER}. + */ + public static final int DISABLE_NOTIFICATION_TICKER = 0x00000008; + + /** * Re-enable all of the status bar features that you've disabled. */ public static final int DISABLE_NONE = 0x00000000; diff --git a/services/java/com/android/server/status/StatusBarService.java b/services/java/com/android/server/status/StatusBarService.java index ab29575..55041fb 100644 --- a/services/java/com/android/server/status/StatusBarService.java +++ b/services/java/com/android/server/status/StatusBarService.java @@ -687,7 +687,8 @@ public class StatusBarService extends IStatusBar.Stub && (oldData == null || oldData.tickerText == null || !CharSequences.equals(oldData.tickerText, n.tickerText))) { - if ((mDisabled & StatusBarManager.DISABLE_NOTIFICATION_ICONS) == 0) { + if (0 == (mDisabled & + (StatusBarManager.DISABLE_NOTIFICATION_ICONS | StatusBarManager.DISABLE_NOTIFICATION_TICKER))) { mTicker.addEntry(n, StatusBarIcon.getIcon(mContext, data), n.tickerText); } } @@ -1698,6 +1699,10 @@ public class StatusBarService extends IStatusBar.Stub setNotificationIconVisibility(true, com.android.internal.R.anim.fade_in); } } + } else if ((diff & StatusBarManager.DISABLE_NOTIFICATION_TICKER) != 0) { + if (mTicking && (net & StatusBarManager.DISABLE_NOTIFICATION_TICKER) != 0) { + mTicker.halt(); + } } } diff --git a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java index 275e5cb..06506fb 100644 --- a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java +++ b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java @@ -62,6 +62,11 @@ public class StatusBarTest extends TestActivity mStatusBarManager.disable(StatusBarManager.DISABLE_NOTIFICATION_ALERTS); } }, + new Test("Disable Ticker") { + public void run() { + mStatusBarManager.disable(StatusBarManager.DISABLE_NOTIFICATION_TICKER); + } + }, new Test("Disable Expand in 3 sec.") { public void run() { mHandler.postDelayed(new Runnable() { @@ -80,7 +85,7 @@ public class StatusBarTest extends TestActivity }, 3000); } }, - new Test("Disable Both in 3 sec.") { + new Test("Disable Expand + Notifications in 3 sec.") { public void run() { mHandler.postDelayed(new Runnable() { public void run() { @@ -90,7 +95,12 @@ public class StatusBarTest extends TestActivity }, 3000); } }, - new Test("Disable None in 3 sec.") { + new Test("Enable everything") { + public void run() { + mStatusBarManager.disable(0); + } + }, + new Test("Enable everything in 3 sec.") { public void run() { mHandler.postDelayed(new Runnable() { public void run() { |