Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e760f017 authored by Julia Reynolds's avatar Julia Reynolds Committed by android-build-merger
Browse files

Merge "'Allow sound' = let the app decide" into oc-dev am: f9bfab88

am: bcf0c83a

Change-Id: Iedb174e98bae903b663f1f925ccdda0d7d4ca4a3
parents 6a9e1988 bcf0c83a
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -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);