Loading core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -533,6 +533,9 @@ <!-- If this is true, key chords can be used to take a screenshot on the device. --> <bool name="config_enableScreenshotChord">true</bool> <!-- If this is true, accessibility events on notifications are sent. --> <bool name="config_enableNotificationAccessibilityEvents">true</bool> <!-- If this is true, allow wake from theater mode when plugged in or unplugged. --> <bool name="config_allowTheaterModeWakeFromUnplug">false</bool> <!-- If this is true, allow wake from theater mode from gesture. --> Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -2006,6 +2006,7 @@ <java-symbol type="array" name="config_notificationFallbackVibeWaveform" /> <java-symbol type="bool" name="config_enableServerNotificationEffectsForAutomotive" /> <java-symbol type="bool" name="config_useAttentionLight" /> <java-symbol type="bool" name="config_enableNotificationAccessibilityEvents" /> <java-symbol type="bool" name="config_adaptive_sleep_available" /> <java-symbol type="bool" name="config_camera_autorotate"/> <java-symbol type="bool" name="config_animateScreenLights" /> Loading services/core/java/com/android/server/notification/NotificationAttentionHelper.java +5 −1 Original line number Diff line number Diff line Loading @@ -138,6 +138,7 @@ public final class NotificationAttentionHelper { private final boolean mUseAttentionLight; boolean mHasLight; private final boolean mEnableNotificationAccessibilityEvents; private final SettingsObserver mSettingsObserver; Loading Loading @@ -190,6 +191,9 @@ public final class NotificationAttentionHelper { mUseAttentionLight = resources.getBoolean(R.bool.config_useAttentionLight); mHasLight = resources.getBoolean(com.android.internal.R.bool.config_intrusiveNotificationLed); mEnableNotificationAccessibilityEvents = resources.getBoolean( com.android.internal.R.bool.config_enableNotificationAccessibilityEvents); // Don't start allowing notifications until the setup wizard has run once. // After that, including subsequent boots, init with notifications turned on. Loading Loading @@ -1030,7 +1034,7 @@ public final class NotificationAttentionHelper { } void sendAccessibilityEvent(NotificationRecord record) { if (!mAccessibilityManager.isEnabled()) { if (!mAccessibilityManager.isEnabled() || !mEnableNotificationAccessibilityEvents) { return; } Loading services/tests/uiservicestests/src/com/android/server/notification/NotificationAttentionHelperTest.java +30 −0 Original line number Diff line number Diff line Loading @@ -227,6 +227,8 @@ public class NotificationAttentionHelperTest extends UiServiceTestCase { when(resources.getBoolean(R.bool.config_useAttentionLight)).thenReturn(true); when(resources.getBoolean( com.android.internal.R.bool.config_intrusiveNotificationLed)).thenReturn(true); when(resources.getBoolean(R.bool.config_enableNotificationAccessibilityEvents)) .thenReturn(true); when(getContext().getResources()).thenReturn(resources); // TODO (b/291907312): remove feature flag Loading Loading @@ -2830,6 +2832,34 @@ public class NotificationAttentionHelperTest extends UiServiceTestCase { assertThat(r.getRankingTimeMs()).isEqualTo(r.getSbn().getPostTime()); } @Test public void testAccessibilityEventsEnabledInConfig() throws Exception { Resources resources = spy(getContext().getResources()); when(resources.getBoolean(R.bool.config_enableNotificationAccessibilityEvents)) .thenReturn(true); when(getContext().getResources()).thenReturn(resources); initAttentionHelper(mTestFlagResolver); NotificationRecord r = getBeepyNotification(); mAttentionHelper.buzzBeepBlinkLocked(r, DEFAULT_SIGNALS); verify(mAccessibilityService).sendAccessibilityEvent(any(), anyInt()); } @Test public void testAccessibilityEventsDisabledInConfig() throws Exception { Resources resources = spy(getContext().getResources()); when(resources.getBoolean(R.bool.config_enableNotificationAccessibilityEvents)) .thenReturn(false); when(getContext().getResources()).thenReturn(resources); initAttentionHelper(mTestFlagResolver); NotificationRecord r = getBeepyNotification(); mAttentionHelper.buzzBeepBlinkLocked(r, DEFAULT_SIGNALS); verify(mAccessibilityService, never()).sendAccessibilityEvent(any(), anyInt()); } static class VibrateRepeatMatcher implements ArgumentMatcher<VibrationEffect> { private final int mRepeatIndex; Loading Loading
core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -533,6 +533,9 @@ <!-- If this is true, key chords can be used to take a screenshot on the device. --> <bool name="config_enableScreenshotChord">true</bool> <!-- If this is true, accessibility events on notifications are sent. --> <bool name="config_enableNotificationAccessibilityEvents">true</bool> <!-- If this is true, allow wake from theater mode when plugged in or unplugged. --> <bool name="config_allowTheaterModeWakeFromUnplug">false</bool> <!-- If this is true, allow wake from theater mode from gesture. --> Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -2006,6 +2006,7 @@ <java-symbol type="array" name="config_notificationFallbackVibeWaveform" /> <java-symbol type="bool" name="config_enableServerNotificationEffectsForAutomotive" /> <java-symbol type="bool" name="config_useAttentionLight" /> <java-symbol type="bool" name="config_enableNotificationAccessibilityEvents" /> <java-symbol type="bool" name="config_adaptive_sleep_available" /> <java-symbol type="bool" name="config_camera_autorotate"/> <java-symbol type="bool" name="config_animateScreenLights" /> Loading
services/core/java/com/android/server/notification/NotificationAttentionHelper.java +5 −1 Original line number Diff line number Diff line Loading @@ -138,6 +138,7 @@ public final class NotificationAttentionHelper { private final boolean mUseAttentionLight; boolean mHasLight; private final boolean mEnableNotificationAccessibilityEvents; private final SettingsObserver mSettingsObserver; Loading Loading @@ -190,6 +191,9 @@ public final class NotificationAttentionHelper { mUseAttentionLight = resources.getBoolean(R.bool.config_useAttentionLight); mHasLight = resources.getBoolean(com.android.internal.R.bool.config_intrusiveNotificationLed); mEnableNotificationAccessibilityEvents = resources.getBoolean( com.android.internal.R.bool.config_enableNotificationAccessibilityEvents); // Don't start allowing notifications until the setup wizard has run once. // After that, including subsequent boots, init with notifications turned on. Loading Loading @@ -1030,7 +1034,7 @@ public final class NotificationAttentionHelper { } void sendAccessibilityEvent(NotificationRecord record) { if (!mAccessibilityManager.isEnabled()) { if (!mAccessibilityManager.isEnabled() || !mEnableNotificationAccessibilityEvents) { return; } Loading
services/tests/uiservicestests/src/com/android/server/notification/NotificationAttentionHelperTest.java +30 −0 Original line number Diff line number Diff line Loading @@ -227,6 +227,8 @@ public class NotificationAttentionHelperTest extends UiServiceTestCase { when(resources.getBoolean(R.bool.config_useAttentionLight)).thenReturn(true); when(resources.getBoolean( com.android.internal.R.bool.config_intrusiveNotificationLed)).thenReturn(true); when(resources.getBoolean(R.bool.config_enableNotificationAccessibilityEvents)) .thenReturn(true); when(getContext().getResources()).thenReturn(resources); // TODO (b/291907312): remove feature flag Loading Loading @@ -2830,6 +2832,34 @@ public class NotificationAttentionHelperTest extends UiServiceTestCase { assertThat(r.getRankingTimeMs()).isEqualTo(r.getSbn().getPostTime()); } @Test public void testAccessibilityEventsEnabledInConfig() throws Exception { Resources resources = spy(getContext().getResources()); when(resources.getBoolean(R.bool.config_enableNotificationAccessibilityEvents)) .thenReturn(true); when(getContext().getResources()).thenReturn(resources); initAttentionHelper(mTestFlagResolver); NotificationRecord r = getBeepyNotification(); mAttentionHelper.buzzBeepBlinkLocked(r, DEFAULT_SIGNALS); verify(mAccessibilityService).sendAccessibilityEvent(any(), anyInt()); } @Test public void testAccessibilityEventsDisabledInConfig() throws Exception { Resources resources = spy(getContext().getResources()); when(resources.getBoolean(R.bool.config_enableNotificationAccessibilityEvents)) .thenReturn(false); when(getContext().getResources()).thenReturn(resources); initAttentionHelper(mTestFlagResolver); NotificationRecord r = getBeepyNotification(); mAttentionHelper.buzzBeepBlinkLocked(r, DEFAULT_SIGNALS); verify(mAccessibilityService, never()).sendAccessibilityEvent(any(), anyInt()); } static class VibrateRepeatMatcher implements ArgumentMatcher<VibrationEffect> { private final int mRepeatIndex; Loading