Loading packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java +8 −5 Original line number Diff line number Diff line Loading @@ -362,12 +362,15 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa private boolean shouldShowUI(int flags) { updateStatusBar(); return mStatusBar != null && mStatusBar.getWakefulnessState() != WakefulnessLifecycle.WAKEFULNESS_ASLEEP && mStatusBar.getWakefulnessState() != WakefulnessLifecycle.WAKEFULNESS_GOING_TO_SLEEP // if status bar isn't null, check if phone is in AOD, else check flags // since we could be using a different status bar return mStatusBar != null ? mStatusBar.getWakefulnessState() != WakefulnessLifecycle.WAKEFULNESS_ASLEEP && mStatusBar.getWakefulnessState() != WakefulnessLifecycle.WAKEFULNESS_GOING_TO_SLEEP && mStatusBar.isDeviceInteractive() && (flags & AudioManager.FLAG_SHOW_UI) != 0 && mShowVolumeDialog; && (flags & AudioManager.FLAG_SHOW_UI) != 0 && mShowVolumeDialog : mShowVolumeDialog && (flags & AudioManager.FLAG_SHOW_UI) != 0; } boolean onVolumeChangedW(int stream, int flags) { Loading packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogControllerImplTest.java +10 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,16 @@ public class VolumeDialogControllerImplTest extends SysuiTestCase { verify(mCallback, times(1)).onShowRequested(Events.SHOW_REASON_VOLUME_CHANGED); } @Test public void testVolumeChangeW_nullStatusBar() { VolumeDialogControllerImpl.C callback = mock(VolumeDialogControllerImpl.C.class); TestableVolumeDialogControllerImpl nullStatusBarTestableDialog = new TestableVolumeDialogControllerImpl(mContext, callback, null); nullStatusBarTestableDialog.setEnableDialogs(true, true); nullStatusBarTestableDialog.onVolumeChangedW(0, AudioManager.FLAG_SHOW_UI); verify(callback, times(1)).onShowRequested(Events.SHOW_REASON_VOLUME_CHANGED); } @Test public void testOnRemoteVolumeChanged_newStream_noNullPointer() { MediaSession.Token token = new MediaSession.Token(null); Loading Loading
packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java +8 −5 Original line number Diff line number Diff line Loading @@ -362,12 +362,15 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa private boolean shouldShowUI(int flags) { updateStatusBar(); return mStatusBar != null && mStatusBar.getWakefulnessState() != WakefulnessLifecycle.WAKEFULNESS_ASLEEP && mStatusBar.getWakefulnessState() != WakefulnessLifecycle.WAKEFULNESS_GOING_TO_SLEEP // if status bar isn't null, check if phone is in AOD, else check flags // since we could be using a different status bar return mStatusBar != null ? mStatusBar.getWakefulnessState() != WakefulnessLifecycle.WAKEFULNESS_ASLEEP && mStatusBar.getWakefulnessState() != WakefulnessLifecycle.WAKEFULNESS_GOING_TO_SLEEP && mStatusBar.isDeviceInteractive() && (flags & AudioManager.FLAG_SHOW_UI) != 0 && mShowVolumeDialog; && (flags & AudioManager.FLAG_SHOW_UI) != 0 && mShowVolumeDialog : mShowVolumeDialog && (flags & AudioManager.FLAG_SHOW_UI) != 0; } boolean onVolumeChangedW(int stream, int flags) { Loading
packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogControllerImplTest.java +10 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,16 @@ public class VolumeDialogControllerImplTest extends SysuiTestCase { verify(mCallback, times(1)).onShowRequested(Events.SHOW_REASON_VOLUME_CHANGED); } @Test public void testVolumeChangeW_nullStatusBar() { VolumeDialogControllerImpl.C callback = mock(VolumeDialogControllerImpl.C.class); TestableVolumeDialogControllerImpl nullStatusBarTestableDialog = new TestableVolumeDialogControllerImpl(mContext, callback, null); nullStatusBarTestableDialog.setEnableDialogs(true, true); nullStatusBarTestableDialog.onVolumeChangedW(0, AudioManager.FLAG_SHOW_UI); verify(callback, times(1)).onShowRequested(Events.SHOW_REASON_VOLUME_CHANGED); } @Test public void testOnRemoteVolumeChanged_newStream_noNullPointer() { MediaSession.Token token = new MediaSession.Token(null); Loading