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:
@@ -16,6 +16,9 @@
|
||||
|
||||
package com.android.settings.notification;
|
||||
|
||||
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_SCREEN_OFF;
|
||||
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_SCREEN_ON;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.AutomaticZenRule;
|
||||
import android.app.NotificationManager;
|
||||
@@ -146,19 +149,24 @@ public class ZenModeBackend {
|
||||
protected void savePolicy(int priorityCategories, int priorityCallSenders,
|
||||
int priorityMessageSenders, int suppressedVisualEffects) {
|
||||
mPolicy = new NotificationManager.Policy(priorityCategories, priorityCallSenders,
|
||||
priorityMessageSenders,
|
||||
suppressedVisualEffects);
|
||||
priorityMessageSenders, suppressedVisualEffects);
|
||||
mNotificationManager.setNotificationPolicy(mPolicy);
|
||||
}
|
||||
|
||||
protected int getNewSuppressedEffects(boolean suppress, int effectType) {
|
||||
private int getNewSuppressedEffects(boolean suppress, int effectType) {
|
||||
int effects = mPolicy.suppressedVisualEffects;
|
||||
|
||||
if (suppress) {
|
||||
effects |= effectType;
|
||||
} else {
|
||||
effects &= ~effectType;
|
||||
}
|
||||
return effects;
|
||||
|
||||
return clearDeprecatedEffects(effects);
|
||||
}
|
||||
|
||||
private int clearDeprecatedEffects(int effects) {
|
||||
return effects & ~(SUPPRESSED_EFFECT_SCREEN_ON | SUPPRESSED_EFFECT_SCREEN_OFF);
|
||||
}
|
||||
|
||||
protected boolean isEffectAllowed(int effect) {
|
||||
|
Reference in New Issue
Block a user