From 8da8951b4bcdaeb152689326e48bb8632f12ce3f Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Wed, 19 Apr 2017 11:43:30 -0400 Subject: [PATCH] 'Allow sound' = let the app decide Bug: 37479730 Test: manual Change-Id: Ia5073dd0ef79664229c5aff0b89e7ef36edb68ee --- .../settings/notification/AppNotificationSettings.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/notification/AppNotificationSettings.java b/src/com/android/settings/notification/AppNotificationSettings.java index bcf9c3f879c..db5cf2fb07c 100644 --- a/src/com/android/settings/notification/AppNotificationSettings.java +++ b/src/com/android/settings/notification/AppNotificationSettings.java @@ -19,6 +19,7 @@ package com.android.settings.notification; import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import static android.app.NotificationManager.IMPORTANCE_LOW; import static android.app.NotificationManager.IMPORTANCE_NONE; +import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED; import android.app.Activity; import android.app.NotificationChannel; @@ -251,12 +252,14 @@ public class AppNotificationSettings extends NotificationSettingsBase { private void setupImportanceToggle() { mImportanceToggle.setDisabledByAdmin(mSuspendedAppsAdmin); - mImportanceToggle.setChecked(mChannel.getImportance() >= IMPORTANCE_DEFAULT); + mImportanceToggle.setChecked(mChannel.getImportance() >= IMPORTANCE_DEFAULT + || mChannel.getImportance() == IMPORTANCE_UNSPECIFIED); mImportanceToggle.setOnPreferenceChangeListener( new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { - final int importance = ((Boolean) newValue ? IMPORTANCE_DEFAULT : IMPORTANCE_LOW); + final int importance = + ((Boolean) newValue ? IMPORTANCE_UNSPECIFIED : IMPORTANCE_LOW); mChannel.setImportance(importance); mChannel.lockFields(NotificationChannel.USER_LOCKED_IMPORTANCE); mBackend.updateChannel(mPkg, mUid, mChannel);