Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -5676,6 +5676,7 @@ package android.app { method public java.lang.CharSequence getName(); method public android.net.Uri getSound(); method public long[] getVibrationPattern(); method public boolean hasUserSetImportance(); method public void setBypassDnd(boolean); method public void setDescription(java.lang.String); method public void setGroup(java.lang.String); core/java/android/app/NotificationChannel.java +3 −2 Original line number Diff line number Diff line Loading @@ -603,9 +603,10 @@ public final class NotificationChannel implements Parcelable { } /** * @hide * Returns whether the user has chosen the importance of this channel, either to affirm the * initial selection from the app, or changed it to be higher or lower. */ public boolean isImportanceLocked() { public boolean hasUserSetImportance() { return (mUserLockedFields & USER_LOCKED_IMPORTANCE) != 0; } Loading core/java/android/service/notification/NotificationListenerService.java +4 −2 Original line number Diff line number Diff line Loading @@ -737,7 +737,8 @@ public abstract class NotificationListenerService extends Service { * <p>This method will throw a security exception if you don't have access to notifications * for the given user.</p> * <p>The caller must have {@link CompanionDeviceManager#getAssociations() an associated * device} in order to use this method. * device} or be the {@link NotificationAssistantService notification assistant} in order to * use this method. * * @param pkg The package to retrieve channels for. */ Loading @@ -760,7 +761,8 @@ public abstract class NotificationListenerService extends Service { * <p>This method will throw a security exception if you don't have access to notifications * for the given user.</p> * <p>The caller must have {@link CompanionDeviceManager#getAssociations() an associated * device} in order to use this method. * device} or be the {@link NotificationAssistantService notification assistant} in order to * use this method. * * @param pkg The package to retrieve channel groups for. */ Loading packages/ExtServices/src/android/ext/services/notification/AgingHelper.java +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ public class AgingHelper { public void onNotificationSeen(NotificationEntry entry) { // user has strong opinions about this notification. we can't down rank it, so don't bother. if (entry.getChannel().isImportanceLocked()) { if (entry.getChannel().hasUserSetImportance()) { return; } Loading services/core/java/com/android/server/notification/NotificationManagerService.java +11 −6 Original line number Diff line number Diff line Loading @@ -3622,7 +3622,7 @@ public class NotificationManagerService extends SystemService { INotificationListener token, String pkg, UserHandle user, NotificationChannelGroup group) throws RemoteException { Preconditions.checkNotNull(user); verifyPrivilegedListener(token, user); verifyPrivilegedListener(token, user, false); createNotificationChannelGroup( pkg, getUidForPackageAndUser(pkg, user), group, false, true); savePolicyFile(); Loading @@ -3635,7 +3635,7 @@ public class NotificationManagerService extends SystemService { Preconditions.checkNotNull(pkg); Preconditions.checkNotNull(user); verifyPrivilegedListener(token, user); verifyPrivilegedListener(token, user, false); updateNotificationChannelInt(pkg, getUidForPackageAndUser(pkg, user), channel, true); } Loading @@ -3644,7 +3644,7 @@ public class NotificationManagerService extends SystemService { INotificationListener token, String pkg, UserHandle user) throws RemoteException { Preconditions.checkNotNull(pkg); Preconditions.checkNotNull(user); verifyPrivilegedListener(token, user); verifyPrivilegedListener(token, user, true); return mPreferencesHelper.getNotificationChannels(pkg, getUidForPackageAndUser(pkg, user), false /* includeDeleted */); Loading @@ -3656,7 +3656,7 @@ public class NotificationManagerService extends SystemService { INotificationListener token, String pkg, UserHandle user) throws RemoteException { Preconditions.checkNotNull(pkg); Preconditions.checkNotNull(user); verifyPrivilegedListener(token, user); verifyPrivilegedListener(token, user, true); List<NotificationChannelGroup> groups = new ArrayList<>(); groups.addAll(mPreferencesHelper.getNotificationChannelGroups( Loading @@ -3664,14 +3664,19 @@ public class NotificationManagerService extends SystemService { return new ParceledListSlice<>(groups); } private void verifyPrivilegedListener(INotificationListener token, UserHandle user) { private void verifyPrivilegedListener(INotificationListener token, UserHandle user, boolean assistantAllowed) { ManagedServiceInfo info; synchronized (mNotificationLock) { info = mListeners.checkServiceTokenLocked(token); } if (!hasCompanionDevice(info)) { synchronized (mNotificationLock) { if (!assistantAllowed || !mAssistants.isServiceTokenValidLocked(info.service)) { throw new SecurityException(info + " does not have access"); } } } if (!info.enabledAndUserMatches(user.getIdentifier())) { throw new SecurityException(info + " does not have access"); } Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -5676,6 +5676,7 @@ package android.app { method public java.lang.CharSequence getName(); method public android.net.Uri getSound(); method public long[] getVibrationPattern(); method public boolean hasUserSetImportance(); method public void setBypassDnd(boolean); method public void setDescription(java.lang.String); method public void setGroup(java.lang.String);
core/java/android/app/NotificationChannel.java +3 −2 Original line number Diff line number Diff line Loading @@ -603,9 +603,10 @@ public final class NotificationChannel implements Parcelable { } /** * @hide * Returns whether the user has chosen the importance of this channel, either to affirm the * initial selection from the app, or changed it to be higher or lower. */ public boolean isImportanceLocked() { public boolean hasUserSetImportance() { return (mUserLockedFields & USER_LOCKED_IMPORTANCE) != 0; } Loading
core/java/android/service/notification/NotificationListenerService.java +4 −2 Original line number Diff line number Diff line Loading @@ -737,7 +737,8 @@ public abstract class NotificationListenerService extends Service { * <p>This method will throw a security exception if you don't have access to notifications * for the given user.</p> * <p>The caller must have {@link CompanionDeviceManager#getAssociations() an associated * device} in order to use this method. * device} or be the {@link NotificationAssistantService notification assistant} in order to * use this method. * * @param pkg The package to retrieve channels for. */ Loading @@ -760,7 +761,8 @@ public abstract class NotificationListenerService extends Service { * <p>This method will throw a security exception if you don't have access to notifications * for the given user.</p> * <p>The caller must have {@link CompanionDeviceManager#getAssociations() an associated * device} in order to use this method. * device} or be the {@link NotificationAssistantService notification assistant} in order to * use this method. * * @param pkg The package to retrieve channel groups for. */ Loading
packages/ExtServices/src/android/ext/services/notification/AgingHelper.java +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ public class AgingHelper { public void onNotificationSeen(NotificationEntry entry) { // user has strong opinions about this notification. we can't down rank it, so don't bother. if (entry.getChannel().isImportanceLocked()) { if (entry.getChannel().hasUserSetImportance()) { return; } Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +11 −6 Original line number Diff line number Diff line Loading @@ -3622,7 +3622,7 @@ public class NotificationManagerService extends SystemService { INotificationListener token, String pkg, UserHandle user, NotificationChannelGroup group) throws RemoteException { Preconditions.checkNotNull(user); verifyPrivilegedListener(token, user); verifyPrivilegedListener(token, user, false); createNotificationChannelGroup( pkg, getUidForPackageAndUser(pkg, user), group, false, true); savePolicyFile(); Loading @@ -3635,7 +3635,7 @@ public class NotificationManagerService extends SystemService { Preconditions.checkNotNull(pkg); Preconditions.checkNotNull(user); verifyPrivilegedListener(token, user); verifyPrivilegedListener(token, user, false); updateNotificationChannelInt(pkg, getUidForPackageAndUser(pkg, user), channel, true); } Loading @@ -3644,7 +3644,7 @@ public class NotificationManagerService extends SystemService { INotificationListener token, String pkg, UserHandle user) throws RemoteException { Preconditions.checkNotNull(pkg); Preconditions.checkNotNull(user); verifyPrivilegedListener(token, user); verifyPrivilegedListener(token, user, true); return mPreferencesHelper.getNotificationChannels(pkg, getUidForPackageAndUser(pkg, user), false /* includeDeleted */); Loading @@ -3656,7 +3656,7 @@ public class NotificationManagerService extends SystemService { INotificationListener token, String pkg, UserHandle user) throws RemoteException { Preconditions.checkNotNull(pkg); Preconditions.checkNotNull(user); verifyPrivilegedListener(token, user); verifyPrivilegedListener(token, user, true); List<NotificationChannelGroup> groups = new ArrayList<>(); groups.addAll(mPreferencesHelper.getNotificationChannelGroups( Loading @@ -3664,14 +3664,19 @@ public class NotificationManagerService extends SystemService { return new ParceledListSlice<>(groups); } private void verifyPrivilegedListener(INotificationListener token, UserHandle user) { private void verifyPrivilegedListener(INotificationListener token, UserHandle user, boolean assistantAllowed) { ManagedServiceInfo info; synchronized (mNotificationLock) { info = mListeners.checkServiceTokenLocked(token); } if (!hasCompanionDevice(info)) { synchronized (mNotificationLock) { if (!assistantAllowed || !mAssistants.isServiceTokenValidLocked(info.service)) { throw new SecurityException(info + " does not have access"); } } } if (!info.enabledAndUserMatches(user.getIdentifier())) { throw new SecurityException(info + " does not have access"); } Loading