Merge "Introduce IMPORTANCE_MIN." into nyc-dev
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f1f43c0..dfc17a2 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5966,17 +5966,20 @@
     <!-- [CHAR LIMIT=100] Notification Importance slider: blocked importance level description -->
     <string name="notification_importance_blocked">Blocked: Never show these notifications</string>
 
+    <!-- [CHAR LIMIT=100] Notification Importance slider: min importance level description -->
+    <string name="notification_importance_min">Min: Silently show at the bottom of the notification list</string>
+
     <!-- [CHAR LIMIT=100] Notification Importance slider: low importance level description -->
-    <string name="notification_importance_low">Low: Silently show at the bottom of the notification list</string>
+    <string name="notification_importance_low">Low: Silently show these notifications</string>
 
     <!-- [CHAR LIMIT=100] Notification Importance slider: normal importance level description -->
-    <string name="notification_importance_default">Normal: Silently show these notifications</string>
+    <string name="notification_importance_default">Normal: Allow these notification to make sounds</string>
 
     <!-- [CHAR LIMIT=100] Notification Importance slider: high importance level description -->
-    <string name="notification_importance_high">High: Show at the top of the notifications list and allow sound</string>
+    <string name="notification_importance_high">High: Peek onto the screen and allow sound and allow sound</string>
 
     <!-- [CHAR LIMIT=100] Notification Importance slider: max importance level description -->
-    <string name="notification_importance_max">Urgent: Peek onto the screen and allow sound</string>
+    <string name="notification_importance_max">Urgent: Show at the top of the notifications list, peek onto the screen and allow sound</string>
 
     <!-- [CHAR LIMIT=60] Notification importance reset button -->
     <string name="importance_reset">Reset</string>
diff --git a/src/com/android/settings/notification/AppNotificationSettings.java b/src/com/android/settings/notification/AppNotificationSettings.java
index f04cf2f..c82ad19 100644
--- a/src/com/android/settings/notification/AppNotificationSettings.java
+++ b/src/com/android/settings/notification/AppNotificationSettings.java
@@ -106,12 +106,12 @@
         final boolean allowPrivate = getLockscreenAllowPrivateNotifications();
 
         if (getPreferenceScreen().findPreference(mBlock.getKey()) != null) {
-            setVisible(mSilent, checkCanBeVisible(Ranking.IMPORTANCE_LOW, importance));
-            mSilent.setChecked(importance == Ranking.IMPORTANCE_DEFAULT);
+            setVisible(mSilent, checkCanBeVisible(Ranking.IMPORTANCE_MIN, importance));
+            mSilent.setChecked(importance == Ranking.IMPORTANCE_LOW);
         }
-        setVisible(mPriority, checkCanBeVisible(Ranking.IMPORTANCE_LOW, importance)
+        setVisible(mPriority, checkCanBeVisible(Ranking.IMPORTANCE_DEFAULT, importance)
                 && !mDndVisualEffectsSuppressed);
-        setVisible(mSensitive, checkCanBeVisible(Ranking.IMPORTANCE_HIGH, importance)
+        setVisible(mSensitive, checkCanBeVisible(Ranking.IMPORTANCE_MIN, importance)
                 && lockscreenSecure && lockscreenNotificationsEnabled && allowPrivate);
     }
 
diff --git a/src/com/android/settings/notification/NotificationSettingsBase.java b/src/com/android/settings/notification/NotificationSettingsBase.java
index 895d38d..ee0cac0 100644
--- a/src/com/android/settings/notification/NotificationSettingsBase.java
+++ b/src/com/android/settings/notification/NotificationSettingsBase.java
@@ -175,7 +175,7 @@
             mImportanceTitle.setSummary(getProgressSummary(importance));
             mImportance.setSystemApp(isSystemApp);
             mImportance.setMinimumProgress(
-                    isSystemApp ? Ranking.IMPORTANCE_LOW : Ranking.IMPORTANCE_NONE);
+                    isSystemApp ? Ranking.IMPORTANCE_MIN : Ranking.IMPORTANCE_NONE);
             mImportance.setMax(Ranking.IMPORTANCE_MAX);
             mImportance.setProgress(importance);
             mImportance.setCallback(new ImportanceSeekBarPreference.Callback() {
@@ -230,7 +230,7 @@
                 public boolean onPreferenceChange(Preference preference, Object newValue) {
                     final boolean silenced = (Boolean) newValue;
                     final int importance =
-                            silenced ? Ranking.IMPORTANCE_DEFAULT : Ranking.IMPORTANCE_UNSPECIFIED;
+                            silenced ? Ranking.IMPORTANCE_LOW : Ranking.IMPORTANCE_UNSPECIFIED;
                     mBackend.setImportance(mPkgInfo.packageName, mUid, importance);
                     updateDependents(importance);
                     return true;
@@ -244,6 +244,8 @@
         switch (progress) {
             case Ranking.IMPORTANCE_NONE:
                 return mContext.getString(R.string.notification_importance_blocked);
+            case Ranking.IMPORTANCE_MIN:
+                return mContext.getString(R.string.notification_importance_min);
             case Ranking.IMPORTANCE_LOW:
                 return mContext.getString(R.string.notification_importance_low);
             case Ranking.IMPORTANCE_DEFAULT:
diff --git a/src/com/android/settings/notification/NotificationStation.java b/src/com/android/settings/notification/NotificationStation.java
index 7c79e8b..b871848 100644
--- a/src/com/android/settings/notification/NotificationStation.java
+++ b/src/com/android/settings/notification/NotificationStation.java
@@ -109,6 +109,11 @@
         public void onNotificationRankingUpdate(RankingMap ranking) {
             mRanking = ranking;
         }
+
+        @Override
+        public void onListenerConnected() {
+            mRanking = getCurrentRanking();
+        }
     };
 
     private Context mContext;