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

Commit 658a918e authored by Michael Bestas's avatar Michael Bestas Committed by Roman Birg
Browse files

Enable ticker when heads up notifications are disabled

* When heads up notifications are disabled,
  high priority notifications use the old ticker.
* Low priority notification behaviour is unchanged.

Partially based on https://github.com/Euphoria-OS/android_frameworks_base/commit/a41dacb497a6802b88a377134f6c612b7ac6a710

Change-Id: Ie69c42ca1e473876d398e6e3b816e278a5dbed37
parent 3aa55a36
Loading
Loading
Loading
Loading
+21 −13
Original line number Diff line number Diff line
@@ -640,6 +640,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
                    Settings.Global.HEADS_UP_OFF);
            mHeadsUpTicker = mUseHeadsUp && 0 != Settings.Global.getInt(
                    mContext.getContentResolver(), SETTING_HEADS_UP_TICKER, 0);
            mTickerEnabled = !mUseHeadsUp;
            Log.d(TAG, "heads up is " + (mUseHeadsUp ? "enabled" : "disabled"));
            if (wasUsing != mUseHeadsUp) {
                if (!mUseHeadsUp) {
@@ -651,6 +652,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
                    addHeadsUpView();
                }
            }
            initTickerView();
        }
    };

@@ -1049,17 +1051,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
                        R.id.keyguard_indication_text));
        mKeyguardBottomArea.setKeyguardIndicationController(mKeyguardIndicationController);

        mTickerEnabled = res.getBoolean(R.bool.enable_ticker);
        if (mTickerEnabled) {
            final ViewStub tickerStub = (ViewStub) mStatusBarView.findViewById(R.id.ticker_stub);
            if (tickerStub != null) {
                mTickerView = tickerStub.inflate();
                mTicker = new MyTicker(context, mStatusBarView);

                TickerView tickerView = (TickerView) mStatusBarView.findViewById(R.id.tickerText);
                tickerView.mTicker = mTicker;
            }
        }
        initTickerView();

        mEdgeBorder = res.getDimensionPixelSize(R.dimen.status_bar_edge_ignore);

@@ -1366,6 +1358,21 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        return mStatusBarWindow;
    }

    private void initTickerView() {
        if (mTickerEnabled && (mTicker == null || mTickerView == null)) {
            final ViewStub tickerStub = (ViewStub) mStatusBarView.findViewById(R.id.ticker_stub);
            if (tickerStub != null) {
                mTickerView = tickerStub.inflate();
                mTicker = new MyTicker(mContext, mStatusBarView);

                TickerView tickerView = (TickerView) mStatusBarView.findViewById(R.id.tickerText);
                tickerView.mTicker = mTicker;
            } else {
                mTickerEnabled = false;
            }
        }
    }

    @Override
    protected WindowManager.LayoutParams getSearchLayoutParams(LayoutParams layoutParams) {
        boolean opaque = false;
@@ -1791,7 +1798,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,

        if (old != null) {
            // Cancel the ticker if it's still running
            if (mTickerEnabled) {
            if (mTickerEnabled && shouldInterrupt(old)) {
                mTicker.removeEntry(old);
            }

@@ -3340,7 +3347,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        // because...  well, what's the point otherwise?  And trying to
        // run a ticker without being attached will crash!
        if (n.getNotification().tickerText != null && mStatusBarWindow != null
                && mStatusBarWindow.getWindowToken() != null) {
                && mStatusBarWindow.getWindowToken() != null
                && shouldInterrupt(n)) {
            if (0 == (mDisabled & (StatusBarManager.DISABLE_NOTIFICATION_ICONS
                    | StatusBarManager.DISABLE_NOTIFICATION_TICKER))) {
                mTicker.addEntry(n);