Loading src/com/android/settings/accessibility/FlashNotificationsPreviewPreferenceController.java +2 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.database.ContentObserver; import android.net.Uri; import android.os.Handler; import android.os.Looper; import android.os.UserHandle; import android.provider.Settings; import androidx.annotation.NonNull; Loading Loading @@ -81,7 +82,7 @@ public class FlashNotificationsPreviewPreferenceController extends if (getPreferenceKey().equals(preference.getKey())) { Intent intent = new Intent(ACTION_FLASH_NOTIFICATION_START_PREVIEW); intent.putExtra(EXTRA_FLASH_NOTIFICATION_PREVIEW_TYPE, TYPE_SHORT_PREVIEW); mContext.sendBroadcast(intent); mContext.sendBroadcastAsUser(intent, UserHandle.SYSTEM); return true; } Loading src/com/android/settings/accessibility/ScreenFlashNotificationColorDialogFragment.java +4 −2 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.app.Dialog; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.os.UserHandle; import android.view.View; import androidx.annotation.ColorInt; Loading @@ -41,6 +42,7 @@ import java.util.Timer; import java.util.TimerTask; import java.util.function.Consumer; /** * DialogFragment for Screen flash notification color picker. */ Loading Loading @@ -166,14 +168,14 @@ public class ScreenFlashNotificationColorDialogFragment extends DialogFragment i Intent intent = new Intent(ACTION_FLASH_NOTIFICATION_START_PREVIEW); intent.putExtra(EXTRA_FLASH_NOTIFICATION_PREVIEW_TYPE, TYPE_LONG_PREVIEW); intent.putExtra(EXTRA_FLASH_NOTIFICATION_PREVIEW_COLOR, mCurrentColor); getContext().sendBroadcast(intent); getContext().sendBroadcastAsUser(intent, UserHandle.SYSTEM); } private void stopPreviewLocked() { if (getContext() == null) return; Intent stopIntent = new Intent(ACTION_FLASH_NOTIFICATION_STOP_PREVIEW); getContext().sendBroadcast(stopIntent); getContext().sendBroadcastAsUser(stopIntent, UserHandle.SYSTEM); mIsPreview = false; } Loading tests/robotests/src/com/android/settings/accessibility/FlashNotificationsPreviewPreferenceControllerTest.java +3 −3 Original line number Diff line number Diff line Loading @@ -131,7 +131,7 @@ public class FlashNotificationsPreviewPreferenceControllerTest { @Test public void testHandlePreferenceTreeClick_invalidPreference() { mController.handlePreferenceTreeClick(mock(Preference.class)); verify(mContext, never()).sendBroadcast(any()); verify(mContext, never()).sendBroadcastAsUser(any(), any()); } @Test Loading @@ -139,7 +139,7 @@ public class FlashNotificationsPreviewPreferenceControllerTest { mController.handlePreferenceTreeClick(mPreference); ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class); verify(mContext).sendBroadcast(captor.capture()); verify(mContext).sendBroadcastAsUser(captor.capture(), any()); Intent captured = captor.getValue(); assertThat(captured.getAction()).isEqualTo(ACTION_FLASH_NOTIFICATION_START_PREVIEW); Loading @@ -150,7 +150,7 @@ public class FlashNotificationsPreviewPreferenceControllerTest { mController.handlePreferenceTreeClick(mPreference); ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class); verify(mContext).sendBroadcast(captor.capture()); verify(mContext).sendBroadcastAsUser(captor.capture(), any()); Intent captured = captor.getValue(); assertThat(captured.getIntExtra(EXTRA_FLASH_NOTIFICATION_PREVIEW_TYPE, TYPE_LONG_PREVIEW)) Loading Loading
src/com/android/settings/accessibility/FlashNotificationsPreviewPreferenceController.java +2 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.database.ContentObserver; import android.net.Uri; import android.os.Handler; import android.os.Looper; import android.os.UserHandle; import android.provider.Settings; import androidx.annotation.NonNull; Loading Loading @@ -81,7 +82,7 @@ public class FlashNotificationsPreviewPreferenceController extends if (getPreferenceKey().equals(preference.getKey())) { Intent intent = new Intent(ACTION_FLASH_NOTIFICATION_START_PREVIEW); intent.putExtra(EXTRA_FLASH_NOTIFICATION_PREVIEW_TYPE, TYPE_SHORT_PREVIEW); mContext.sendBroadcast(intent); mContext.sendBroadcastAsUser(intent, UserHandle.SYSTEM); return true; } Loading
src/com/android/settings/accessibility/ScreenFlashNotificationColorDialogFragment.java +4 −2 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.app.Dialog; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.os.UserHandle; import android.view.View; import androidx.annotation.ColorInt; Loading @@ -41,6 +42,7 @@ import java.util.Timer; import java.util.TimerTask; import java.util.function.Consumer; /** * DialogFragment for Screen flash notification color picker. */ Loading Loading @@ -166,14 +168,14 @@ public class ScreenFlashNotificationColorDialogFragment extends DialogFragment i Intent intent = new Intent(ACTION_FLASH_NOTIFICATION_START_PREVIEW); intent.putExtra(EXTRA_FLASH_NOTIFICATION_PREVIEW_TYPE, TYPE_LONG_PREVIEW); intent.putExtra(EXTRA_FLASH_NOTIFICATION_PREVIEW_COLOR, mCurrentColor); getContext().sendBroadcast(intent); getContext().sendBroadcastAsUser(intent, UserHandle.SYSTEM); } private void stopPreviewLocked() { if (getContext() == null) return; Intent stopIntent = new Intent(ACTION_FLASH_NOTIFICATION_STOP_PREVIEW); getContext().sendBroadcast(stopIntent); getContext().sendBroadcastAsUser(stopIntent, UserHandle.SYSTEM); mIsPreview = false; } Loading
tests/robotests/src/com/android/settings/accessibility/FlashNotificationsPreviewPreferenceControllerTest.java +3 −3 Original line number Diff line number Diff line Loading @@ -131,7 +131,7 @@ public class FlashNotificationsPreviewPreferenceControllerTest { @Test public void testHandlePreferenceTreeClick_invalidPreference() { mController.handlePreferenceTreeClick(mock(Preference.class)); verify(mContext, never()).sendBroadcast(any()); verify(mContext, never()).sendBroadcastAsUser(any(), any()); } @Test Loading @@ -139,7 +139,7 @@ public class FlashNotificationsPreviewPreferenceControllerTest { mController.handlePreferenceTreeClick(mPreference); ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class); verify(mContext).sendBroadcast(captor.capture()); verify(mContext).sendBroadcastAsUser(captor.capture(), any()); Intent captured = captor.getValue(); assertThat(captured.getAction()).isEqualTo(ACTION_FLASH_NOTIFICATION_START_PREVIEW); Loading @@ -150,7 +150,7 @@ public class FlashNotificationsPreviewPreferenceControllerTest { mController.handlePreferenceTreeClick(mPreference); ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class); verify(mContext).sendBroadcast(captor.capture()); verify(mContext).sendBroadcastAsUser(captor.capture(), any()); Intent captured = captor.getValue(); assertThat(captured.getIntExtra(EXTRA_FLASH_NOTIFICATION_PREVIEW_TYPE, TYPE_LONG_PREVIEW)) Loading