diff --git a/res/layout/preference_importance_slider.xml b/res/layout/preference_importance_slider.xml
index 737254be11b..d7d04b4a8b5 100644
--- a/res/layout/preference_importance_slider.xml
+++ b/res/layout/preference_importance_slider.xml
@@ -55,23 +55,26 @@
+ android:focusable="true"
+ android:background="#00ffffff"
+ style="@android:style/Widget.Material.SeekBar.Discrete"
+ android:tickMarkTint="@android:color/black"/>
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 709277b8bd8..4afa1d96fa3 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -34,11 +34,8 @@ import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageManager;
import android.content.pm.IntentFilterVerificationInfo;
-import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
-import android.content.pm.Signature;
import android.content.pm.UserInfo;
import android.content.res.Resources;
import android.content.res.TypedArray;
@@ -707,35 +704,6 @@ public final class Utils extends com.android.settingslib.Utils {
return tm.getSimCount() > 1;
}
- /**
- * Determine whether a package is a "system package", in which case certain things (like
- * disabling notifications or disabling the package altogether) should be disallowed.
- */
- public static boolean isSystemPackage(PackageManager pm, PackageInfo pkg) {
- if (sSystemSignature == null) {
- sSystemSignature = new Signature[]{ getSystemSignature(pm) };
- }
- return sSystemSignature[0] != null && sSystemSignature[0].equals(getFirstSignature(pkg));
- }
-
- private static Signature[] sSystemSignature;
-
- private static Signature getFirstSignature(PackageInfo pkg) {
- if (pkg != null && pkg.signatures != null && pkg.signatures.length > 0) {
- return pkg.signatures[0];
- }
- return null;
- }
-
- private static Signature getSystemSignature(PackageManager pm) {
- try {
- final PackageInfo sys = pm.getPackageInfo("android", PackageManager.GET_SIGNATURES);
- return getFirstSignature(sys);
- } catch (NameNotFoundException e) {
- }
- return null;
- }
-
/**
* Returns elapsed time for the given millis, in the following format:
* 2d 5h 40m 29s
diff --git a/src/com/android/settings/notification/AppNotificationSettings.java b/src/com/android/settings/notification/AppNotificationSettings.java
index 2ee2b811089..9add4eba90d 100644
--- a/src/com/android/settings/notification/AppNotificationSettings.java
+++ b/src/com/android/settings/notification/AppNotificationSettings.java
@@ -70,7 +70,6 @@ public class AppNotificationSettings extends SettingsPreferenceFragment {
private PreferenceCategory mCategories;
private AppRow mAppRow;
private boolean mCreated;
- private boolean mIsSystemPackage;
private int mUid;
@Override
@@ -126,12 +125,10 @@ public class AppNotificationSettings extends SettingsPreferenceFragment {
toastAndFinish();
return;
}
- mIsSystemPackage = Utils.isSystemPackage(pm, info);
-
addPreferencesFromResource(R.xml.app_notification_settings);
mBlock = (SwitchPreference) findPreference(KEY_BLOCK);
- mAppRow = mBackend.loadAppRow(pm, info.applicationInfo);
+ mAppRow = mBackend.loadAppRow(pm, info);
// load settings intent
ArrayMap rows = new ArrayMap();
@@ -160,7 +157,7 @@ public class AppNotificationSettings extends SettingsPreferenceFragment {
}
mBlock.setChecked(mAppRow.banned);
- updateDependents(mAppRow.banned);
+ updateDependents(mAppRow.systemApp, mAppRow.banned);
mBlock.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
@@ -171,7 +168,7 @@ public class AppNotificationSettings extends SettingsPreferenceFragment {
}
final boolean success = mBackend.setNotificationsBanned(pkg, mUid, banned);
if (success) {
- updateDependents(banned);
+ updateDependents(mAppRow.systemApp, banned);
}
return success;
}
@@ -200,8 +197,8 @@ public class AppNotificationSettings extends SettingsPreferenceFragment {
}
}
- private void updateDependents(boolean banned) {
- setVisible(mBlock, !mIsSystemPackage);
+ private void updateDependents(boolean isSystemPackage, boolean banned) {
+ setVisible(mBlock, !isSystemPackage);
if (mCategories != null) {
setVisible(mCategories, !banned);
}
diff --git a/src/com/android/settings/notification/ImportanceSeekBarPreference.java b/src/com/android/settings/notification/ImportanceSeekBarPreference.java
index 58892e32cd3..190a9ab0127 100644
--- a/src/com/android/settings/notification/ImportanceSeekBarPreference.java
+++ b/src/com/android/settings/notification/ImportanceSeekBarPreference.java
@@ -36,6 +36,7 @@ public class ImportanceSeekBarPreference extends SeekBarPreference implements
private Callback mCallback;
private TextView mSummaryTextView;
private String mSummary;
+ private int mMinProgress;
public ImportanceSeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
@@ -59,6 +60,10 @@ public class ImportanceSeekBarPreference extends SeekBarPreference implements
mCallback = callback;
}
+ public void setMinimumProgress(int minProgress) {
+ mMinProgress = minProgress;
+ }
+
@Override
public void onBindViewHolder(PreferenceViewHolder view) {
super.onBindViewHolder(view);
@@ -72,8 +77,12 @@ public class ImportanceSeekBarPreference extends SeekBarPreference implements
}
@Override
- public void onProgressChanged(SeekBar seekBar, final int progress, boolean fromTouch) {
+ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromTouch) {
super.onProgressChanged(seekBar, progress, fromTouch);
+ if (progress < mMinProgress) {
+ seekBar.setProgress(mMinProgress);
+ progress = mMinProgress;
+ }
if (mSummaryTextView != null) {
mSummaryTextView.setText(getProgressSummary(progress));
}
diff --git a/src/com/android/settings/notification/NotificationBackend.java b/src/com/android/settings/notification/NotificationBackend.java
index 15f82fe02c3..d37cccaa76b 100644
--- a/src/com/android/settings/notification/NotificationBackend.java
+++ b/src/com/android/settings/notification/NotificationBackend.java
@@ -22,12 +22,14 @@ import android.app.Notification;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ParceledListSlice;
import android.graphics.drawable.Drawable;
import android.os.ServiceManager;
import android.service.notification.NotificationListenerService;
import android.util.Log;
+import com.android.settingslib.Utils;
import java.util.List;
@@ -52,12 +54,19 @@ public class NotificationBackend {
return row;
}
- public TopicRow loadTopicRow(PackageManager pm, ApplicationInfo app, Notification.Topic topic) {
+ public AppRow loadAppRow(PackageManager pm, PackageInfo app) {
+ final AppRow row = loadAppRow(pm, app.applicationInfo);
+ row.systemApp = Utils.isSystemPackage(pm, app);
+ return row;
+ }
+
+ public TopicRow loadTopicRow(PackageManager pm, PackageInfo app, Notification.Topic topic) {
final TopicRow row = new TopicRow();
row.pkg = app.packageName;
- row.uid = app.uid;
+ row.uid = app.applicationInfo.uid;
row.label = topic.getLabel();
- row.icon = app.loadIcon(pm);
+ row.icon = app.applicationInfo.loadIcon(pm);
+ row.systemApp = Utils.isSystemPackage(pm, app);
row.topic = topic;
row.priority = getBypassZenMode(row.pkg, row.uid, row.topic);
row.sensitive = getSensitive(row.pkg, row.uid, row.topic);
@@ -170,6 +179,7 @@ public class NotificationBackend {
public Intent settingsIntent;
public boolean banned;
public boolean first; // first app in section
+ public boolean systemApp;
}
public static class TopicRow extends AppRow {
diff --git a/src/com/android/settings/notification/TopicNotificationSettings.java b/src/com/android/settings/notification/TopicNotificationSettings.java
index e8586c27af6..f2cbf1a551e 100644
--- a/src/com/android/settings/notification/TopicNotificationSettings.java
+++ b/src/com/android/settings/notification/TopicNotificationSettings.java
@@ -34,6 +34,7 @@ import android.os.Bundle;
import android.os.UserHandle;
import android.provider.Settings;
import android.service.notification.NotificationListenerService;
+import android.service.notification.NotificationListenerService.Ranking;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.Preference.OnPreferenceChangeListener;
@@ -130,9 +131,11 @@ public class TopicNotificationSettings extends SettingsPreferenceFragment {
mPriority = (SwitchPreference) findPreference(KEY_BYPASS_DND);
mSensitive = (SwitchPreference) findPreference(KEY_SENSITIVE);
- mTopicRow = mBackend.loadTopicRow(pm, info.applicationInfo, topic);
+ mTopicRow = mBackend.loadTopicRow(pm, info, topic);
- mImportance.setMax(4);
+ mImportance.setMinimumProgress(
+ mTopicRow.systemApp ? Ranking.IMPORTANCE_LOW : Ranking.IMPORTANCE_NONE);
+ mImportance.setMax(Ranking.IMPORTANCE_MAX);
// TODO: stop defaulting to 'normal' in the UI when there are mocks for this scenario.
int importance =
mTopicRow.importance == NotificationListenerService.Ranking.IMPORTANCE_UNSPECIFIED