Loading src/com/android/settings/notification/ZenModeBackend.java +12 −4 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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) { Loading src/com/android/settings/notification/ZenModeRestrictNotificationsSettings.java +0 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,6 @@ public class ZenModeRestrictNotificationsSettings extends ZenModeSettingsBase im custom.displayPreference(getPreferenceScreen()); if (mShowMenuSelected) { custom.select(); metrics.action(mContext, ACTION_ZEN_SHOW_CUSTOM, true); } else { metrics.action(mContext, ACTION_ZEN_SHOW_CUSTOM, false); Loading src/com/android/settings/notification/ZenModeVisEffectsCustomPreferenceController.java +11 −11 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.settings.notification; import android.app.NotificationManager.Policy; import android.content.Context; import android.support.v7.preference.Preference; import android.support.v7.preference.PreferenceScreen; import com.android.internal.logging.nano.MetricsProto; import com.android.settings.R; Loading Loading @@ -57,15 +56,11 @@ public class ZenModeVisEffectsCustomPreferenceController pref.setChecked(areCustomOptionsSelected()); pref.setOnGearClickListener(p -> { new SubSettingLauncher(mContext) .setDestination(ZenModeBlockedEffectsSettings.class.getName()) .setTitle(R.string.zen_mode_what_to_block_title) .setSourceMetricsCategory(MetricsProto.MetricsEvent.SETTINGS_ZEN_NOTIFICATIONS) .launch(); launchCustomSettings(); }); pref.setOnRadioButtonClickListener(p -> { select(); launchCustomSettings(); }); } Loading @@ -84,9 +79,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()) .setTitle(R.string.zen_mode_what_to_block_title) .setSourceMetricsCategory(MetricsProto.MetricsEvent.SETTINGS_ZEN_NOTIFICATIONS) .launch(); } } No newline at end of file tests/robotests/src/com/android/settings/notification/ZenModeVisEffectsCustomPreferenceControllerTest.java +0 −14 Original line number Diff line number Diff line Loading @@ -150,18 +150,4 @@ public class ZenModeVisEffectsCustomPreferenceControllerTest { verify(mockPref).setOnGearClickListener(any()); verify(mockPref).setOnRadioButtonClickListener(any()); } @Test public void select() { int interruptiveSuppressed = SUPPRESSED_EFFECT_FULL_SCREEN_INTENT | SUPPRESSED_EFFECT_AMBIENT | SUPPRESSED_EFFECT_LIGHTS | SUPPRESSED_EFFECT_PEEK; mBackend.mPolicy = new NotificationManager.Policy(0, 0, 0, 1); mController.select(); verify(mBackend).savePolicy(anyInt(), anyInt(), anyInt(), eq(interruptiveSuppressed)); verify(mFeatureFactory.metricsFeatureProvider).action(eq(mContext), eq(ACTION_ZEN_CUSTOM), eq(true)); } } Loading
src/com/android/settings/notification/ZenModeBackend.java +12 −4 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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) { Loading
src/com/android/settings/notification/ZenModeRestrictNotificationsSettings.java +0 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,6 @@ public class ZenModeRestrictNotificationsSettings extends ZenModeSettingsBase im custom.displayPreference(getPreferenceScreen()); if (mShowMenuSelected) { custom.select(); metrics.action(mContext, ACTION_ZEN_SHOW_CUSTOM, true); } else { metrics.action(mContext, ACTION_ZEN_SHOW_CUSTOM, false); Loading
src/com/android/settings/notification/ZenModeVisEffectsCustomPreferenceController.java +11 −11 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.settings.notification; import android.app.NotificationManager.Policy; import android.content.Context; import android.support.v7.preference.Preference; import android.support.v7.preference.PreferenceScreen; import com.android.internal.logging.nano.MetricsProto; import com.android.settings.R; Loading Loading @@ -57,15 +56,11 @@ public class ZenModeVisEffectsCustomPreferenceController pref.setChecked(areCustomOptionsSelected()); pref.setOnGearClickListener(p -> { new SubSettingLauncher(mContext) .setDestination(ZenModeBlockedEffectsSettings.class.getName()) .setTitle(R.string.zen_mode_what_to_block_title) .setSourceMetricsCategory(MetricsProto.MetricsEvent.SETTINGS_ZEN_NOTIFICATIONS) .launch(); launchCustomSettings(); }); pref.setOnRadioButtonClickListener(p -> { select(); launchCustomSettings(); }); } Loading @@ -84,9 +79,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()) .setTitle(R.string.zen_mode_what_to_block_title) .setSourceMetricsCategory(MetricsProto.MetricsEvent.SETTINGS_ZEN_NOTIFICATIONS) .launch(); } } No newline at end of file
tests/robotests/src/com/android/settings/notification/ZenModeVisEffectsCustomPreferenceControllerTest.java +0 −14 Original line number Diff line number Diff line Loading @@ -150,18 +150,4 @@ public class ZenModeVisEffectsCustomPreferenceControllerTest { verify(mockPref).setOnGearClickListener(any()); verify(mockPref).setOnRadioButtonClickListener(any()); } @Test public void select() { int interruptiveSuppressed = SUPPRESSED_EFFECT_FULL_SCREEN_INTENT | SUPPRESSED_EFFECT_AMBIENT | SUPPRESSED_EFFECT_LIGHTS | SUPPRESSED_EFFECT_PEEK; mBackend.mPolicy = new NotificationManager.Policy(0, 0, 0, 1); mController.select(); verify(mBackend).savePolicy(anyInt(), anyInt(), anyInt(), eq(interruptiveSuppressed)); verify(mFeatureFactory.metricsFeatureProvider).action(eq(mContext), eq(ACTION_ZEN_CUSTOM), eq(true)); } }