Notification slider changes.

Bug: 27558254
Change-Id: I15635ae19e82a57d6e6fcb2f8f946f31bebf5d0f
This commit is contained in:
Julia Reynolds
2016-04-06 20:32:23 -04:00
parent bd666a17a2
commit 088fb52ef8
8 changed files with 210 additions and 158 deletions

View File

@@ -51,7 +51,9 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.service.notification.NotificationListenerService;
import android.service.notification.NotificationListenerService.Ranking;
import android.support.v7.preference.Preference;
import android.support.v7.preference.Preference.OnPreferenceClickListener;
import android.support.v7.preference.PreferenceCategory;
@@ -144,6 +146,8 @@ public class InstalledAppDetails extends AppInfoBase
private static final String KEY_BATTERY = "battery";
private static final String KEY_MEMORY = "memory";
private static final String NOTIFICATION_TUNER_SETTING = "show_importance_slider";
private final HashSet<String> mHomePackages = new HashSet<String>();
private boolean mInitialized;
@@ -1016,13 +1020,22 @@ public class InstalledAppDetails extends AppInfoBase
}
public static CharSequence getNotificationSummary(AppRow appRow, Context context) {
boolean showSlider = Settings.Secure.getInt(
context.getContentResolver(), NOTIFICATION_TUNER_SETTING, 0) == 1;
List<String> summaryAttributes = new ArrayList<>();
StringBuffer summary = new StringBuffer();
if (appRow.banned) {
summaryAttributes.add(context.getString(R.string.notifications_disabled));
} else if (appRow.appImportance > NotificationListenerService.Ranking.IMPORTANCE_NONE
&& appRow.appImportance < NotificationListenerService.Ranking.IMPORTANCE_DEFAULT) {
summaryAttributes.add(context.getString(R.string.notifications_silenced));
if (showSlider) {
if (appRow.appImportance != Ranking.IMPORTANCE_UNSPECIFIED) {
summaryAttributes.add(context.getString(
R.string.notification_summary_level, appRow.appImportance));
}
} else {
if (appRow.banned) {
summaryAttributes.add(context.getString(R.string.notifications_disabled));
} else if (appRow.appImportance > Ranking.IMPORTANCE_NONE
&& appRow.appImportance < Ranking.IMPORTANCE_DEFAULT) {
summaryAttributes.add(context.getString(R.string.notifications_silenced));
}
}
final boolean lockscreenSecure = new LockPatternUtils(context).isSecure(
UserHandle.myUserId());