Loading core/java/android/service/notification/NotificationListenerFilter.java +3 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.service.notification; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_ALERTING; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_CONVERSATIONS; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_ONGOING; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_SILENT; import android.os.Parcel; Loading @@ -35,7 +36,8 @@ public class NotificationListenerFilter implements Parcelable { public NotificationListenerFilter() { mAllowedNotificationTypes = FLAG_FILTER_TYPE_CONVERSATIONS | FLAG_FILTER_TYPE_ALERTING | FLAG_FILTER_TYPE_SILENT; | FLAG_FILTER_TYPE_SILENT | FLAG_FILTER_TYPE_ONGOING; mDisallowedPackages = new ArraySet<>(); } Loading core/java/android/service/notification/NotificationListenerService.java +16 −0 Original line number Diff line number Diff line Loading @@ -241,6 +241,16 @@ public abstract class NotificationListenerService extends Service { }) public @interface NotificationCancelReason{}; /** * @hide */ @IntDef(flag = true, prefix = { "FLAG_FILTER_TYPE_" }, value = { FLAG_FILTER_TYPE_CONVERSATIONS, FLAG_FILTER_TYPE_ALERTING, FLAG_FILTER_TYPE_SILENT, FLAG_FILTER_TYPE_ONGOING }) public @interface NotificationFilterTypes {} /** * A flag value indicating that this notification listener can see conversation type * notifications. Loading @@ -257,6 +267,12 @@ public abstract class NotificationListenerService extends Service { * @hide */ public static final int FLAG_FILTER_TYPE_SILENT = 4; /** * A flag value indicating that this notification listener can see important * ( > {@link NotificationManager#IMPORTANCE_MIN}) ongoing type notifications. * @hide */ public static final int FLAG_FILTER_TYPE_ONGOING = 8; /** * The full trim of the StatusBarNotification including all its features. Loading services/core/java/com/android/server/notification/NotificationManagerService.java +3 −2 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ import static android.os.UserHandle.USER_NULL; import static android.os.UserHandle.USER_SYSTEM; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_ALERTING; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_CONVERSATIONS; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_ONGOING; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_SILENT; import static android.service.notification.NotificationListenerService.HINT_HOST_DISABLE_CALL_EFFECTS; import static android.service.notification.NotificationListenerService.HINT_HOST_DISABLE_EFFECTS; Loading Loading @@ -9497,7 +9498,7 @@ public class NotificationManagerService extends SystemService { public class NotificationListeners extends ManagedServices { static final String TAG_ENABLED_NOTIFICATION_LISTENERS = "enabled_listeners"; static final String TAG_REQUESTED_LISTENERS = "requested_listeners"; static final String TAG_REQUESTED_LISTENERS = "req_listeners"; static final String TAG_REQUESTED_LISTENER = "listener"; static final String ATT_COMPONENT = "component"; static final String ATT_TYPES = "types"; Loading Loading @@ -9686,7 +9687,7 @@ public class NotificationManagerService extends SystemService { final ComponentName cn = ComponentName.unflattenFromString( XmlUtils.readStringAttribute(parser, ATT_COMPONENT)); int approved = FLAG_FILTER_TYPE_CONVERSATIONS | FLAG_FILTER_TYPE_ALERTING | FLAG_FILTER_TYPE_SILENT; | FLAG_FILTER_TYPE_SILENT | FLAG_FILTER_TYPE_ONGOING; ArraySet<String> disallowedPkgs = new ArraySet<>(); final int listenerOuterDepth = parser.getDepth(); Loading services/tests/uiservicestests/src/com/android/server/notification/NotificationListenersTest.java +5 −5 Original line number Diff line number Diff line Loading @@ -80,7 +80,7 @@ public class NotificationListenersTest extends UiServiceTestCase { @Test public void testReadExtraTag() throws Exception { String xml = "<requested_listeners>" String xml = "<req_listeners>" + "<listener component=\"" + mCn1.flattenToString() + "\" user=\"0\">" + "<allowed types=\"7\" />" + "<disallowed pkgs=\"\" />" Loading @@ -89,13 +89,13 @@ public class NotificationListenersTest extends UiServiceTestCase { + "<allowed types=\"4\" />" + "<disallowed pkgs=\"something\" />" + "</listener>" + "</requested_listeners>"; + "</req_listeners>"; TypedXmlPullParser parser = Xml.newFastPullParser(); parser.setInput(new BufferedInputStream( new ByteArrayInputStream(xml.getBytes())), null); parser.nextTag(); mListeners.readExtraTag("requested_listeners", parser); mListeners.readExtraTag("req_listeners", parser); validateListenersFromXml(); } Loading @@ -120,7 +120,7 @@ public class NotificationListenersTest extends UiServiceTestCase { parser.setInput(new BufferedInputStream( new ByteArrayInputStream(baos.toByteArray())), null); parser.nextTag(); mListeners.readExtraTag("requested_listeners", parser); mListeners.readExtraTag("req_listeners", parser); validateListenersFromXml(); } Loading Loading @@ -192,7 +192,7 @@ public class NotificationListenersTest extends UiServiceTestCase { assertThat(mListeners.getNotificationListenerFilter( Pair.create(si.getComponentName(), 0)).getTypes()) .isEqualTo(7); .isEqualTo(15); assertThat(mListeners.getNotificationListenerFilter(Pair.create(si.getComponentName(), 0)) .getDisallowedPackages()) .isEmpty(); Loading Loading
core/java/android/service/notification/NotificationListenerFilter.java +3 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.service.notification; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_ALERTING; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_CONVERSATIONS; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_ONGOING; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_SILENT; import android.os.Parcel; Loading @@ -35,7 +36,8 @@ public class NotificationListenerFilter implements Parcelable { public NotificationListenerFilter() { mAllowedNotificationTypes = FLAG_FILTER_TYPE_CONVERSATIONS | FLAG_FILTER_TYPE_ALERTING | FLAG_FILTER_TYPE_SILENT; | FLAG_FILTER_TYPE_SILENT | FLAG_FILTER_TYPE_ONGOING; mDisallowedPackages = new ArraySet<>(); } Loading
core/java/android/service/notification/NotificationListenerService.java +16 −0 Original line number Diff line number Diff line Loading @@ -241,6 +241,16 @@ public abstract class NotificationListenerService extends Service { }) public @interface NotificationCancelReason{}; /** * @hide */ @IntDef(flag = true, prefix = { "FLAG_FILTER_TYPE_" }, value = { FLAG_FILTER_TYPE_CONVERSATIONS, FLAG_FILTER_TYPE_ALERTING, FLAG_FILTER_TYPE_SILENT, FLAG_FILTER_TYPE_ONGOING }) public @interface NotificationFilterTypes {} /** * A flag value indicating that this notification listener can see conversation type * notifications. Loading @@ -257,6 +267,12 @@ public abstract class NotificationListenerService extends Service { * @hide */ public static final int FLAG_FILTER_TYPE_SILENT = 4; /** * A flag value indicating that this notification listener can see important * ( > {@link NotificationManager#IMPORTANCE_MIN}) ongoing type notifications. * @hide */ public static final int FLAG_FILTER_TYPE_ONGOING = 8; /** * The full trim of the StatusBarNotification including all its features. Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +3 −2 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ import static android.os.UserHandle.USER_NULL; import static android.os.UserHandle.USER_SYSTEM; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_ALERTING; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_CONVERSATIONS; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_ONGOING; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_SILENT; import static android.service.notification.NotificationListenerService.HINT_HOST_DISABLE_CALL_EFFECTS; import static android.service.notification.NotificationListenerService.HINT_HOST_DISABLE_EFFECTS; Loading Loading @@ -9497,7 +9498,7 @@ public class NotificationManagerService extends SystemService { public class NotificationListeners extends ManagedServices { static final String TAG_ENABLED_NOTIFICATION_LISTENERS = "enabled_listeners"; static final String TAG_REQUESTED_LISTENERS = "requested_listeners"; static final String TAG_REQUESTED_LISTENERS = "req_listeners"; static final String TAG_REQUESTED_LISTENER = "listener"; static final String ATT_COMPONENT = "component"; static final String ATT_TYPES = "types"; Loading Loading @@ -9686,7 +9687,7 @@ public class NotificationManagerService extends SystemService { final ComponentName cn = ComponentName.unflattenFromString( XmlUtils.readStringAttribute(parser, ATT_COMPONENT)); int approved = FLAG_FILTER_TYPE_CONVERSATIONS | FLAG_FILTER_TYPE_ALERTING | FLAG_FILTER_TYPE_SILENT; | FLAG_FILTER_TYPE_SILENT | FLAG_FILTER_TYPE_ONGOING; ArraySet<String> disallowedPkgs = new ArraySet<>(); final int listenerOuterDepth = parser.getDepth(); Loading
services/tests/uiservicestests/src/com/android/server/notification/NotificationListenersTest.java +5 −5 Original line number Diff line number Diff line Loading @@ -80,7 +80,7 @@ public class NotificationListenersTest extends UiServiceTestCase { @Test public void testReadExtraTag() throws Exception { String xml = "<requested_listeners>" String xml = "<req_listeners>" + "<listener component=\"" + mCn1.flattenToString() + "\" user=\"0\">" + "<allowed types=\"7\" />" + "<disallowed pkgs=\"\" />" Loading @@ -89,13 +89,13 @@ public class NotificationListenersTest extends UiServiceTestCase { + "<allowed types=\"4\" />" + "<disallowed pkgs=\"something\" />" + "</listener>" + "</requested_listeners>"; + "</req_listeners>"; TypedXmlPullParser parser = Xml.newFastPullParser(); parser.setInput(new BufferedInputStream( new ByteArrayInputStream(xml.getBytes())), null); parser.nextTag(); mListeners.readExtraTag("requested_listeners", parser); mListeners.readExtraTag("req_listeners", parser); validateListenersFromXml(); } Loading @@ -120,7 +120,7 @@ public class NotificationListenersTest extends UiServiceTestCase { parser.setInput(new BufferedInputStream( new ByteArrayInputStream(baos.toByteArray())), null); parser.nextTag(); mListeners.readExtraTag("requested_listeners", parser); mListeners.readExtraTag("req_listeners", parser); validateListenersFromXml(); } Loading Loading @@ -192,7 +192,7 @@ public class NotificationListenersTest extends UiServiceTestCase { assertThat(mListeners.getNotificationListenerFilter( Pair.create(si.getComponentName(), 0)).getTypes()) .isEqualTo(7); .isEqualTo(15); assertThat(mListeners.getNotificationListenerFilter(Pair.create(si.getComponentName(), 0)) .getDisallowedPackages()) .isEmpty(); Loading