summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2015-02-12 23:25:12 -0500
committerJohn Spurlock <jspurlock@google.com>2015-02-13 09:27:15 -0500
commit831041036587efbceb395bface176752a6b560bc (patch)
tree10b0e62c2f9a62c4fd3edad4148488a6d9d040b0 /core
parentad680d46be19cbee16d42cbed4d2ed250648ac0b (diff)
downloadframeworks_base-831041036587efbceb395bface176752a6b560bc.zip
frameworks_base-831041036587efbceb395bface176752a6b560bc.tar.gz
frameworks_base-831041036587efbceb395bface176752a6b560bc.tar.bz2
NLS: Add a public signal value for an undefined filter value.
We have three possible defined values for getInterruptionFilter(). i.e. All/Priority/None. However, this value is only returned to listeners once connected, otherwise we return 0, an undefined value. This change gives a name to this undefined value to make it clear that callers should not infer any meaning from it. INTERRUPTION_FILTER_UNKNOWN = 0; Bug: 19288429 Change-Id: I8ae94d1723289ca5714800906f9bf4e7e8111813
Diffstat (limited to 'core')
-rw-r--r--core/java/android/service/notification/NotificationListenerService.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java
index 3d39b18..0860153 100644
--- a/core/java/android/service/notification/NotificationListenerService.java
+++ b/core/java/android/service/notification/NotificationListenerService.java
@@ -77,6 +77,14 @@ public abstract class NotificationListenerService extends Service {
*/
public static final int INTERRUPTION_FILTER_NONE = 3;
+ /** {@link #getCurrentInterruptionFilter() Interruption filter} constant - returned when
+ * the value is unavailable for any reason. For example, before the notification listener
+ * is connected.
+ *
+ * {@see #onListenerConnected()}
+ */
+ public static final int INTERRUPTION_FILTER_UNKNOWN = 0;
+
/** {@link #getCurrentListenerHints() Listener hints} constant - the primary device UI
* should disable notification sound, vibrating and other visual or aural effects.
* This does not change the interruption filter, only the effects. **/
@@ -473,15 +481,16 @@ public abstract class NotificationListenerService extends Service {
* <p>
* Listen for updates using {@link #onInterruptionFilterChanged(int)}.
*
- * @return One of the INTERRUPTION_FILTER_ constants, or 0 on errors.
+ * @return One of the INTERRUPTION_FILTER_ constants, or INTERRUPTION_FILTER_UNKNOWN when
+ * unavailable.
*/
public final int getCurrentInterruptionFilter() {
- if (!isBound()) return 0;
+ if (!isBound()) return INTERRUPTION_FILTER_UNKNOWN;
try {
return getNotificationInterface().getInterruptionFilterFromListener(mWrapper);
} catch (android.os.RemoteException ex) {
Log.v(TAG, "Unable to contact notification manager", ex);
- return 0;
+ return INTERRUPTION_FILTER_UNKNOWN;
}
}