Loading services/core/java/com/android/server/notification/NotificationManagerService.java +18 −6 Original line number Diff line number Diff line Loading @@ -397,7 +397,7 @@ public class NotificationManagerService extends SystemService { // for enabling and disabling notification pulse behavior boolean mScreenOn = true; protected boolean mInCall = false; protected boolean mInCallStateOffHook = false; boolean mNotificationPulseEnabled; private Uri mInCallNotificationUri; Loading Loading @@ -1292,7 +1292,7 @@ public class NotificationManagerService extends SystemService { mScreenOn = false; updateNotificationPulse(); } else if (action.equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)) { mInCall = TelephonyManager.EXTRA_STATE_OFFHOOK mInCallStateOffHook = TelephonyManager.EXTRA_STATE_OFFHOOK .equals(intent.getStringExtra(TelephonyManager.EXTRA_STATE)); updateNotificationPulse(); } else if (action.equals(Intent.ACTION_USER_STOPPED)) { Loading Loading @@ -5710,7 +5710,7 @@ public class NotificationManagerService extends SystemService { } if (DBG) Slog.v(TAG, "Interrupting!"); if (hasValidSound) { if (mInCall) { if (isInCall()) { playInCallNotification(); beep = true; } else { Loading @@ -5724,7 +5724,7 @@ public class NotificationManagerService extends SystemService { final boolean ringerModeSilent = mAudioManager.getRingerModeInternal() == AudioManager.RINGER_MODE_SILENT; if (!mInCall && hasValidVibrate && !ringerModeSilent) { if (!isInCall() && hasValidVibrate && !ringerModeSilent) { buzz = playVibration(record, vibration, hasValidSound); if(buzz) { mVibrateNotificationKey = key; Loading Loading @@ -5812,7 +5812,7 @@ public class NotificationManagerService extends SystemService { return false; } // not if in call or the screen's on if (mInCall || mScreenOn) { if (isInCall() || mScreenOn) { return false; } Loading Loading @@ -6913,7 +6913,7 @@ public class NotificationManagerService extends SystemService { } // Don't flash while we are in a call or screen is on if (ledNotification == null || mInCall || mScreenOn) { if (ledNotification == null || isInCall() || mScreenOn) { mNotificationLight.turnOff(); } else { NotificationRecord.Light light = ledNotification.getLight(); Loading Loading @@ -7381,6 +7381,18 @@ public class NotificationManagerService extends SystemService { } } private boolean isInCall() { if (mInCallStateOffHook) { return true; } int audioMode = mAudioManager.getMode(); if (audioMode == AudioManager.MODE_IN_CALL || audioMode == AudioManager.MODE_IN_COMMUNICATION) { return true; } return false; } public class NotificationAssistants extends ManagedServices { static final String TAG_ENABLED_NOTIFICATION_ASSISTANTS = "enabled_assistants"; Loading services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java +3 −3 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ public class BuzzBeepBlinkTest extends UiServiceTestCase { mService.setUsageStats(mUsageStats); mService.setAccessibilityManager(accessibilityManager); mService.mScreenOn = false; mService.mInCall = false; mService.mInCallStateOffHook = false; mService.mNotificationPulseEnabled = true; } Loading Loading @@ -681,7 +681,7 @@ public class BuzzBeepBlinkTest extends UiServiceTestCase { mService.buzzBeepBlinkLocked(r); Mockito.reset(mRingtonePlayer); mService.mInCall = true; mService.mInCallStateOffHook = true; mService.buzzBeepBlinkLocked(r); verify(mService, times(1)).playInCallNotification(); Loading Loading @@ -1137,7 +1137,7 @@ public class BuzzBeepBlinkTest extends UiServiceTestCase { @Test public void testLightsInCall() { mService.mInCall = true; mService.mInCallStateOffHook = true; NotificationRecord r = getLightsNotification(); mService.buzzBeepBlinkLocked(r); verifyNeverLights(); Loading Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +18 −6 Original line number Diff line number Diff line Loading @@ -397,7 +397,7 @@ public class NotificationManagerService extends SystemService { // for enabling and disabling notification pulse behavior boolean mScreenOn = true; protected boolean mInCall = false; protected boolean mInCallStateOffHook = false; boolean mNotificationPulseEnabled; private Uri mInCallNotificationUri; Loading Loading @@ -1292,7 +1292,7 @@ public class NotificationManagerService extends SystemService { mScreenOn = false; updateNotificationPulse(); } else if (action.equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)) { mInCall = TelephonyManager.EXTRA_STATE_OFFHOOK mInCallStateOffHook = TelephonyManager.EXTRA_STATE_OFFHOOK .equals(intent.getStringExtra(TelephonyManager.EXTRA_STATE)); updateNotificationPulse(); } else if (action.equals(Intent.ACTION_USER_STOPPED)) { Loading Loading @@ -5710,7 +5710,7 @@ public class NotificationManagerService extends SystemService { } if (DBG) Slog.v(TAG, "Interrupting!"); if (hasValidSound) { if (mInCall) { if (isInCall()) { playInCallNotification(); beep = true; } else { Loading @@ -5724,7 +5724,7 @@ public class NotificationManagerService extends SystemService { final boolean ringerModeSilent = mAudioManager.getRingerModeInternal() == AudioManager.RINGER_MODE_SILENT; if (!mInCall && hasValidVibrate && !ringerModeSilent) { if (!isInCall() && hasValidVibrate && !ringerModeSilent) { buzz = playVibration(record, vibration, hasValidSound); if(buzz) { mVibrateNotificationKey = key; Loading Loading @@ -5812,7 +5812,7 @@ public class NotificationManagerService extends SystemService { return false; } // not if in call or the screen's on if (mInCall || mScreenOn) { if (isInCall() || mScreenOn) { return false; } Loading Loading @@ -6913,7 +6913,7 @@ public class NotificationManagerService extends SystemService { } // Don't flash while we are in a call or screen is on if (ledNotification == null || mInCall || mScreenOn) { if (ledNotification == null || isInCall() || mScreenOn) { mNotificationLight.turnOff(); } else { NotificationRecord.Light light = ledNotification.getLight(); Loading Loading @@ -7381,6 +7381,18 @@ public class NotificationManagerService extends SystemService { } } private boolean isInCall() { if (mInCallStateOffHook) { return true; } int audioMode = mAudioManager.getMode(); if (audioMode == AudioManager.MODE_IN_CALL || audioMode == AudioManager.MODE_IN_COMMUNICATION) { return true; } return false; } public class NotificationAssistants extends ManagedServices { static final String TAG_ENABLED_NOTIFICATION_ASSISTANTS = "enabled_assistants"; Loading
services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java +3 −3 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ public class BuzzBeepBlinkTest extends UiServiceTestCase { mService.setUsageStats(mUsageStats); mService.setAccessibilityManager(accessibilityManager); mService.mScreenOn = false; mService.mInCall = false; mService.mInCallStateOffHook = false; mService.mNotificationPulseEnabled = true; } Loading Loading @@ -681,7 +681,7 @@ public class BuzzBeepBlinkTest extends UiServiceTestCase { mService.buzzBeepBlinkLocked(r); Mockito.reset(mRingtonePlayer); mService.mInCall = true; mService.mInCallStateOffHook = true; mService.buzzBeepBlinkLocked(r); verify(mService, times(1)).playInCallNotification(); Loading Loading @@ -1137,7 +1137,7 @@ public class BuzzBeepBlinkTest extends UiServiceTestCase { @Test public void testLightsInCall() { mService.mInCall = true; mService.mInCallStateOffHook = true; NotificationRecord r = getLightsNotification(); mService.buzzBeepBlinkLocked(r); verifyNeverLights(); Loading