Loading core/res/res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -745,6 +745,10 @@ <!-- XXXXXX END OF RESOURCES USING WRONG NAMING CONVENTION --> <!-- If this is true, notification effects will be played by the notification server. When false, car notification effects will be handled elsewhere. --> <bool name="config_enableServerNotificationEffectsForAutomotive">false</bool> <!-- If this is true, the screen will come on when you unplug usb/power/whatever. --> <bool name="config_unplugTurnsOnScreen">false</bool> Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1910,6 +1910,7 @@ <java-symbol type="array" name="config_testLocationProviders" /> <java-symbol type="array" name="config_defaultNotificationVibePattern" /> <java-symbol type="array" name="config_notificationFallbackVibePattern" /> <java-symbol type="bool" name="config_enableServerNotificationEffectsForAutomotive" /> <java-symbol type="bool" name="config_useAttentionLight" /> <java-symbol type="bool" name="config_adaptive_sleep_available" /> <java-symbol type="bool" name="config_animateScreenLights" /> Loading services/core/java/com/android/server/notification/NotificationManagerService.java +11 −0 Original line number Diff line number Diff line Loading @@ -455,6 +455,7 @@ public class NotificationManagerService extends SystemService { private int mAutoGroupAtCount; private boolean mIsTelevision; private boolean mIsAutomotive; private boolean mNotificationEffectsEnabledForAutomotive; private MetricsLogger mMetricsLogger; private TriPredicate<String, Integer, String> mAllowedManagedServicePackages; Loading Loading @@ -1525,6 +1526,11 @@ public class NotificationManagerService extends SystemService { mIsAutomotive = isAutomotive; } @VisibleForTesting void setNotificationEffectsEnabledForAutomotive(boolean isEnabled) { mNotificationEffectsEnabledForAutomotive = isEnabled; } @VisibleForTesting void setIsTelevision(boolean isTelevision) { mIsTelevision = isTelevision; Loading Loading @@ -1686,6 +1692,8 @@ public class NotificationManagerService extends SystemService { mIsAutomotive = mPackageManagerClient.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE, 0); mNotificationEffectsEnabledForAutomotive = resources.getBoolean(R.bool.config_enableServerNotificationEffectsForAutomotive); mPreferencesHelper.lockChannelsForOEM(getContext().getResources().getStringArray( com.android.internal.R.array.config_nonBlockableNotificationPackages)); Loading Loading @@ -5563,6 +5571,9 @@ public class NotificationManagerService extends SystemService { @VisibleForTesting @GuardedBy("mNotificationLock") void buzzBeepBlinkLocked(NotificationRecord record) { if (mIsAutomotive && !mNotificationEffectsEnabledForAutomotive) { return; } boolean buzz = false; boolean beep = false; boolean blink = false; Loading services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java +19 −2 Original line number Diff line number Diff line Loading @@ -455,8 +455,23 @@ public class BuzzBeepBlinkTest extends UiServiceTestCase { } @Test public void testNoBeepForImportanceDefaultInAutomotive() throws Exception { public void testNoBeepForAutomotiveIfEffectsDisabled() throws Exception { mService.setIsAutomotive(true); mService.setNotificationEffectsEnabledForAutomotive(false); NotificationRecord r = getBeepyNotification(); r.setSystemImportance(NotificationManager.IMPORTANCE_HIGH); mService.buzzBeepBlinkLocked(r); verifyNeverBeep(); assertFalse(r.isInterruptive()); } @Test public void testNoBeepForImportanceDefaultInAutomotiveIfEffectsEnabled() throws Exception { mService.setIsAutomotive(true); mService.setNotificationEffectsEnabledForAutomotive(true); NotificationRecord r = getBeepyNotification(); r.setSystemImportance(NotificationManager.IMPORTANCE_DEFAULT); Loading @@ -468,10 +483,12 @@ public class BuzzBeepBlinkTest extends UiServiceTestCase { } @Test public void testBeepForImportanceHighInAutomotive() throws Exception { public void testBeepForImportanceHighInAutomotiveIfEffectsEnabled() throws Exception { mService.setIsAutomotive(true); mService.setNotificationEffectsEnabledForAutomotive(true); NotificationRecord r = getBeepyNotification(); r.setSystemImportance(NotificationManager.IMPORTANCE_HIGH); mService.buzzBeepBlinkLocked(r); Loading Loading
core/res/res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -745,6 +745,10 @@ <!-- XXXXXX END OF RESOURCES USING WRONG NAMING CONVENTION --> <!-- If this is true, notification effects will be played by the notification server. When false, car notification effects will be handled elsewhere. --> <bool name="config_enableServerNotificationEffectsForAutomotive">false</bool> <!-- If this is true, the screen will come on when you unplug usb/power/whatever. --> <bool name="config_unplugTurnsOnScreen">false</bool> Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1910,6 +1910,7 @@ <java-symbol type="array" name="config_testLocationProviders" /> <java-symbol type="array" name="config_defaultNotificationVibePattern" /> <java-symbol type="array" name="config_notificationFallbackVibePattern" /> <java-symbol type="bool" name="config_enableServerNotificationEffectsForAutomotive" /> <java-symbol type="bool" name="config_useAttentionLight" /> <java-symbol type="bool" name="config_adaptive_sleep_available" /> <java-symbol type="bool" name="config_animateScreenLights" /> Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +11 −0 Original line number Diff line number Diff line Loading @@ -455,6 +455,7 @@ public class NotificationManagerService extends SystemService { private int mAutoGroupAtCount; private boolean mIsTelevision; private boolean mIsAutomotive; private boolean mNotificationEffectsEnabledForAutomotive; private MetricsLogger mMetricsLogger; private TriPredicate<String, Integer, String> mAllowedManagedServicePackages; Loading Loading @@ -1525,6 +1526,11 @@ public class NotificationManagerService extends SystemService { mIsAutomotive = isAutomotive; } @VisibleForTesting void setNotificationEffectsEnabledForAutomotive(boolean isEnabled) { mNotificationEffectsEnabledForAutomotive = isEnabled; } @VisibleForTesting void setIsTelevision(boolean isTelevision) { mIsTelevision = isTelevision; Loading Loading @@ -1686,6 +1692,8 @@ public class NotificationManagerService extends SystemService { mIsAutomotive = mPackageManagerClient.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE, 0); mNotificationEffectsEnabledForAutomotive = resources.getBoolean(R.bool.config_enableServerNotificationEffectsForAutomotive); mPreferencesHelper.lockChannelsForOEM(getContext().getResources().getStringArray( com.android.internal.R.array.config_nonBlockableNotificationPackages)); Loading Loading @@ -5563,6 +5571,9 @@ public class NotificationManagerService extends SystemService { @VisibleForTesting @GuardedBy("mNotificationLock") void buzzBeepBlinkLocked(NotificationRecord record) { if (mIsAutomotive && !mNotificationEffectsEnabledForAutomotive) { return; } boolean buzz = false; boolean beep = false; boolean blink = false; Loading
services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java +19 −2 Original line number Diff line number Diff line Loading @@ -455,8 +455,23 @@ public class BuzzBeepBlinkTest extends UiServiceTestCase { } @Test public void testNoBeepForImportanceDefaultInAutomotive() throws Exception { public void testNoBeepForAutomotiveIfEffectsDisabled() throws Exception { mService.setIsAutomotive(true); mService.setNotificationEffectsEnabledForAutomotive(false); NotificationRecord r = getBeepyNotification(); r.setSystemImportance(NotificationManager.IMPORTANCE_HIGH); mService.buzzBeepBlinkLocked(r); verifyNeverBeep(); assertFalse(r.isInterruptive()); } @Test public void testNoBeepForImportanceDefaultInAutomotiveIfEffectsEnabled() throws Exception { mService.setIsAutomotive(true); mService.setNotificationEffectsEnabledForAutomotive(true); NotificationRecord r = getBeepyNotification(); r.setSystemImportance(NotificationManager.IMPORTANCE_DEFAULT); Loading @@ -468,10 +483,12 @@ public class BuzzBeepBlinkTest extends UiServiceTestCase { } @Test public void testBeepForImportanceHighInAutomotive() throws Exception { public void testBeepForImportanceHighInAutomotiveIfEffectsEnabled() throws Exception { mService.setIsAutomotive(true); mService.setNotificationEffectsEnabledForAutomotive(true); NotificationRecord r = getBeepyNotification(); r.setSystemImportance(NotificationManager.IMPORTANCE_HIGH); mService.buzzBeepBlinkLocked(r); Loading