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

Commit f6e83f45 authored by Chris Wren's avatar Chris Wren
Browse files

disable heads up feature in klp.

Bug: 10315685
Change-Id: If1c096e133b70db92ae06f2b632faa5e25cf015a
parent b25cfdf1
Loading
Loading
Loading
Loading
+3 −21
Original line number Diff line number Diff line
@@ -93,14 +93,14 @@ 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.
    private static final int INTERRUPTION_THRESHOLD = 11;
    protected static final int INTERRUPTION_THRESHOLD = 11;
    protected static final String SETTING_HEADS_UP = "heads_up_enabled";

    // Should match the value in PhoneWindowManager
    public static final String SYSTEM_DIALOG_REASON_RECENT_APPS = "recentapps";

    public static final int EXPANDED_LEAVE_ALONE = -10000;
    public static final int EXPANDED_FULL_OPEN = -10001;
    private static final String SETTING_HEADS_UP = "heads_up_enabled";

    protected CommandQueue mCommandQueue;
    protected IStatusBarService mBarService;
@@ -125,7 +125,7 @@ public abstract class BaseStatusBar extends SystemUI implements

    protected int mLayoutDirection;
    private Locale mLocale;
    protected boolean mUseHeadsUp = true;
    protected boolean mUseHeadsUp = false;

    protected IDreamManager mDreamManager;
    KeyguardManager mKeyguardManager;
@@ -170,19 +170,6 @@ public abstract class BaseStatusBar extends SystemUI implements
        }
    };

    final private ContentObserver mHeadsUpObserver = new ContentObserver(mHandler) {
        @Override
        public void onChange(boolean selfChange) {
            mUseHeadsUp = ENABLE_HEADS_UP && 0 != Settings.Global.getInt(
                    mContext.getContentResolver(), SETTING_HEADS_UP, 0);
            Log.d(TAG, "heads up is " + (mUseHeadsUp ? "enabled" : "disabled"));
            if (!mUseHeadsUp) {
                Log.d(TAG, "dismissing any existing heads up notification on disable event");
                mHandler.sendEmptyMessage(MSG_HIDE_HEADS_UP);
            }
        }
    };

    private RemoteViews.OnClickHandler mOnClickHandler = new RemoteViews.OnClickHandler() {
        @Override
        public boolean onClickHandler(View view, PendingIntent pendingIntent, Intent fillInIntent) {
@@ -242,11 +229,6 @@ public abstract class BaseStatusBar extends SystemUI implements
                Settings.Global.getUriFor(Settings.Global.DEVICE_PROVISIONED), true,
                mProvisioningObserver);

        mHeadsUpObserver.onChange(false); // set up
        mContext.getContentResolver().registerContentObserver(
                Settings.Global.getUriFor(SETTING_HEADS_UP), true,
                mHeadsUpObserver);

        mBarService = IStatusBarService.Stub.asInterface(
                ServiceManager.getService(Context.STATUS_BAR_SERVICE));

+30 −1
Original line number Diff line number Diff line
@@ -306,6 +306,25 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
        }
    };

    final private ContentObserver mHeadsUpObserver = new ContentObserver(mHandler) {
        @Override
        public void onChange(boolean selfChange) {
            boolean wasUsing = mUseHeadsUp;
            mUseHeadsUp = ENABLE_HEADS_UP && 0 != Settings.Global.getInt(
                    mContext.getContentResolver(), SETTING_HEADS_UP, 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);
                    removeHeadsUpView();
                } else {
                    addHeadsUpView();
                }
            }
        }
    };

    private int mInteractingWindows;
    private boolean mAutohideSuspended;
    private int mStatusBarMode;
@@ -332,6 +351,13 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {

        // Lastly, call to the icon policy to install/update all the icons.
        mIconPolicy = new PhoneStatusBarPolicy(mContext);

        mHeadsUpObserver.onChange(true); // set up
        if (ENABLE_HEADS_UP) {
            mContext.getContentResolver().registerContentObserver(
                    Settings.Global.getUriFor(SETTING_HEADS_UP), true,
                    mHeadsUpObserver);
        }
    }

    // ================================================================================
@@ -817,6 +843,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
        mWindowManager.addView(mHeadsUpNotificationView, lp);
    }

    private void removeHeadsUpView() {
        mWindowManager.removeView(mHeadsUpNotificationView);
    }

    public void refreshAllStatusBarIcons() {
        refreshAllIconsForLayout(mStatusIcons);
        refreshAllIconsForLayout(mNotificationIcons);
@@ -2206,7 +2236,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
    @Override
    public void createAndAddWindows() {
        addStatusBarWindow();
        if (ENABLE_HEADS_UP) addHeadsUpView();
    }

    private void addStatusBarWindow() {