diff options
| author | 2011-08-24 10:17:18 -0400 | |
|---|---|---|
| committer | 2011-08-24 10:17:18 -0400 | |
| commit | 066c891f6a7bceca660ee26921b13cfa742f4ba8 (patch) | |
| tree | 91fc3737f0ce9ded0ce455ed0300e2d0d15eba67 | |
| parent | b0626b53adceb3de0b85c1865655e74e7e964e08 (diff) | |
TabletStatusBar: Add support for disabling notification LED when user views notifications
This is analogous to similar support in PhoneStatusBar
Bug: 5143247
Change-Id: I553268162f9441fbe03f6a3769d5879cebf3b1f3
Signed-off-by: Mike Lockwood <lockwood@android.com>
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index 76dec5e2716b..dd59667abfae 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -181,7 +181,9 @@ public class TabletStatusBar extends StatusBar implements private InputMethodsPanel mInputMethodsPanel; private CompatModePanel mCompatModePanel; - int mSystemUiVisibility = 0; + private int mSystemUiVisibility = 0; + // used to notify status bar for suppressing notification LED + private boolean mPanelSlightlyVisible; public Context getContext() { return mContext; } @@ -642,6 +644,7 @@ public class TabletStatusBar extends StatusBar implements editor.putBoolean(Prefs.DO_NOT_DISTURB_PREF, false); editor.apply(); animateCollapse(); + visibilityChanged(false); } }); } @@ -740,6 +743,7 @@ public class TabletStatusBar extends StatusBar implements case MSG_HIDE_CHROME: if (DEBUG) Slog.d(TAG, "showing shadows (lights out)"); animateCollapse(); + visibilityChanged(false); mBarContents.setVisibility(View.GONE); mShadow.setVisibility(View.VISIBLE); mSystemUiVisibility |= View.SYSTEM_UI_FLAG_LOW_PROFILE; @@ -752,15 +756,6 @@ public class TabletStatusBar extends StatusBar implements } } - private void notifyLightsChanged(boolean shown) { - try { - Slog.d(TAG, "lights " + (shown?"on":"out")); - mWindowManager.statusBarVisibilityChanged( - shown ? View.STATUS_BAR_VISIBLE : View.STATUS_BAR_HIDDEN); - } catch (RemoteException ex) { - } - } - public void addIcon(String slot, int index, int viewIndex, StatusBarIcon icon) { if (DEBUG) Slog.d(TAG, "addIcon(" + slot + ") -> " + icon); } @@ -934,6 +929,7 @@ public class TabletStatusBar extends StatusBar implements if ((state & StatusBarManager.DISABLE_EXPAND) != 0) { Slog.i(TAG, "DISABLE_EXPAND: yes"); animateCollapse(); + visibilityChanged(false); } } if ((diff & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) { @@ -1036,6 +1032,24 @@ public class TabletStatusBar extends StatusBar implements } } + /** + * The LEDs are turned o)ff when the notification panel is shown, even just a little bit. + * This was added last-minute and is inconsistent with the way the rest of the notifications + * are handled, because the notification isn't really cancelled. The lights are just + * turned off. If any other notifications happen, the lights will turn back on. Steve says + * this is what he wants. (see bug 1131461) + */ + void visibilityChanged(boolean visible) { + if (mPanelSlightlyVisible != visible) { + mPanelSlightlyVisible = visible; + try { + mBarService.onPanelRevealed(); + } catch (RemoteException ex) { + // Won't fail unless the world has ended. + } + } + } + private void notifyUiVisibilityChanged() { try { mWindowManager.statusBarVisibilityChanged(mSystemUiVisibility); @@ -1305,6 +1319,7 @@ public class TabletStatusBar extends StatusBar implements // close the shade if it was open animateCollapse(); + visibilityChanged(false); // If this click was on the intruder alert, hide that instead // mHandler.sendEmptyMessage(MSG_HIDE_INTRUDER); @@ -1383,6 +1398,7 @@ public class TabletStatusBar extends StatusBar implements // require a little more oomph once we're already in peekaboo mode if (mVT.getYVelocity() < -mNotificationFlingVelocity) { animateExpand(); + visibilityChanged(true); hilite(false); mVT.recycle(); mVT = null; @@ -1400,6 +1416,7 @@ public class TabletStatusBar extends StatusBar implements // dragging off the bottom doesn't count && (int)event.getY() < v.getBottom()) { animateExpand(); + visibilityChanged(true); v.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED); v.playSoundEffect(SoundEffectConstants.CLICK); } @@ -1783,6 +1800,7 @@ public class TabletStatusBar extends StatusBar implements // system process is dead if we're here. } animateCollapse(); + visibilityChanged(false); } public void userActivity() { |