From cac8862bb93031f75b2ba6eb528e1e954fb4a28d Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Thu, 3 Mar 2016 09:28:19 -0500 Subject: [PATCH] Inline settings update. -Show silently is IMPORTANCE_LOW, not DEFAULT. -Select the correct default option. Change-Id: Ic09174cf55fcc36a06abf1f8f39bc96beb931f69 --- .../android/systemui/statusbar/NotificationGuts.java | 17 +++++++++++++---- .../server/notification/NotificationManagerService.java | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java index 1c16bdc0d7bb..45a24a0b3822 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java @@ -130,7 +130,12 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab importanceSlider.setVisibility(View.VISIBLE); importanceButtons.setVisibility(View.GONE); } 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); importanceSlider.setVisibility(View.GONE); } @@ -144,7 +149,7 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab if (mBlock.isChecked()) { progress = NotificationListenerService.Ranking.IMPORTANCE_NONE; } else if (mSilent.isChecked()) { - progress = NotificationListenerService.Ranking.IMPORTANCE_DEFAULT; + progress = NotificationListenerService.Ranking.IMPORTANCE_LOW; } else { 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) { mBlock = (RadioButton) importanceButtons.findViewById(R.id.block_importance); mSilent = (RadioButton) importanceButtons.findViewById(R.id.silent_importance); @@ -169,7 +174,11 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab } else { mReset.setText(mContext.getString(R.string.do_not_silence_block)); } - mReset.setChecked(true); + if (importance == NotificationListenerService.Ranking.IMPORTANCE_LOW) { + mSilent.setChecked(true); + } else { + mReset.setChecked(true); + } } private void bindSlider(final View importanceSlider, final StatusBarNotification sbn, diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index e8d27dbb80f3..385557981376 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -1320,7 +1320,7 @@ public class NotificationManagerService extends SystemService { @Override public int getImportance(String pkg, int uid) { - checkCallerIsSystem(); + enforceSystemOrSystemUI("Caller not system or systemui"); return mRankingHelper.getImportance(pkg, uid); } -- 2.11.0