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

Commit cac8862b authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Inline settings update.

-Show silently is IMPORTANCE_LOW, not DEFAULT.
-Select the correct default option.

Change-Id: Ic09174cf55fcc36a06abf1f8f39bc96beb931f69
parent 19f47929
Loading
Loading
Loading
Loading
+13 −4
Original line number Original line Diff line number Diff line
@@ -130,7 +130,12 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab
            importanceSlider.setVisibility(View.VISIBLE);
            importanceSlider.setVisibility(View.VISIBLE);
            importanceButtons.setVisibility(View.GONE);
            importanceButtons.setVisibility(View.GONE);
        } else {
        } else {
            bindToggles(importanceButtons, sbn, systemApp);
            int userImportance = NotificationListenerService.Ranking.IMPORTANCE_UNSPECIFIED;
            try {
                userImportance =
                        mINotificationManager.getImportance(sbn.getPackageName(), sbn.getUid());
            } catch (RemoteException e) {}
            bindToggles(importanceButtons, userImportance, systemApp);
            importanceButtons.setVisibility(View.VISIBLE);
            importanceButtons.setVisibility(View.VISIBLE);
            importanceSlider.setVisibility(View.GONE);
            importanceSlider.setVisibility(View.GONE);
        }
        }
@@ -144,7 +149,7 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab
            if (mBlock.isChecked()) {
            if (mBlock.isChecked()) {
                progress = NotificationListenerService.Ranking.IMPORTANCE_NONE;
                progress = NotificationListenerService.Ranking.IMPORTANCE_NONE;
            } else if (mSilent.isChecked()) {
            } else if (mSilent.isChecked()) {
                progress = NotificationListenerService.Ranking.IMPORTANCE_DEFAULT;
                progress = NotificationListenerService.Ranking.IMPORTANCE_LOW;
            } else {
            } else {
                progress = NotificationListenerService.Ranking.IMPORTANCE_UNSPECIFIED;
                progress = NotificationListenerService.Ranking.IMPORTANCE_UNSPECIFIED;
            }
            }
@@ -158,7 +163,7 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab
        }
        }
    }
    }


    private void bindToggles(final View importanceButtons, final StatusBarNotification sbn,
    private void bindToggles(final View importanceButtons, final int importance,
            final boolean systemApp) {
            final boolean systemApp) {
        mBlock = (RadioButton) importanceButtons.findViewById(R.id.block_importance);
        mBlock = (RadioButton) importanceButtons.findViewById(R.id.block_importance);
        mSilent = (RadioButton) importanceButtons.findViewById(R.id.silent_importance);
        mSilent = (RadioButton) importanceButtons.findViewById(R.id.silent_importance);
@@ -169,8 +174,12 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab
        } else {
        } else {
            mReset.setText(mContext.getString(R.string.do_not_silence_block));
            mReset.setText(mContext.getString(R.string.do_not_silence_block));
        }
        }
        if (importance == NotificationListenerService.Ranking.IMPORTANCE_LOW) {
            mSilent.setChecked(true);
        } else {
            mReset.setChecked(true);
            mReset.setChecked(true);
        }
        }
    }


    private void bindSlider(final View importanceSlider, final StatusBarNotification sbn,
    private void bindSlider(final View importanceSlider, final StatusBarNotification sbn,
            final boolean systemApp) {
            final boolean systemApp) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -1320,7 +1320,7 @@ public class NotificationManagerService extends SystemService {


        @Override
        @Override
        public int getImportance(String pkg, int uid) {
        public int getImportance(String pkg, int uid) {
            checkCallerIsSystem();
            enforceSystemOrSystemUI("Caller not system or systemui");
            return mRankingHelper.getImportance(pkg, uid);
            return mRankingHelper.getImportance(pkg, uid);
        }
        }