Loading core/java/android/app/INotificationManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ interface INotificationManager void createNotificationChannelGroups(String pkg, in ParceledListSlice channelGroupList); void createNotificationChannels(String pkg, in ParceledListSlice channelsList); void createNotificationChannelsForPackage(String pkg, int uid, in ParceledListSlice channelsList); ParceledListSlice getNotificationChannelGroupsForPackage(String pkg, int uid, boolean includeDeleted); NotificationChannelGroup getNotificationChannelGroupForPackage(String groupId, String pkg, int uid); void updateNotificationChannelForPackage(String pkg, int uid, in NotificationChannel channel); Loading core/java/android/app/NotificationManager.java +0 −13 Original line number Diff line number Diff line Loading @@ -452,19 +452,6 @@ public class NotificationManager } } /** * @hide */ public void createNotificationChannelsForPackage(String pkg, @NonNull List<NotificationChannel> channels) { INotificationManager service = getService(); try { service.createNotificationChannels(pkg, new ParceledListSlice(channels)); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Returns the notification channel settings for a given channel id. */ Loading core/java/com/android/internal/notification/SystemNotificationChannels.java +18 −5 Original line number Diff line number Diff line Loading @@ -14,10 +14,13 @@ package com.android.internal.notification; import android.app.INotificationManager; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.content.Context; import android.content.pm.ParceledListSlice; import android.os.RemoteException; import android.provider.Settings; import com.android.internal.R; Loading Loading @@ -69,6 +72,8 @@ public class SystemNotificationChannels { context.getString(R.string.notification_channel_car_mode), NotificationManager.IMPORTANCE_LOW)); channelsList.add(newAccountChannel(context)); channelsList.add(new NotificationChannel( DEVELOPER, context.getString(R.string.notification_channel_developer), Loading Loading @@ -121,15 +126,23 @@ public class SystemNotificationChannels { NotificationManager.IMPORTANCE_MIN)); nm.createNotificationChannels(channelsList); createAccountChannelForPackage(context.getPackageName(), context); } public static void createAccountChannelForPackage(String pkg, Context context) { final NotificationManager nm = context.getSystemService(NotificationManager.class); nm.createNotificationChannelsForPackage(pkg, Arrays.asList(new NotificationChannel( public static void createAccountChannelForPackage(String pkg, int uid, Context context) { final INotificationManager iNotificationManager = NotificationManager.getService(); try { iNotificationManager.createNotificationChannelsForPackage(pkg, uid, new ParceledListSlice(Arrays.asList(newAccountChannel(context)))); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } private static NotificationChannel newAccountChannel(Context context) { return new NotificationChannel( ACCOUNT, context.getString(R.string.notification_channel_account), NotificationManager.IMPORTANCE_LOW))); NotificationManager.IMPORTANCE_LOW); } private SystemNotificationChannels() {} Loading services/core/java/com/android/server/accounts/AccountManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -5677,7 +5677,7 @@ public class AccountManagerService synchronized (mUsers) { userAccounts = mUsers.get(userId); } SystemNotificationChannels.createAccountChannelForPackage(packageName, mContext); SystemNotificationChannels.createAccountChannelForPackage(packageName, uid, mContext); doNotification(userAccounts, account, null, intent, packageName, userId); } Loading services/core/java/com/android/server/notification/NotificationManagerService.java +17 −5 Original line number Diff line number Diff line Loading @@ -1633,21 +1633,33 @@ public class NotificationManagerService extends SystemService { savePolicyFile(); } @Override public void createNotificationChannels(String pkg, ParceledListSlice channelsList) throws RemoteException { checkCallerIsSystemOrSameApp(pkg); private void createNotificationChannelsImpl(String pkg, int uid, ParceledListSlice channelsList) { List<NotificationChannel> channels = channelsList.getList(); final int channelsSize = channels.size(); for (int i = 0; i < channelsSize; i++) { final NotificationChannel channel = channels.get(i); Preconditions.checkNotNull(channel, "channel in list is null"); mRankingHelper.createNotificationChannel(pkg, Binder.getCallingUid(), channel, mRankingHelper.createNotificationChannel(pkg, uid, channel, true /* fromTargetApp */); } savePolicyFile(); } @Override public void createNotificationChannels(String pkg, ParceledListSlice channelsList) throws RemoteException { checkCallerIsSystemOrSameApp(pkg); createNotificationChannelsImpl(pkg, Binder.getCallingUid(), channelsList); } @Override public void createNotificationChannelsForPackage(String pkg, int uid, ParceledListSlice channelsList) throws RemoteException { checkCallerIsSystem(); createNotificationChannelsImpl(pkg, uid, channelsList); } @Override public NotificationChannel getNotificationChannel(String pkg, String channelId) { checkCallerIsSystemOrSameApp(pkg); Loading Loading
core/java/android/app/INotificationManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ interface INotificationManager void createNotificationChannelGroups(String pkg, in ParceledListSlice channelGroupList); void createNotificationChannels(String pkg, in ParceledListSlice channelsList); void createNotificationChannelsForPackage(String pkg, int uid, in ParceledListSlice channelsList); ParceledListSlice getNotificationChannelGroupsForPackage(String pkg, int uid, boolean includeDeleted); NotificationChannelGroup getNotificationChannelGroupForPackage(String groupId, String pkg, int uid); void updateNotificationChannelForPackage(String pkg, int uid, in NotificationChannel channel); Loading
core/java/android/app/NotificationManager.java +0 −13 Original line number Diff line number Diff line Loading @@ -452,19 +452,6 @@ public class NotificationManager } } /** * @hide */ public void createNotificationChannelsForPackage(String pkg, @NonNull List<NotificationChannel> channels) { INotificationManager service = getService(); try { service.createNotificationChannels(pkg, new ParceledListSlice(channels)); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Returns the notification channel settings for a given channel id. */ Loading
core/java/com/android/internal/notification/SystemNotificationChannels.java +18 −5 Original line number Diff line number Diff line Loading @@ -14,10 +14,13 @@ package com.android.internal.notification; import android.app.INotificationManager; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.content.Context; import android.content.pm.ParceledListSlice; import android.os.RemoteException; import android.provider.Settings; import com.android.internal.R; Loading Loading @@ -69,6 +72,8 @@ public class SystemNotificationChannels { context.getString(R.string.notification_channel_car_mode), NotificationManager.IMPORTANCE_LOW)); channelsList.add(newAccountChannel(context)); channelsList.add(new NotificationChannel( DEVELOPER, context.getString(R.string.notification_channel_developer), Loading Loading @@ -121,15 +126,23 @@ public class SystemNotificationChannels { NotificationManager.IMPORTANCE_MIN)); nm.createNotificationChannels(channelsList); createAccountChannelForPackage(context.getPackageName(), context); } public static void createAccountChannelForPackage(String pkg, Context context) { final NotificationManager nm = context.getSystemService(NotificationManager.class); nm.createNotificationChannelsForPackage(pkg, Arrays.asList(new NotificationChannel( public static void createAccountChannelForPackage(String pkg, int uid, Context context) { final INotificationManager iNotificationManager = NotificationManager.getService(); try { iNotificationManager.createNotificationChannelsForPackage(pkg, uid, new ParceledListSlice(Arrays.asList(newAccountChannel(context)))); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } private static NotificationChannel newAccountChannel(Context context) { return new NotificationChannel( ACCOUNT, context.getString(R.string.notification_channel_account), NotificationManager.IMPORTANCE_LOW))); NotificationManager.IMPORTANCE_LOW); } private SystemNotificationChannels() {} Loading
services/core/java/com/android/server/accounts/AccountManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -5677,7 +5677,7 @@ public class AccountManagerService synchronized (mUsers) { userAccounts = mUsers.get(userId); } SystemNotificationChannels.createAccountChannelForPackage(packageName, mContext); SystemNotificationChannels.createAccountChannelForPackage(packageName, uid, mContext); doNotification(userAccounts, account, null, intent, packageName, userId); } Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +17 −5 Original line number Diff line number Diff line Loading @@ -1633,21 +1633,33 @@ public class NotificationManagerService extends SystemService { savePolicyFile(); } @Override public void createNotificationChannels(String pkg, ParceledListSlice channelsList) throws RemoteException { checkCallerIsSystemOrSameApp(pkg); private void createNotificationChannelsImpl(String pkg, int uid, ParceledListSlice channelsList) { List<NotificationChannel> channels = channelsList.getList(); final int channelsSize = channels.size(); for (int i = 0; i < channelsSize; i++) { final NotificationChannel channel = channels.get(i); Preconditions.checkNotNull(channel, "channel in list is null"); mRankingHelper.createNotificationChannel(pkg, Binder.getCallingUid(), channel, mRankingHelper.createNotificationChannel(pkg, uid, channel, true /* fromTargetApp */); } savePolicyFile(); } @Override public void createNotificationChannels(String pkg, ParceledListSlice channelsList) throws RemoteException { checkCallerIsSystemOrSameApp(pkg); createNotificationChannelsImpl(pkg, Binder.getCallingUid(), channelsList); } @Override public void createNotificationChannelsForPackage(String pkg, int uid, ParceledListSlice channelsList) throws RemoteException { checkCallerIsSystem(); createNotificationChannelsImpl(pkg, uid, channelsList); } @Override public NotificationChannel getNotificationChannel(String pkg, String channelId) { checkCallerIsSystemOrSameApp(pkg); Loading