Loading core/api/current.txt +5 −0 Original line number Diff line number Diff line Loading @@ -38076,6 +38076,10 @@ package android.service.notification { method public final void setNotificationsShown(String[]); method public final void snoozeNotification(String, long); method public final void updateNotificationChannel(@NonNull String, @NonNull android.os.UserHandle, @NonNull android.app.NotificationChannel); field public static final int FLAG_FILTER_TYPE_ALERTING = 2; // 0x2 field public static final int FLAG_FILTER_TYPE_CONVERSATIONS = 1; // 0x1 field public static final int FLAG_FILTER_TYPE_ONGOING = 8; // 0x8 field public static final int FLAG_FILTER_TYPE_SILENT = 4; // 0x4 field public static final int HINT_HOST_DISABLE_CALL_EFFECTS = 4; // 0x4 field public static final int HINT_HOST_DISABLE_EFFECTS = 1; // 0x1 field public static final int HINT_HOST_DISABLE_NOTIFICATION_EFFECTS = 2; // 0x2 Loading @@ -38084,6 +38088,7 @@ package android.service.notification { field public static final int INTERRUPTION_FILTER_NONE = 3; // 0x3 field public static final int INTERRUPTION_FILTER_PRIORITY = 2; // 0x2 field public static final int INTERRUPTION_FILTER_UNKNOWN = 0; // 0x0 field public static final String META_DATA_DEFAULT_FILTER_TYPES = "android.service.notification.default_filter_types"; field public static final int NOTIFICATION_CHANNEL_OR_GROUP_ADDED = 1; // 0x1 field public static final int NOTIFICATION_CHANNEL_OR_GROUP_DELETED = 3; // 0x3 field public static final int NOTIFICATION_CHANNEL_OR_GROUP_UPDATED = 2; // 0x2 core/java/android/service/notification/NotificationListenerFilter.java +1 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.util.ArraySet; */ public class NotificationListenerFilter implements Parcelable { private int mAllowedNotificationTypes; // VersionedPackage is holding the pkg name and pkg uid private ArraySet<VersionedPackage> mDisallowedPackages; public NotificationListenerFilter() { Loading core/java/android/service/notification/NotificationListenerService.java +19 −4 Original line number Diff line number Diff line Loading @@ -80,6 +80,10 @@ import java.util.Objects; * <intent-filter> * <action android:name="android.service.notification.NotificationListenerService" /> * </intent-filter> * <meta-data * android:name="android.service.notification.default_filter_types" * android:value="1,2"> * </meta-data> * </service></pre> * * <p>The service should wait for the {@link #onListenerConnected()} event Loading @@ -102,6 +106,21 @@ public abstract class NotificationListenerService extends Service { @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) private final String TAG = getClass().getSimpleName(); /** * The name of the {@code meta-data} tag containing a comma separated list of default * integer notification types that should be provided to this listener. See * {@link #FLAG_FILTER_TYPE_ONGOING}, * {@link #FLAG_FILTER_TYPE_CONVERSATIONS}, {@link #FLAG_FILTER_TYPE_ALERTING), * and {@link #FLAG_FILTER_TYPE_SILENT}. * <p>This value will only be read if the app has not previously specified a default type list, * and if the user has not overridden the allowed types.</p> * <p>An absent value means 'allow all types'. * A present but empty value means 'allow no types'.</p> * */ public static final String META_DATA_DEFAULT_FILTER_TYPES = "android.service.notification.default_filter_types"; /** * {@link #getCurrentInterruptionFilter() Interruption filter} constant - * Normal interruption filter. Loading Loading @@ -254,23 +273,19 @@ public abstract class NotificationListenerService extends Service { /** * A flag value indicating that this notification listener can see conversation type * notifications. * @hide */ public static final int FLAG_FILTER_TYPE_CONVERSATIONS = 1; /** * A flag value indicating that this notification listener can see altering type notifications. * @hide */ public static final int FLAG_FILTER_TYPE_ALERTING = 2; /** * A flag value indicating that this notification listener can see silent type notifications. * @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; Loading services/core/java/com/android/server/notification/ConditionProviders.java +6 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.app.NotificationManager; import android.content.ComponentName; import android.content.Context; import android.content.pm.IPackageManager; import android.content.pm.ServiceInfo; import android.net.Uri; import android.os.IBinder; import android.os.IInterface; Loading Loading @@ -196,6 +197,11 @@ public class ConditionProviders extends ManagedServices { } } @Override protected void ensureFilters(ServiceInfo si, int userId) { // nothing to filter } @Override protected void loadDefaultsFromConfig() { String defaultDndAccess = mContext.getResources().getString( Loading services/core/java/com/android/server/notification/ManagedServices.java +15 −5 Original line number Diff line number Diff line Loading @@ -189,6 +189,8 @@ abstract public class ManagedServices { abstract protected void onServiceAdded(ManagedServiceInfo info); abstract protected void ensureFilters(ServiceInfo si, int userId); protected List<ManagedServiceInfo> getServices() { synchronized (mMutex) { List<ManagedServiceInfo> services = new ArrayList<>(mServices); Loading Loading @@ -1342,8 +1344,10 @@ abstract public class ManagedServices { for (ComponentName component : add) { try { ServiceInfo info = mPm.getServiceInfo(component, PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, userId); PackageManager.GET_META_DATA | PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, userId); if (info == null) { Slog.w(TAG, "Not binding " + getCaption() + " service " + component + ": service not found"); Loading @@ -1356,7 +1360,7 @@ abstract public class ManagedServices { } Slog.v(TAG, "enabling " + getCaption() + " for " + userId + ": " + component); registerService(component, userId); registerService(info, userId); } catch (RemoteException e) { e.rethrowFromSystemServer(); } Loading @@ -1368,9 +1372,15 @@ abstract public class ManagedServices { * Version of registerService that takes the name of a service component to bind to. */ @VisibleForTesting void registerService(final ComponentName name, final int userid) { void registerService(final ServiceInfo si, final int userId) { ensureFilters(si, userId); registerService(si.getComponentName(), userId); } @VisibleForTesting void registerService(final ComponentName cn, final int userId) { synchronized (mMutex) { registerServiceLocked(name, userid); registerServiceLocked(cn, userId); } } Loading Loading
core/api/current.txt +5 −0 Original line number Diff line number Diff line Loading @@ -38076,6 +38076,10 @@ package android.service.notification { method public final void setNotificationsShown(String[]); method public final void snoozeNotification(String, long); method public final void updateNotificationChannel(@NonNull String, @NonNull android.os.UserHandle, @NonNull android.app.NotificationChannel); field public static final int FLAG_FILTER_TYPE_ALERTING = 2; // 0x2 field public static final int FLAG_FILTER_TYPE_CONVERSATIONS = 1; // 0x1 field public static final int FLAG_FILTER_TYPE_ONGOING = 8; // 0x8 field public static final int FLAG_FILTER_TYPE_SILENT = 4; // 0x4 field public static final int HINT_HOST_DISABLE_CALL_EFFECTS = 4; // 0x4 field public static final int HINT_HOST_DISABLE_EFFECTS = 1; // 0x1 field public static final int HINT_HOST_DISABLE_NOTIFICATION_EFFECTS = 2; // 0x2 Loading @@ -38084,6 +38088,7 @@ package android.service.notification { field public static final int INTERRUPTION_FILTER_NONE = 3; // 0x3 field public static final int INTERRUPTION_FILTER_PRIORITY = 2; // 0x2 field public static final int INTERRUPTION_FILTER_UNKNOWN = 0; // 0x0 field public static final String META_DATA_DEFAULT_FILTER_TYPES = "android.service.notification.default_filter_types"; field public static final int NOTIFICATION_CHANNEL_OR_GROUP_ADDED = 1; // 0x1 field public static final int NOTIFICATION_CHANNEL_OR_GROUP_DELETED = 3; // 0x3 field public static final int NOTIFICATION_CHANNEL_OR_GROUP_UPDATED = 2; // 0x2
core/java/android/service/notification/NotificationListenerFilter.java +1 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.util.ArraySet; */ public class NotificationListenerFilter implements Parcelable { private int mAllowedNotificationTypes; // VersionedPackage is holding the pkg name and pkg uid private ArraySet<VersionedPackage> mDisallowedPackages; public NotificationListenerFilter() { Loading
core/java/android/service/notification/NotificationListenerService.java +19 −4 Original line number Diff line number Diff line Loading @@ -80,6 +80,10 @@ import java.util.Objects; * <intent-filter> * <action android:name="android.service.notification.NotificationListenerService" /> * </intent-filter> * <meta-data * android:name="android.service.notification.default_filter_types" * android:value="1,2"> * </meta-data> * </service></pre> * * <p>The service should wait for the {@link #onListenerConnected()} event Loading @@ -102,6 +106,21 @@ public abstract class NotificationListenerService extends Service { @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) private final String TAG = getClass().getSimpleName(); /** * The name of the {@code meta-data} tag containing a comma separated list of default * integer notification types that should be provided to this listener. See * {@link #FLAG_FILTER_TYPE_ONGOING}, * {@link #FLAG_FILTER_TYPE_CONVERSATIONS}, {@link #FLAG_FILTER_TYPE_ALERTING), * and {@link #FLAG_FILTER_TYPE_SILENT}. * <p>This value will only be read if the app has not previously specified a default type list, * and if the user has not overridden the allowed types.</p> * <p>An absent value means 'allow all types'. * A present but empty value means 'allow no types'.</p> * */ public static final String META_DATA_DEFAULT_FILTER_TYPES = "android.service.notification.default_filter_types"; /** * {@link #getCurrentInterruptionFilter() Interruption filter} constant - * Normal interruption filter. Loading Loading @@ -254,23 +273,19 @@ public abstract class NotificationListenerService extends Service { /** * A flag value indicating that this notification listener can see conversation type * notifications. * @hide */ public static final int FLAG_FILTER_TYPE_CONVERSATIONS = 1; /** * A flag value indicating that this notification listener can see altering type notifications. * @hide */ public static final int FLAG_FILTER_TYPE_ALERTING = 2; /** * A flag value indicating that this notification listener can see silent type notifications. * @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; Loading
services/core/java/com/android/server/notification/ConditionProviders.java +6 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.app.NotificationManager; import android.content.ComponentName; import android.content.Context; import android.content.pm.IPackageManager; import android.content.pm.ServiceInfo; import android.net.Uri; import android.os.IBinder; import android.os.IInterface; Loading Loading @@ -196,6 +197,11 @@ public class ConditionProviders extends ManagedServices { } } @Override protected void ensureFilters(ServiceInfo si, int userId) { // nothing to filter } @Override protected void loadDefaultsFromConfig() { String defaultDndAccess = mContext.getResources().getString( Loading
services/core/java/com/android/server/notification/ManagedServices.java +15 −5 Original line number Diff line number Diff line Loading @@ -189,6 +189,8 @@ abstract public class ManagedServices { abstract protected void onServiceAdded(ManagedServiceInfo info); abstract protected void ensureFilters(ServiceInfo si, int userId); protected List<ManagedServiceInfo> getServices() { synchronized (mMutex) { List<ManagedServiceInfo> services = new ArrayList<>(mServices); Loading Loading @@ -1342,8 +1344,10 @@ abstract public class ManagedServices { for (ComponentName component : add) { try { ServiceInfo info = mPm.getServiceInfo(component, PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, userId); PackageManager.GET_META_DATA | PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, userId); if (info == null) { Slog.w(TAG, "Not binding " + getCaption() + " service " + component + ": service not found"); Loading @@ -1356,7 +1360,7 @@ abstract public class ManagedServices { } Slog.v(TAG, "enabling " + getCaption() + " for " + userId + ": " + component); registerService(component, userId); registerService(info, userId); } catch (RemoteException e) { e.rethrowFromSystemServer(); } Loading @@ -1368,9 +1372,15 @@ abstract public class ManagedServices { * Version of registerService that takes the name of a service component to bind to. */ @VisibleForTesting void registerService(final ComponentName name, final int userid) { void registerService(final ServiceInfo si, final int userId) { ensureFilters(si, userId); registerService(si.getComponentName(), userId); } @VisibleForTesting void registerService(final ComponentName cn, final int userId) { synchronized (mMutex) { registerServiceLocked(name, userid); registerServiceLocked(cn, userId); } } Loading