Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 92aaff8a authored by Chris Wren's avatar Chris Wren Committed by Android (Google) Code Review
Browse files

Merge "add a setting for the heads up: base part"

parents 718e39f1 7bd24123
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -6099,6 +6099,16 @@ public final class Settings {
            throw new IllegalArgumentException("Invalid zen mode: " + mode);
        }

        /**
         * Defines global heads up toggle.  One of HEADS_UP_OFF, HEADS_UP_ON.
         *
         * @hide
         */
        public static final String HEADS_UP = "heads_up_enabled";

        /** @hide */ public static final int HEADS_UP_OFF = 0;
        /** @hide */ public static final int HEADS_UP_ON = 1;

        /**
         * Settings to backup. This is here so that it's in the same place as the settings
         * keys and easy to update.
+0 −1
Original line number Diff line number Diff line
@@ -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
+7 −4
Original line number Diff line number Diff line
@@ -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=");
+17 −12
Original line number Diff line number Diff line
@@ -73,6 +73,11 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.

    public boolean setNotification(NotificationData.Entry headsUp) {
        mHeadsUp = headsUp;
        if (mContentHolder != null) {
            mContentHolder.removeAllViews();
        }

        if (mHeadsUp != null) {
            mHeadsUp.row.setExpanded(true);
            mHeadsUp.row.setShowingPublic(false);
            if (mContentHolder == null) {
@@ -82,10 +87,10 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
            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;
    }