diff options
| author | 2018-04-09 08:47:39 -0400 | |
|---|---|---|
| committer | 2018-04-09 08:47:39 -0400 | |
| commit | 47f4280b4fe9dd92474ab1fa7bffec81c609a7cb (patch) | |
| tree | 186b007172f623989075f604e108fe242f77447a | |
| parent | 0a82994f9311c4cd4abc346431deb6a036aa404a (diff) | |
Helper methods for settings screen
Bug: 77657376
Test: make -j RunSettingsRoboTests
Change-Id: I2002cf98f26312e074c40c085044c60f7ce52ff7
| -rw-r--r-- | core/java/android/app/NotificationManager.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java index 46d1264f952d..5113fd0cc368 100644 --- a/core/java/android/app/NotificationManager.java +++ b/core/java/android/app/NotificationManager.java @@ -1145,6 +1145,21 @@ public class NotificationManager { SUPPRESSED_EFFECT_NOTIFICATION_LIST }; + private static final int[] SCREEN_OFF_SUPPRESSED_EFFECTS = { + SUPPRESSED_EFFECT_SCREEN_OFF, + SUPPRESSED_EFFECT_FULL_SCREEN_INTENT, + SUPPRESSED_EFFECT_LIGHTS, + SUPPRESSED_EFFECT_AMBIENT, + }; + + private static final int[] SCREEN_ON_SUPPRESSED_EFFECTS = { + SUPPRESSED_EFFECT_SCREEN_ON, + SUPPRESSED_EFFECT_PEEK, + SUPPRESSED_EFFECT_STATUS_BAR, + SUPPRESSED_EFFECT_BADGE, + SUPPRESSED_EFFECT_NOTIFICATION_LIST + }; + /** * Visual effects to suppress for a notification that is filtered by Do Not Disturb mode. * Bitmask of SUPPRESSED_EFFECT_* constants. @@ -1297,6 +1312,32 @@ public class NotificationManager { return true; } + /** + * @hide + */ + public static boolean areAnyScreenOffEffectsSuppressed(int effects) { + for (int i = 0; i < SCREEN_OFF_SUPPRESSED_EFFECTS.length; i++) { + final int effect = SCREEN_OFF_SUPPRESSED_EFFECTS[i]; + if ((effects & effect) != 0) { + return true; + } + } + return false; + } + + /** + * @hide + */ + public static boolean areAnyScreenOnEffectsSuppressed(int effects) { + for (int i = 0; i < SCREEN_ON_SUPPRESSED_EFFECTS.length; i++) { + final int effect = SCREEN_ON_SUPPRESSED_EFFECTS[i]; + if ((effects & effect) != 0) { + return true; + } + } + return false; + } + public static String suppressedEffectsToString(int effects) { if (effects <= 0) return ""; final StringBuilder sb = new StringBuilder(); |