diff options
12 files changed, 93 insertions, 108 deletions
diff --git a/api/current.txt b/api/current.txt index 5c0628c40d64..6406f57fe577 100644 --- a/api/current.txt +++ b/api/current.txt @@ -5259,10 +5259,8 @@ package android.app { field public static final int PRIORITY_SENDERS_ANY = 0; // 0x0 field public static final int PRIORITY_SENDERS_CONTACTS = 1; // 0x1 field public static final int PRIORITY_SENDERS_STARRED = 2; // 0x2 - field public static final int SUPPRESSED_EFFECTS_UNSET = -1; // 0xffffffff - field public static final int SUPPRESSED_EFFECT_LIGHTS = 1; // 0x1 - field public static final int SUPPRESSED_EFFECT_PEEK = 2; // 0x2 - field public static final int SUPPRESSED_EFFECT_SCREEN_ON = 4; // 0x4 + field public static final int SUPPRESSED_EFFECT_SCREEN_OFF = 1; // 0x1 + field public static final int SUPPRESSED_EFFECT_SCREEN_ON = 2; // 0x2 field public final int priorityCallSenders; field public final int priorityCategories; field public final int priorityMessageSenders; @@ -34457,9 +34455,8 @@ package android.service.notification { field public static final int INTERRUPTION_FILTER_PRIORITY = 2; // 0x2 field public static final int INTERRUPTION_FILTER_UNKNOWN = 0; // 0x0 field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.NotificationListenerService"; - field public static final int SUPPRESSED_EFFECT_LIGHTS = 1; // 0x1 - field public static final int SUPPRESSED_EFFECT_PEEK = 2; // 0x2 - field public static final int SUPPRESSED_EFFECT_SCREEN_ON = 4; // 0x4 + field public static final int SUPPRESSED_EFFECT_SCREEN_OFF = 1; // 0x1 + field public static final int SUPPRESSED_EFFECT_SCREEN_ON = 2; // 0x2 } public static class NotificationListenerService.Ranking { diff --git a/api/system-current.txt b/api/system-current.txt index 2adb1e61afdf..ed094f9c9691 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -5392,10 +5392,8 @@ package android.app { field public static final int PRIORITY_SENDERS_ANY = 0; // 0x0 field public static final int PRIORITY_SENDERS_CONTACTS = 1; // 0x1 field public static final int PRIORITY_SENDERS_STARRED = 2; // 0x2 - field public static final int SUPPRESSED_EFFECTS_UNSET = -1; // 0xffffffff - field public static final int SUPPRESSED_EFFECT_LIGHTS = 1; // 0x1 - field public static final int SUPPRESSED_EFFECT_PEEK = 2; // 0x2 - field public static final int SUPPRESSED_EFFECT_SCREEN_ON = 4; // 0x4 + field public static final int SUPPRESSED_EFFECT_SCREEN_OFF = 1; // 0x1 + field public static final int SUPPRESSED_EFFECT_SCREEN_ON = 2; // 0x2 field public final int priorityCallSenders; field public final int priorityCategories; field public final int priorityMessageSenders; @@ -36904,9 +36902,8 @@ package android.service.notification { field public static final int INTERRUPTION_FILTER_PRIORITY = 2; // 0x2 field public static final int INTERRUPTION_FILTER_UNKNOWN = 0; // 0x0 field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.NotificationListenerService"; - field public static final int SUPPRESSED_EFFECT_LIGHTS = 1; // 0x1 - field public static final int SUPPRESSED_EFFECT_PEEK = 2; // 0x2 - field public static final int SUPPRESSED_EFFECT_SCREEN_ON = 4; // 0x4 + field public static final int SUPPRESSED_EFFECT_SCREEN_OFF = 1; // 0x1 + field public static final int SUPPRESSED_EFFECT_SCREEN_ON = 2; // 0x2 field public static final int TRIM_FULL = 0; // 0x0 field public static final int TRIM_LIGHT = 1; // 0x1 } diff --git a/api/test-current.txt b/api/test-current.txt index 7abc6d43cd90..417107d30a6b 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -5259,10 +5259,8 @@ package android.app { field public static final int PRIORITY_SENDERS_ANY = 0; // 0x0 field public static final int PRIORITY_SENDERS_CONTACTS = 1; // 0x1 field public static final int PRIORITY_SENDERS_STARRED = 2; // 0x2 - field public static final int SUPPRESSED_EFFECTS_UNSET = -1; // 0xffffffff - field public static final int SUPPRESSED_EFFECT_LIGHTS = 1; // 0x1 - field public static final int SUPPRESSED_EFFECT_PEEK = 2; // 0x2 - field public static final int SUPPRESSED_EFFECT_SCREEN_ON = 4; // 0x4 + field public static final int SUPPRESSED_EFFECT_SCREEN_OFF = 1; // 0x1 + field public static final int SUPPRESSED_EFFECT_SCREEN_ON = 2; // 0x2 field public final int priorityCallSenders; field public final int priorityCategories; field public final int priorityMessageSenders; @@ -34472,9 +34470,8 @@ package android.service.notification { field public static final int INTERRUPTION_FILTER_PRIORITY = 2; // 0x2 field public static final int INTERRUPTION_FILTER_UNKNOWN = 0; // 0x0 field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.NotificationListenerService"; - field public static final int SUPPRESSED_EFFECT_LIGHTS = 1; // 0x1 - field public static final int SUPPRESSED_EFFECT_PEEK = 2; // 0x2 - field public static final int SUPPRESSED_EFFECT_SCREEN_ON = 4; // 0x4 + field public static final int SUPPRESSED_EFFECT_SCREEN_OFF = 1; // 0x1 + field public static final int SUPPRESSED_EFFECT_SCREEN_ON = 2; // 0x2 } public static class NotificationListenerService.Ranking { diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java index faf5b11951a6..a83225d961b0 100644 --- a/core/java/android/app/NotificationManager.java +++ b/core/java/android/app/NotificationManager.java @@ -646,14 +646,23 @@ public class NotificationManager * PRIORITY_SENDERS_ANY, PRIORITY_SENDERS_CONTACTS, PRIORITY_SENDERS_STARRED */ public final int priorityMessageSenders; + /** + * @hide + */ public static final int SUPPRESSED_EFFECTS_UNSET = -1; - public static final int SUPPRESSED_EFFECT_LIGHTS = 1 << 0; - public static final int SUPPRESSED_EFFECT_PEEK = 1 << 1; - public static final int SUPPRESSED_EFFECT_SCREEN_ON = 1 << 2; + /** + * Whether notification suppressed by DND should not interruption visually when the screen + * is off. + */ + public static final int SUPPRESSED_EFFECT_SCREEN_OFF = 1 << 0; + /** + * Whether notification suppressed by DND should not interruption visually when the screen + * is on. + */ + public static final int SUPPRESSED_EFFECT_SCREEN_ON = 1 << 1; private static final int[] ALL_SUPPRESSED_EFFECTS = { - SUPPRESSED_EFFECT_LIGHTS, - SUPPRESSED_EFFECT_PEEK, + SUPPRESSED_EFFECT_SCREEN_OFF, SUPPRESSED_EFFECT_SCREEN_ON, }; @@ -762,8 +771,7 @@ public class NotificationManager private static String effectToString(int effect) { switch (effect) { - case SUPPRESSED_EFFECT_LIGHTS: return "SUPPRESSED_EFFECT_LIGHTS"; - case SUPPRESSED_EFFECT_PEEK: return "SUPPRESSED_EFFECT_PEEK"; + case SUPPRESSED_EFFECT_SCREEN_OFF: return "SUPPRESSED_EFFECT_SCREEN_OFF"; case SUPPRESSED_EFFECT_SCREEN_ON: return "SUPPRESSED_EFFECT_SCREEN_ON"; case SUPPRESSED_EFFECTS_UNSET: return "SUPPRESSED_EFFECTS_UNSET"; default: return "UNKNOWN_" + effect; diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java index 7ff883e1d127..7b461b17329c 100644 --- a/core/java/android/service/notification/NotificationListenerService.java +++ b/core/java/android/service/notification/NotificationListenerService.java @@ -119,10 +119,16 @@ public abstract class NotificationListenerService extends Service { * This does not change the interruption filter, only the effects. **/ public static final int HINT_HOST_DISABLE_EFFECTS = 1; - public static final int SUPPRESSED_EFFECT_LIGHTS = - NotificationManager.Policy.SUPPRESSED_EFFECT_LIGHTS; - public static final int SUPPRESSED_EFFECT_PEEK = - NotificationManager.Policy.SUPPRESSED_EFFECT_PEEK; + /** + * Whether notification suppressed by DND should not interruption visually when the screen is + * off. + */ + public static final int SUPPRESSED_EFFECT_SCREEN_OFF = + NotificationManager.Policy.SUPPRESSED_EFFECT_SCREEN_OFF; + /** + * Whether notification suppressed by DND should not interruption visually when the screen is + * on. + */ public static final int SUPPRESSED_EFFECT_SCREEN_ON = NotificationManager.Policy.SUPPRESSED_EFFECT_SCREEN_ON; @@ -993,8 +999,7 @@ public abstract class NotificationListenerService extends Service { /** * Returns the type(s) of visual effects that should be suppressed for this notification. - * See {@link #SUPPRESSED_EFFECT_LIGHTS}, {@link #SUPPRESSED_EFFECT_PEEK}, - * {@link #SUPPRESSED_EFFECT_SCREEN_ON}. + * See {@link #SUPPRESSED_EFFECT_SCREEN_OFF}, {@link #SUPPRESSED_EFFECT_SCREEN_ON}. */ public int getSuppressedVisualEffects() { return mSuppressedVisualEffects; diff --git a/core/java/android/service/notification/ZenModeConfig.java b/core/java/android/service/notification/ZenModeConfig.java index 468884347fc5..63853cb45676 100644 --- a/core/java/android/service/notification/ZenModeConfig.java +++ b/core/java/android/service/notification/ZenModeConfig.java @@ -77,8 +77,7 @@ public class ZenModeConfig implements Parcelable { private static final boolean DEFAULT_ALLOW_REMINDERS = true; private static final boolean DEFAULT_ALLOW_EVENTS = true; private static final boolean DEFAULT_ALLOW_REPEAT_CALLERS = false; - private static final boolean DEFAULT_ALLOW_PEEK = true; - private static final boolean DEFAULT_ALLOW_LIGHTS = true; + private static final boolean DEFAULT_ALLOW_SCREEN_OFF = true; private static final boolean DEFAULT_ALLOW_SCREEN_ON = true; private static final int XML_VERSION = 2; @@ -94,9 +93,8 @@ public class ZenModeConfig implements Parcelable { private static final String ALLOW_ATT_MESSAGES_FROM = "messagesFrom"; private static final String ALLOW_ATT_REMINDERS = "reminders"; private static final String ALLOW_ATT_EVENTS = "events"; - private static final String ALLOW_ATT_PEEK = "peek"; - private static final String ALLOW_ATT_LIGHTS = "lights"; - private static final String ALLOW_ATT_SCREEN_ON = "screen_on"; + private static final String ALLOW_ATT_SCREEN_OFF = "visualScreenOff"; + private static final String ALLOW_ATT_SCREEN_ON = "visualScreenOn"; private static final String CONDITION_TAG = "condition"; private static final String CONDITION_ATT_COMPONENT = "component"; @@ -128,9 +126,8 @@ public class ZenModeConfig implements Parcelable { public int allowCallsFrom = DEFAULT_SOURCE; public int allowMessagesFrom = DEFAULT_SOURCE; public int user = UserHandle.USER_SYSTEM; - public boolean allowPeek = DEFAULT_ALLOW_PEEK; - public boolean allowLights = DEFAULT_ALLOW_LIGHTS; - public boolean allowScreenOn = DEFAULT_ALLOW_SCREEN_ON; + public boolean allowWhenScreenOff = DEFAULT_ALLOW_SCREEN_OFF; + public boolean allowWhenScreenOn = DEFAULT_ALLOW_SCREEN_ON; public ZenRule manualRule; public ArrayMap<String, ZenRule> automaticRules = new ArrayMap<>(); @@ -157,9 +154,8 @@ public class ZenModeConfig implements Parcelable { automaticRules.put(ids[i], rules[i]); } } - allowPeek = source.readInt() == 1; - allowLights = source.readInt() == 1; - allowScreenOn = source.readInt() == 1; + allowWhenScreenOff = source.readInt() == 1; + allowWhenScreenOn = source.readInt() == 1; } @Override @@ -187,9 +183,8 @@ public class ZenModeConfig implements Parcelable { } else { dest.writeInt(0); } - dest.writeInt(allowPeek ? 1 : 0); - dest.writeInt(allowLights ? 1 : 0); - dest.writeInt(allowScreenOn ? 1 : 0); + dest.writeInt(allowWhenScreenOff ? 1 : 0); + dest.writeInt(allowWhenScreenOn ? 1 : 0); } @Override @@ -203,9 +198,8 @@ public class ZenModeConfig implements Parcelable { .append(",allowMessagesFrom=").append(sourceToString(allowMessagesFrom)) .append(",allowReminders=").append(allowReminders) .append(",allowEvents=").append(allowEvents) - .append(",allowPeek=").append(allowPeek) - .append(",allowLights=").append(allowLights) - .append(",allowScreenOn=").append(allowScreenOn) + .append(",allowWhenScreenOff=").append(allowWhenScreenOff) + .append(",allowWhenScreenOn=").append(allowWhenScreenOn) .append(",automaticRules=").append(automaticRules) .append(",manualRule=").append(manualRule) .append(']').toString(); @@ -240,14 +234,11 @@ public class ZenModeConfig implements Parcelable { if (allowEvents != to.allowEvents) { d.addLine("allowEvents", allowEvents, to.allowEvents); } - if (allowPeek != to.allowPeek) { - d.addLine("allowPeek", allowPeek, to.allowPeek); + if (allowWhenScreenOff != to.allowWhenScreenOff) { + d.addLine("allowWhenScreenOff", allowWhenScreenOff, to.allowWhenScreenOff); } - if (allowLights != to.allowLights) { - d.addLine("allowLights", allowLights, to.allowLights); - } - if (allowScreenOn != to.allowScreenOn) { - d.addLine("allowScreenOn", allowScreenOn, to.allowScreenOn); + if (allowWhenScreenOn != to.allowWhenScreenOn) { + d.addLine("allowWhenScreenOn", allowWhenScreenOn, to.allowWhenScreenOn); } final ArraySet<String> allRules = new ArraySet<>(); addKeys(allRules, automaticRules); @@ -346,9 +337,8 @@ public class ZenModeConfig implements Parcelable { && other.allowMessagesFrom == allowMessagesFrom && other.allowReminders == allowReminders && other.allowEvents == allowEvents - && other.allowPeek == allowPeek - && other.allowLights == allowLights - && other.allowScreenOn == allowScreenOn + && other.allowWhenScreenOff == allowWhenScreenOff + && other.allowWhenScreenOn == allowWhenScreenOn && other.user == user && Objects.equals(other.automaticRules, automaticRules) && Objects.equals(other.manualRule, manualRule); @@ -357,8 +347,9 @@ public class ZenModeConfig implements Parcelable { @Override public int hashCode() { return Objects.hash(allowCalls, allowRepeatCallers, allowMessages, allowCallsFrom, - allowMessagesFrom, allowReminders, allowEvents, allowPeek, allowLights, - allowScreenOn, user, automaticRules, manualRule); + allowMessagesFrom, allowReminders, allowEvents, allowWhenScreenOff, + allowWhenScreenOn, + user, automaticRules, manualRule); } private static String toDayList(int[] days) { @@ -443,9 +434,9 @@ public class ZenModeConfig implements Parcelable { rt.allowCallsFrom = DEFAULT_SOURCE; rt.allowMessagesFrom = DEFAULT_SOURCE; } - rt.allowPeek = safeBoolean(parser, ALLOW_ATT_PEEK, DEFAULT_ALLOW_PEEK); - rt.allowLights = safeBoolean(parser, ALLOW_ATT_LIGHTS, DEFAULT_ALLOW_LIGHTS); - rt.allowScreenOn = + rt.allowWhenScreenOff = + safeBoolean(parser, ALLOW_ATT_SCREEN_OFF, DEFAULT_ALLOW_SCREEN_OFF); + rt.allowWhenScreenOn = safeBoolean(parser, ALLOW_ATT_SCREEN_ON, DEFAULT_ALLOW_SCREEN_ON); } else if (MANUAL_TAG.equals(tag)) { rt.manualRule = readRuleXml(parser); @@ -475,9 +466,8 @@ public class ZenModeConfig implements Parcelable { out.attribute(null, ALLOW_ATT_EVENTS, Boolean.toString(allowEvents)); out.attribute(null, ALLOW_ATT_CALLS_FROM, Integer.toString(allowCallsFrom)); out.attribute(null, ALLOW_ATT_MESSAGES_FROM, Integer.toString(allowMessagesFrom)); - out.attribute(null, ALLOW_ATT_PEEK, Boolean.toString(allowPeek)); - out.attribute(null, ALLOW_ATT_LIGHTS, Boolean.toString(allowLights)); - out.attribute(null, ALLOW_ATT_SCREEN_ON, Boolean.toString(allowScreenOn)); + out.attribute(null, ALLOW_ATT_SCREEN_OFF, Boolean.toString(allowWhenScreenOff)); + out.attribute(null, ALLOW_ATT_SCREEN_ON, Boolean.toString(allowWhenScreenOn)); out.endTag(null, ALLOW_TAG); if (manualRule != null) { @@ -650,13 +640,10 @@ public class ZenModeConfig implements Parcelable { priorityCategories |= Policy.PRIORITY_CATEGORY_REPEAT_CALLERS; } int suppressedVisualEffects = 0; - if (!allowPeek) { - suppressedVisualEffects |= Policy.SUPPRESSED_EFFECT_PEEK; - } - if (!allowLights) { - suppressedVisualEffects |= Policy.SUPPRESSED_EFFECT_LIGHTS; + if (!allowWhenScreenOff) { + suppressedVisualEffects |= Policy.SUPPRESSED_EFFECT_SCREEN_OFF; } - if (!allowScreenOn) { + if (!allowWhenScreenOn) { suppressedVisualEffects |= Policy.SUPPRESSED_EFFECT_SCREEN_ON; } priorityCallSenders = sourceToPrioritySenders(allowCallsFrom, priorityCallSenders); @@ -695,9 +682,9 @@ public class ZenModeConfig implements Parcelable { allowMessagesFrom = prioritySendersToSource(policy.priorityMessageSenders, allowMessagesFrom); if (policy.suppressedVisualEffects != Policy.SUPPRESSED_EFFECTS_UNSET) { - allowPeek = (policy.suppressedVisualEffects & Policy.SUPPRESSED_EFFECT_PEEK) == 0; - allowLights = (policy.suppressedVisualEffects & Policy.SUPPRESSED_EFFECT_LIGHTS) == 0; - allowScreenOn = + allowWhenScreenOff = + (policy.suppressedVisualEffects & Policy.SUPPRESSED_EFFECT_SCREEN_OFF) == 0; + allowWhenScreenOn = (policy.suppressedVisualEffects & Policy.SUPPRESSED_EFFECT_SCREEN_ON) == 0; } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 333e4ff30d36..7d37ad22223f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -2097,7 +2097,7 @@ public abstract class BaseStatusBar extends SystemUI implements } - if (mNotificationData.shouldSuppressPeek(sbn.getKey())) { + if (mNotificationData.shouldSuppressScreenOn(sbn.getKey())) { if (DEBUG) Log.d(TAG, "No peeking: suppressed by DND: " + sbn.getKey()); return false; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java index 3cc1ab9b42ef..2cacb8aedd65 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java @@ -283,11 +283,11 @@ public class NotificationData { return Ranking.VISIBILITY_NO_OVERRIDE; } - public boolean shouldSuppressPeek(String key) { + public boolean shouldSuppressScreenOff(String key) { if (mRankingMap != null) { mRankingMap.getRanking(key, mTmpRanking); return (mTmpRanking.getSuppressedVisualEffects() - & NotificationListenerService.SUPPRESSED_EFFECT_PEEK) != 0; + & NotificationListenerService.SUPPRESSED_EFFECT_SCREEN_OFF) != 0; } return false; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 4dee51df131c..09a7bf08ec19 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -1274,7 +1274,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } if (!isHeadsUped && notification.getNotification().fullScreenIntent != null) { - if (shouldSupressFullScreenIntent(notification.getKey())) { + if (shouldSuppressFullScreenIntent(notification.getKey())) { if (DEBUG) { Log.d(TAG, "No Fullscreen intent: suppressed by DND: " + notification.getKey()); } @@ -1301,11 +1301,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, setAreThereNotifications(); } - private boolean shouldSupressFullScreenIntent(String key) { + private boolean shouldSuppressFullScreenIntent(String key) { if (mPowerManager.isInteractive()) { - return mNotificationData.shouldSuppressPeek(key); - } else { return mNotificationData.shouldSuppressScreenOn(key); + } else { + return mNotificationData.shouldSuppressScreenOff(key); } } diff --git a/proto/src/metrics_constants.proto b/proto/src/metrics_constants.proto index e1dd87f55ed4..3327ec4f712f 100644 --- a/proto/src/metrics_constants.proto +++ b/proto/src/metrics_constants.proto @@ -287,13 +287,14 @@ message MetricsEvent { QS_USER_TILE = 260; QS_BATTERY_TILE = 261; NOTIFICATION_ZEN_MODE_VISUAL_INTERRUPTIONS = 262; - ACTION_ZEN_ALLOW_PEEK = 263; + ACTION_ZEN_ALLOW_WHEN_SCREEN_OFF = 263; + // Dead ACTION_ZEN_ALLOW_LIGHTS = 264; NOTIFICATION_TOPIC_NOTIFICATION = 265; ACTION_DEFAULT_SMS_APP_CHANGED = 266; QS_COLOR_MATRIX = 267; QS_CUSTOM = 268; - ACTION_ZEN_ALLOW_SCREEN_ON = 269; + ACTION_ZEN_ALLOW_WHEN_SCREEN_ON = 269; // Logged when the user docks a window from recents by // longpressing a task and dragging it to the dock area. diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index bcb2c598c82d..bf8e8fb4eb47 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -34,8 +34,7 @@ import static android.service.notification.NotificationAssistantService.REASON_P import static android.service.notification.NotificationAssistantService.REASON_TOPIC_BANNED; import static android.service.notification.NotificationAssistantService.REASON_USER_STOPPED; import static android.service.notification.NotificationListenerService.HINT_HOST_DISABLE_EFFECTS; -import static android.service.notification.NotificationListenerService.SUPPRESSED_EFFECT_LIGHTS; -import static android.service.notification.NotificationListenerService.SUPPRESSED_EFFECT_PEEK; +import static android.service.notification.NotificationListenerService.SUPPRESSED_EFFECT_SCREEN_OFF; import static android.service.notification.NotificationListenerService.SUPPRESSED_EFFECT_SCREEN_ON; import static android.service.notification.NotificationListenerService.TRIM_FULL; import static android.service.notification.NotificationListenerService.TRIM_LIGHT; @@ -2679,7 +2678,7 @@ public class NotificationManagerService extends SystemService { boolean wasShowLights = mLights.remove(record.getKey()); if ((notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0 && aboveThreshold && ((record.getSuppressedVisualEffects() - & NotificationListenerService.SUPPRESSED_EFFECT_LIGHTS) == 0)) { + & NotificationListenerService.SUPPRESSED_EFFECT_SCREEN_OFF) == 0)) { mLights.add(record.getKey()); updateLightsLocked(); if (mUseAttentionLight) { @@ -2691,7 +2690,7 @@ public class NotificationManagerService extends SystemService { } if (buzz || beep || blink) { if (((record.getSuppressedVisualEffects() - & NotificationListenerService.SUPPRESSED_EFFECT_SCREEN_ON) != 0)) { + & NotificationListenerService.SUPPRESSED_EFFECT_SCREEN_OFF) != 0)) { if (DBG) Slog.v(TAG, "Suppressed SystemUI from triggering screen on"); } else { EventLogTags.writeNotificationAlert(record.getKey(), @@ -2878,9 +2877,10 @@ public class NotificationManagerService extends SystemService { private void applyZenModeLocked(NotificationRecord record) { record.setIntercepted(mZenModeHelper.shouldIntercept(record)); if (record.isIntercepted()) { - int suppressed = (mZenModeHelper.shouldSuppressLight() ? SUPPRESSED_EFFECT_LIGHTS : 0) - | (mZenModeHelper.shouldSuppressPeek() ? SUPPRESSED_EFFECT_PEEK : 0) - | (mZenModeHelper.shouldSuppressScreenOn() ? SUPPRESSED_EFFECT_SCREEN_ON : 0); + int suppressed = (mZenModeHelper.shouldSuppressWhenScreenOff() + ? SUPPRESSED_EFFECT_SCREEN_OFF : 0) + | (mZenModeHelper.shouldSuppressWhenScreenOn() + ? SUPPRESSED_EFFECT_SCREEN_ON : 0); record.setSuppressedVisualEffects(suppressed); } } diff --git a/services/core/java/com/android/server/notification/ZenModeHelper.java b/services/core/java/com/android/server/notification/ZenModeHelper.java index 7518c6e316f9..bba0d402c90e 100644 --- a/services/core/java/com/android/server/notification/ZenModeHelper.java +++ b/services/core/java/com/android/server/notification/ZenModeHelper.java @@ -35,7 +35,6 @@ import android.content.pm.ServiceInfo; import android.content.res.Resources; import android.content.res.XmlResourceParser; import android.database.ContentObserver; -import android.media.AudioAttributes; import android.media.AudioManager; import android.media.AudioManagerInternal; import android.media.AudioSystem; @@ -150,21 +149,15 @@ public class ZenModeHelper { } } - public boolean shouldSuppressLight() { + public boolean shouldSuppressWhenScreenOff() { synchronized (mConfig) { - return !mConfig.allowLights; + return !mConfig.allowWhenScreenOff; } } - public boolean shouldSuppressPeek() { + public boolean shouldSuppressWhenScreenOn() { synchronized (mConfig) { - return !mConfig.allowPeek; - } - } - - public boolean shouldSuppressScreenOn() { - synchronized (mConfig) { - return !mConfig.allowScreenOn; + return !mConfig.allowWhenScreenOn; } } @@ -503,12 +496,12 @@ public class ZenModeHelper { return; } pw.printf("allow(calls=%s,callsFrom=%s,repeatCallers=%s,messages=%s,messagesFrom=%s," - + "events=%s,reminders=%s,lights=%s,peek=%s,screenOn=%s)\n", + + "events=%s,reminders=%s,whenScreenOff,whenScreenOn=%s)\n", config.allowCalls, ZenModeConfig.sourceToString(config.allowCallsFrom), config.allowRepeatCallers, config.allowMessages, ZenModeConfig.sourceToString(config.allowMessagesFrom), - config.allowEvents, config.allowReminders, config.allowLights, config.allowPeek, - config.allowScreenOn); + config.allowEvents, config.allowReminders, config.allowWhenScreenOff, + config.allowWhenScreenOn); pw.print(prefix); pw.print(" manualRule="); pw.println(config.manualRule); if (config.automaticRules.isEmpty()) return; final int N = config.automaticRules.size(); |