Buggy code:
@ Override public void unregisterListener ( INotificationListener listener , int userid ) { } @ Override public void cancelNotificationsFromListener ( INotificationListener token , String [ ] keys ) { } private void cancelNotificationFromListenerLocked ( ManagedServiceInfo info , int callingUid , int callingPid , String pkg , String tag , int id , int userId ) { } @ Override public void cancelNotificationFromListener ( INotificationListener token , String pkg , String tag , int id ) { } @ Override public ParceledListSlice < StatusBarNotification > getActiveNotificationsFromListener ( INotificationListener token , String [ ] keys , int trim ) { } @ Override public void requestHintsFromListener ( INotificationListener token , int hints ) { } @ Override public int getHintsFromListener ( INotificationListener token ) { } @ Override public void requestInterruptionFilterFromListener ( INotificationListener token , int interruptionFilter ) throws RemoteException { } @ Override public int getInterruptionFilterFromListener ( INotificationListener token ) throws RemoteException { } @ Override public void setOnNotificationPostedTrimFromListener ( INotificationListener token , int trim ) throws RemoteException { } @ Override public ZenModeConfig getZenModeConfig ( ) { } @ Override public boolean setZenModeConfig ( ZenModeConfig config ) { } @ Override public void notifyConditions ( String pkg , IConditionProvider provider , Condition [ ] conditions ) { } @ Override public void requestZenModeConditions ( IConditionListener callback , int relevance ) { } @ Override public void setZenModeCondition ( Condition condition ) { } @ Override public void setAutomaticZenModeConditions ( Uri [ ] conditionIds ) { } @ Override public Condition [ ] getAutomaticZenModeConditions ( ) { } private void enforceSystemOrSystemUI ( String message ) { } @ Override protected void dump ( FileDescriptor fd , PrintWriter pw , String [ ] args ) { } @ Override public ComponentName getEffectsSuppressor ( ) { } @ Override public boolean matchesCallFilter ( Bundle extras ) { } } ; private String [ ] getActiveNotificationKeys ( INotificationListener token ) { } private String disableNotificationEffects ( NotificationRecord record ) { } void dumpImpl ( PrintWriter pw , NotificationManagerService . DumpFilter filter ) { } private final NotificationManagerInternal mInternalService = new NotificationManagerInternal ( ) { @ Override public void enqueueNotification ( String pkg , String opPkg , int callingUid , int callingPid , String tag , int id , Notification notification , int [ ] idReceived , int userId ) { } @ Override public void removeForegroundServiceFlagFromNotification ( String pkg , int notificationId , int userId ) { } } ; void enqueueNotificationInternal ( final String pkg , final String opPkg , final int callingUid , final int callingPid , final String tag , final int id , final Notification notification , int [ ] idOut , int incomingUserId ) { } private boolean notificationIsAnnoying ( String pkg ) { } private void buzzBeepBlinkLocked ( NotificationRecord record ) { boolean buzzBeepBlinked = false ; final Notification notification = record . sbn . getNotification ( ) ; final String pkg = record . sbn . getPackageName ( ) ; final boolean canInterrupt = ( ( record . score ) >= ( NotificationManagerService . SCORE_INTERRUPTION_THRESHOLD ) ) && ( ! ( record . isIntercepted ( ) ) ) ; if ( ( NotificationManagerService . DBG ) || ( record . isIntercepted ( ) ) ) Slog . v ( NotificationManagerService . TAG , ( ( ( ( ( "pkg=" + pkg ) + "<seq2seq4repair_space>canInterrupt=" ) + canInterrupt ) + "<seq2seq4repair_space>intercept=" ) + ( record . isIntercepted ( ) ) ) ) ; final int currentUser ; final long token = Binder . clearCallingIdentity ( ) ; try { currentUser = ActivityManager . getCurrentUser ( ) ; } finally { Binder . restoreCallingIdentity ( token ) ; } final ProfileManager profileManager = ( ( ProfileManager ) ( mContext . getSystemService ( PROFILE_SERVICE ) ) ) ; <START_BUG> ProfileGroup group = profileManager . getActiveProfileGroup ( pkg ) ; <END_BUG> if ( group != null ) { group . applyOverridesToNotification ( notification ) ; } final String disableEffects = disableNotificationEffects ( record ) ; if ( disableEffects != null ) { ZenLog . traceDisableEffects ( record , disableEffects ) ; } if ( ( ( ( ( ( ( disableEffects == null ) && ( ! ( ( record . isUpdate ) && ( ( ( notification . flags ) & ( Notification . FLAG_ONLY_ALERT_ONCE ) ) != 0 ) ) ) ) && ( ( ( ( record . getUserId ( ) ) == ( UserHandle . USER_ALL ) ) || ( ( record . getUserId ( ) ) == currentUser ) ) || ( mUserProfiles . isCurrentProfile ( record . getUserId ( ) ) ) ) ) && canInterrupt ) && ( mSystemReady ) ) && ( ! ( notificationIsAnnoying ( pkg ) ) ) ) && ( ( mAudioManager ) != null ) ) { if ( NotificationManagerService . DBG ) Slog . v ( NotificationManagerService . TAG , "Interrupting!" ) ; sendAccessibilityEvent ( notification , record . sbn . getPackageName ( ) ) ; final boolean useDefaultSound = ( ( ( notification . defaults ) & ( Notification . DEFAULT_SOUND ) ) != 0 ) || ( DEFAULT_NOTIFICATION_URI . equals ( notification . sound ) ) ; Uri soundUri = null ; boolean hasValidSound = false ; if ( useDefaultSound ) { soundUri = System . DEFAULT_NOTIFICATION_URI ; ContentResolver resolver = getContext ( ) . getContentResolver ( ) ; hasValidSound = ( System . getString ( resolver , NOTIFICATION_SOUND ) ) != null ; } else if ( ( notification . sound ) != null ) { soundUri = notification . sound ; hasValidSound = soundUri != null ; } if ( hasValidSound ) { boolean looping = ( ( notification . flags ) & ( Notification . FLAG_INSISTENT ) ) != 0 ; AudioAttributes audioAttributes ; if ( ( notification . audioAttributes ) != null ) { audioAttributes = notification . audioAttributes ; } else { audioAttributes = Notification . AUDIO_ATTRIBUTES_DEFAULT ;

Fix:
ProfileGroup group = profileManager . getActiveProfileGroup ( mContext . getPackageName ( ) ) ;