Loading core/java/android/app/INotificationManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -108,6 +108,8 @@ interface INotificationManager ParceledListSlice getNotificationChannelsBypassingDnd(String pkg, int userId); boolean isPackagePaused(String pkg); void silenceNotificationSound(); // TODO: Remove this when callers have been migrated to the equivalent // INotificationListener method. @UnsupportedAppUsage Loading core/java/android/app/NotificationManager.java +19 −0 Original line number Diff line number Diff line Loading @@ -1094,6 +1094,25 @@ public class NotificationManager { } } /** * Silences the current notification sound, if ones currently playing. * <p> * It is intended to handle use-cases such as silencing a ringing call * when the user presses the volume button during ringing. * <p> * If this method is called prior to when the notification begins playing, the sound will not be * silenced. As such it is not intended as a means to avoid playing of a sound. * @hide */ public void silenceNotificationSound() { INotificationManager service = getService(); try { service.silenceNotificationSound(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Returns whether notifications from this package are temporarily hidden. This * could be done because the package was marked as distracting to the user via Loading services/core/java/com/android/server/notification/NotificationManagerService.java +7 −0 Original line number Diff line number Diff line Loading @@ -2404,6 +2404,13 @@ public class NotificationManagerService extends SystemService { REASON_APP_CANCEL_ALL, null); } @Override public void silenceNotificationSound() { checkCallerIsSystem(); mNotificationDelegate.clearEffects(); } @Override public void setNotificationsEnabledForPackage(String pkg, int uid, boolean enabled) { enforceSystemOrSystemUI("setNotificationsEnabledForPackage"); Loading services/core/java/com/android/server/policy/PhoneWindowManager.java +10 −0 Original line number Diff line number Diff line Loading @@ -107,6 +107,7 @@ import android.app.ActivityManagerInternal; import android.app.ActivityTaskManager; import android.app.AppOpsManager; import android.app.IUiModeManager; import android.app.NotificationManager; import android.app.ProgressDialog; import android.app.SearchManager; import android.app.UiModeManager; Loading Loading @@ -2572,6 +2573,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { return (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE); } NotificationManager getNotificationService() { return mContext.getSystemService(NotificationManager.class); } static IAudioService getAudioService() { IAudioService audioService = IAudioService.Stub.asInterface( ServiceManager.checkService(Context.AUDIO_SERVICE)); Loading Loading @@ -3806,6 +3811,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (down) { sendSystemKeyToStatusBarAsync(event.getKeyCode()); NotificationManager nm = getNotificationService(); if (nm != null && !mHandleVolumeKeysInWM) { nm.silenceNotificationSound(); } TelecomManager telecomManager = getTelecommService(); if (telecomManager != null && !mHandleVolumeKeysInWM) { // When {@link #mHandleVolumeKeysInWM} is set, volume key events Loading Loading
core/java/android/app/INotificationManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -108,6 +108,8 @@ interface INotificationManager ParceledListSlice getNotificationChannelsBypassingDnd(String pkg, int userId); boolean isPackagePaused(String pkg); void silenceNotificationSound(); // TODO: Remove this when callers have been migrated to the equivalent // INotificationListener method. @UnsupportedAppUsage Loading
core/java/android/app/NotificationManager.java +19 −0 Original line number Diff line number Diff line Loading @@ -1094,6 +1094,25 @@ public class NotificationManager { } } /** * Silences the current notification sound, if ones currently playing. * <p> * It is intended to handle use-cases such as silencing a ringing call * when the user presses the volume button during ringing. * <p> * If this method is called prior to when the notification begins playing, the sound will not be * silenced. As such it is not intended as a means to avoid playing of a sound. * @hide */ public void silenceNotificationSound() { INotificationManager service = getService(); try { service.silenceNotificationSound(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Returns whether notifications from this package are temporarily hidden. This * could be done because the package was marked as distracting to the user via Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +7 −0 Original line number Diff line number Diff line Loading @@ -2404,6 +2404,13 @@ public class NotificationManagerService extends SystemService { REASON_APP_CANCEL_ALL, null); } @Override public void silenceNotificationSound() { checkCallerIsSystem(); mNotificationDelegate.clearEffects(); } @Override public void setNotificationsEnabledForPackage(String pkg, int uid, boolean enabled) { enforceSystemOrSystemUI("setNotificationsEnabledForPackage"); Loading
services/core/java/com/android/server/policy/PhoneWindowManager.java +10 −0 Original line number Diff line number Diff line Loading @@ -107,6 +107,7 @@ import android.app.ActivityManagerInternal; import android.app.ActivityTaskManager; import android.app.AppOpsManager; import android.app.IUiModeManager; import android.app.NotificationManager; import android.app.ProgressDialog; import android.app.SearchManager; import android.app.UiModeManager; Loading Loading @@ -2572,6 +2573,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { return (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE); } NotificationManager getNotificationService() { return mContext.getSystemService(NotificationManager.class); } static IAudioService getAudioService() { IAudioService audioService = IAudioService.Stub.asInterface( ServiceManager.checkService(Context.AUDIO_SERVICE)); Loading Loading @@ -3806,6 +3811,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (down) { sendSystemKeyToStatusBarAsync(event.getKeyCode()); NotificationManager nm = getNotificationService(); if (nm != null && !mHandleVolumeKeysInWM) { nm.silenceNotificationSound(); } TelecomManager telecomManager = getTelecommService(); if (telecomManager != null && !mHandleVolumeKeysInWM) { // When {@link #mHandleVolumeKeysInWM} is set, volume key events Loading