diff options
author | Chris Wren <cwren@android.com> | 2014-02-28 16:25:05 -0500 |
---|---|---|
committer | Chris Wren <cwren@android.com> | 2014-02-28 17:37:51 -0500 |
commit | 7bd2412332f5cf7b22fd730397d1225fbea00cbf (patch) | |
tree | 58e4eeb7e54184f503c86545fb257091850c6b67 /packages | |
parent | 9f6a372ca08c657447ef4b8dc6c80a89202247f8 (diff) | |
download | frameworks_base-7bd2412332f5cf7b22fd730397d1225fbea00cbf.zip frameworks_base-7bd2412332f5cf7b22fd730397d1225fbea00cbf.tar.gz frameworks_base-7bd2412332f5cf7b22fd730397d1225fbea00cbf.tar.bz2 |
add a setting for the heads up: base part
also fix a crash if the feature is disabled and then enabled
while a heads up is active.
Bug: 13208692
Change-Id: I6847f7a5f275aee2f608de0237dab0e45c39b33f
Diffstat (limited to 'packages')
3 files changed, 24 insertions, 17 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 8509701..fb11743 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -96,7 +96,6 @@ public abstract class BaseStatusBar extends SystemUI implements protected static final boolean ENABLE_HEADS_UP = true; // scores above this threshold should be displayed in heads up mode. protected static final int INTERRUPTION_THRESHOLD = 11; - protected static final String SETTING_HEADS_UP = "heads_up_enabled"; protected static final String SETTING_HEADS_UP_TICKER = "ticker_gets_heads_up"; // Should match the value in PhoneWindowManager diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 1464b39..7694a9f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -312,15 +312,17 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode { @Override public void onChange(boolean selfChange) { boolean wasUsing = mUseHeadsUp; - mUseHeadsUp = ENABLE_HEADS_UP && 0 != Settings.Global.getInt( - mContext.getContentResolver(), SETTING_HEADS_UP, 0); + mUseHeadsUp = ENABLE_HEADS_UP && Settings.Global.HEADS_UP_OFF != Settings.Global.getInt( + mContext.getContentResolver(), Settings.Global.HEADS_UP, + Settings.Global.HEADS_UP_OFF); mHeadsUpTicker = mUseHeadsUp && 0 != Settings.Global.getInt( mContext.getContentResolver(), SETTING_HEADS_UP_TICKER, 0); Log.d(TAG, "heads up is " + (mUseHeadsUp ? "enabled" : "disabled")); if (wasUsing != mUseHeadsUp) { if (!mUseHeadsUp) { Log.d(TAG, "dismissing any existing heads up notification on disable event"); - mHandler.sendEmptyMessage(MSG_HIDE_HEADS_UP); + setHeadsUpVisibility(false); + mHeadsUpNotificationView.setNotification(null); removeHeadsUpView(); } else { addHeadsUpView(); @@ -375,7 +377,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode { mHeadsUpObserver.onChange(true); // set up if (ENABLE_HEADS_UP) { mContext.getContentResolver().registerContentObserver( - Settings.Global.getUriFor(SETTING_HEADS_UP), true, + Settings.Global.getUriFor(Settings.Global.HEADS_UP), true, mHeadsUpObserver); mContext.getContentResolver().registerContentObserver( Settings.Global.getUriFor(SETTING_HEADS_UP_TICKER), true, @@ -2212,6 +2214,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode { pw.println(BarTransitions.modeToString(mStatusBarMode)); pw.print(" mZenMode="); pw.println(Settings.Global.zenModeToString(mZenMode)); + pw.print(" mUseHeadsUp=" + mUseHeadsUp); dumpBarTransitions(pw, "mStatusBarView", mStatusBarView.getBarTransitions()); if (mNavigationBarView != null) { pw.print(" mNavigationBarWindowState="); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java index f4bc4a4..79932a7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java @@ -73,19 +73,24 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper. public boolean setNotification(NotificationData.Entry headsUp) { mHeadsUp = headsUp; - mHeadsUp.row.setExpanded(true); - mHeadsUp.row.setShowingPublic(false); - if (mContentHolder == null) { - // too soon! - return false; + if (mContentHolder != null) { + mContentHolder.removeAllViews(); + } + + if (mHeadsUp != null) { + mHeadsUp.row.setExpanded(true); + mHeadsUp.row.setShowingPublic(false); + if (mContentHolder == null) { + // too soon! + return false; + } + mContentHolder.setX(0); + mContentHolder.setVisibility(View.VISIBLE); + mContentHolder.setAlpha(1f); + mContentHolder.addView(mHeadsUp.row); + mSwipeHelper.snapChild(mContentHolder, 1f); + mStartTouchTime = System.currentTimeMillis() + mTouchSensitivityDelay; } - mContentHolder.setX(0); - mContentHolder.setVisibility(View.VISIBLE); - mContentHolder.setAlpha(1f); - mContentHolder.removeAllViews(); - mContentHolder.addView(mHeadsUp.row); - mSwipeHelper.snapChild(mContentHolder, 1f); - mStartTouchTime = System.currentTimeMillis() + mTouchSensitivityDelay; return true; } |