Loading core/java/android/app/ProfileGroup.java +10 −21 Original line number Diff line number Diff line Loading @@ -187,36 +187,40 @@ public final class ProfileGroup implements Parcelable { // TODO : add support for LEDs / screen etc. /** @hide */ public Notification processNotification(Notification notification) { public void applyOverridesToNotification(Notification notification) { switch (mSoundMode) { case OVERRIDE: notification.sound = mSoundOverride; break; case SUPPRESS: silenceNotification(notification); notification.defaults &= ~Notification.DEFAULT_SOUND; notification.sound = null; break; case DEFAULT: break; } switch (mVibrateMode) { case OVERRIDE: notification.defaults |= Notification.DEFAULT_VIBRATE; break; case SUPPRESS: suppressVibrate(notification); notification.defaults &= ~Notification.DEFAULT_VIBRATE; notification.vibrate = null; break; case DEFAULT: break; } switch (mLightsMode) { case OVERRIDE: notification.defaults |= Notification.DEFAULT_LIGHTS; break; case SUPPRESS: suppressLights(notification); notification.defaults &= ~Notification.DEFAULT_LIGHTS; notification.flags &= ~Notification.FLAG_SHOW_LIGHTS; break; case DEFAULT: break; } return notification; } private boolean validateOverrideUri(Context context, Uri uri) { Loading Loading @@ -246,21 +250,6 @@ public final class ProfileGroup implements Parcelable { } } private void silenceNotification(Notification notification) { notification.defaults &= (~Notification.DEFAULT_SOUND); notification.sound = null; } private void suppressVibrate(Notification notification) { notification.defaults &= (~Notification.DEFAULT_VIBRATE); notification.vibrate = null; } private void suppressLights(Notification notification) { notification.defaults &= (~Notification.DEFAULT_LIGHTS); notification.flags &= (~Notification.FLAG_SHOW_LIGHTS); } /** @hide */ @Override public int describeContents() { Loading services/java/com/android/server/NotificationManagerService.java +5 −10 Original line number Diff line number Diff line Loading @@ -1939,17 +1939,12 @@ public class NotificationManagerService extends INotificationManager.Stub + n.getPackageName()); } try { final ProfileManager profileManager = (ProfileManager) mContext.getSystemService(Context.PROFILE_SERVICE); ProfileGroup group = profileManager.getActiveProfileGroup(pkg); if (group != null) { // FIXME: local variable notification is accessed from within inner class; needs to be declared final //notification = group.processNotification(notification); } } catch(Throwable th) { Log.e(TAG, "An error occurred profiling the notification.", th); group.applyOverridesToNotification(notification); } final boolean alertsDisabled = Loading Loading
core/java/android/app/ProfileGroup.java +10 −21 Original line number Diff line number Diff line Loading @@ -187,36 +187,40 @@ public final class ProfileGroup implements Parcelable { // TODO : add support for LEDs / screen etc. /** @hide */ public Notification processNotification(Notification notification) { public void applyOverridesToNotification(Notification notification) { switch (mSoundMode) { case OVERRIDE: notification.sound = mSoundOverride; break; case SUPPRESS: silenceNotification(notification); notification.defaults &= ~Notification.DEFAULT_SOUND; notification.sound = null; break; case DEFAULT: break; } switch (mVibrateMode) { case OVERRIDE: notification.defaults |= Notification.DEFAULT_VIBRATE; break; case SUPPRESS: suppressVibrate(notification); notification.defaults &= ~Notification.DEFAULT_VIBRATE; notification.vibrate = null; break; case DEFAULT: break; } switch (mLightsMode) { case OVERRIDE: notification.defaults |= Notification.DEFAULT_LIGHTS; break; case SUPPRESS: suppressLights(notification); notification.defaults &= ~Notification.DEFAULT_LIGHTS; notification.flags &= ~Notification.FLAG_SHOW_LIGHTS; break; case DEFAULT: break; } return notification; } private boolean validateOverrideUri(Context context, Uri uri) { Loading Loading @@ -246,21 +250,6 @@ public final class ProfileGroup implements Parcelable { } } private void silenceNotification(Notification notification) { notification.defaults &= (~Notification.DEFAULT_SOUND); notification.sound = null; } private void suppressVibrate(Notification notification) { notification.defaults &= (~Notification.DEFAULT_VIBRATE); notification.vibrate = null; } private void suppressLights(Notification notification) { notification.defaults &= (~Notification.DEFAULT_LIGHTS); notification.flags &= (~Notification.FLAG_SHOW_LIGHTS); } /** @hide */ @Override public int describeContents() { Loading
services/java/com/android/server/NotificationManagerService.java +5 −10 Original line number Diff line number Diff line Loading @@ -1939,17 +1939,12 @@ public class NotificationManagerService extends INotificationManager.Stub + n.getPackageName()); } try { final ProfileManager profileManager = (ProfileManager) mContext.getSystemService(Context.PROFILE_SERVICE); ProfileGroup group = profileManager.getActiveProfileGroup(pkg); if (group != null) { // FIXME: local variable notification is accessed from within inner class; needs to be declared final //notification = group.processNotification(notification); } } catch(Throwable th) { Log.e(TAG, "An error occurred profiling the notification.", th); group.applyOverridesToNotification(notification); } final boolean alertsDisabled = Loading