Clear deprecated effects when saving zen policy

- Deprecated effects are set in NotificationManagerService,
so unset them before setting the NotificationPolicy
- When user clicks on Custom, they are brought to the custom vis effects
page instead of resetting custom values to presets

Fixes: 79383781
Test: manual
Test: NotificationManagerServiceTest testSetNotificationPolicy_preP_setOldNewFields
Change-Id: Id6db9ce2aaeed6321389f8dbfbea65eda30c74ad
This commit is contained in:
Beverly
2018-05-10 13:28:00 -04:00
parent 200da8978f
commit 3403c3729e
4 changed files with 25 additions and 29 deletions

View File

@@ -18,6 +18,7 @@ package com.android.settings.notification;
import android.app.NotificationManager.Policy;
import android.content.Context;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
@@ -57,15 +58,12 @@ public class ZenModeVisEffectsCustomPreferenceController
pref.setChecked(areCustomOptionsSelected());
pref.setOnGearClickListener(p -> {
new SubSettingLauncher(mContext)
.setDestination(ZenModeBlockedEffectsSettings.class.getName())
.setTitleRes(R.string.zen_mode_what_to_block_title)
.setSourceMetricsCategory(MetricsProto.MetricsEvent.SETTINGS_ZEN_NOTIFICATIONS)
.launch();
launchCustomSettings();
});
pref.setOnRadioButtonClickListener(p -> {
select();
launchCustomSettings();
});
}
@@ -84,9 +82,14 @@ public class ZenModeVisEffectsCustomPreferenceController
protected void select() {
mMetricsFeatureProvider.action(mContext,
MetricsProto.MetricsEvent.ACTION_ZEN_CUSTOM, true);
mBackend.savePolicy(mBackend.mPolicy.priorityCategories,
mBackend.mPolicy.priorityCallSenders,
mBackend.mPolicy.priorityMessageSenders,
INTERRUPTIVE_EFFECTS);
}
private void launchCustomSettings() {
select();
new SubSettingLauncher(mContext)
.setDestination(ZenModeBlockedEffectsSettings.class.getName())
.setTitleRes(R.string.zen_mode_what_to_block_title)
.setSourceMetricsCategory(MetricsProto.MetricsEvent.SETTINGS_ZEN_NOTIFICATIONS)
.launch();
}
}