Merge "'Allow sound' = let the app decide" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f9bfab880e
@@ -19,6 +19,7 @@ package com.android.settings.notification;
|
|||||||
import static android.app.NotificationManager.IMPORTANCE_DEFAULT;
|
import static android.app.NotificationManager.IMPORTANCE_DEFAULT;
|
||||||
import static android.app.NotificationManager.IMPORTANCE_LOW;
|
import static android.app.NotificationManager.IMPORTANCE_LOW;
|
||||||
import static android.app.NotificationManager.IMPORTANCE_NONE;
|
import static android.app.NotificationManager.IMPORTANCE_NONE;
|
||||||
|
import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.NotificationChannel;
|
import android.app.NotificationChannel;
|
||||||
@@ -251,12 +252,14 @@ public class AppNotificationSettings extends NotificationSettingsBase {
|
|||||||
|
|
||||||
private void setupImportanceToggle() {
|
private void setupImportanceToggle() {
|
||||||
mImportanceToggle.setDisabledByAdmin(mSuspendedAppsAdmin);
|
mImportanceToggle.setDisabledByAdmin(mSuspendedAppsAdmin);
|
||||||
mImportanceToggle.setChecked(mChannel.getImportance() >= IMPORTANCE_DEFAULT);
|
mImportanceToggle.setChecked(mChannel.getImportance() >= IMPORTANCE_DEFAULT
|
||||||
|
|| mChannel.getImportance() == IMPORTANCE_UNSPECIFIED);
|
||||||
mImportanceToggle.setOnPreferenceChangeListener(
|
mImportanceToggle.setOnPreferenceChangeListener(
|
||||||
new Preference.OnPreferenceChangeListener() {
|
new Preference.OnPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
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.setImportance(importance);
|
||||||
mChannel.lockFields(NotificationChannel.USER_LOCKED_IMPORTANCE);
|
mChannel.lockFields(NotificationChannel.USER_LOCKED_IMPORTANCE);
|
||||||
mBackend.updateChannel(mPkg, mUid, mChannel);
|
mBackend.updateChannel(mPkg, mUid, mChannel);
|
||||||
|
Reference in New Issue
Block a user