Loading packages/SystemUI/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetector.kt +1 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ constructor( private fun onPanelExpansionChanged(event: ShadeExpansionChangeEvent) = mainExecutor.execute { action?.let { if (event.tracking) { if (event.tracking || event.expanded) { Log.v(TAG, "Detected panel interaction, event: $event") it.onPanelInteraction.run() disable() Loading packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetectorTest.kt +19 −5 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito.timeout import org.mockito.Mockito.times import org.mockito.Mockito.verify import org.mockito.Mockito.verifyZeroInteractions import org.mockito.junit.MockitoJUnit Loading @@ -49,17 +49,31 @@ class AuthDialogPanelInteractionDetectorTest : SysuiTestCase() { } @Test fun testEnableDetector_shouldPostRunnable() { fun testEnableDetector_expandWithTrack_shouldPostRunnable() { detector.enable(action) // simulate notification expand shadeExpansionStateManager.onPanelExpansionChanged(5566f, true, true, 5566f) verify(action, timeout(5000).times(1)).run() verify(action).run() } @Test fun testEnableDetector_trackOnly_shouldPostRunnable() { detector.enable(action) // simulate notification expand shadeExpansionStateManager.onPanelExpansionChanged(5566f, false, true, 5566f) verify(action).run() } @Test fun testEnableDetector_expandOnly_shouldPostRunnable() { detector.enable(action) // simulate notification expand shadeExpansionStateManager.onPanelExpansionChanged(5566f, true, false, 5566f) verify(action).run() } @Test fun testEnableDetector_shouldNotPostRunnable() { var detector = AuthDialogPanelInteractionDetector(shadeExpansionStateManager, mContext.mainExecutor) detector.enable(action) detector.disable() shadeExpansionStateManager.onPanelExpansionChanged(5566f, true, true, 5566f) Loading Loading
packages/SystemUI/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetector.kt +1 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ constructor( private fun onPanelExpansionChanged(event: ShadeExpansionChangeEvent) = mainExecutor.execute { action?.let { if (event.tracking) { if (event.tracking || event.expanded) { Log.v(TAG, "Detected panel interaction, event: $event") it.onPanelInteraction.run() disable() Loading
packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetectorTest.kt +19 −5 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito.timeout import org.mockito.Mockito.times import org.mockito.Mockito.verify import org.mockito.Mockito.verifyZeroInteractions import org.mockito.junit.MockitoJUnit Loading @@ -49,17 +49,31 @@ class AuthDialogPanelInteractionDetectorTest : SysuiTestCase() { } @Test fun testEnableDetector_shouldPostRunnable() { fun testEnableDetector_expandWithTrack_shouldPostRunnable() { detector.enable(action) // simulate notification expand shadeExpansionStateManager.onPanelExpansionChanged(5566f, true, true, 5566f) verify(action, timeout(5000).times(1)).run() verify(action).run() } @Test fun testEnableDetector_trackOnly_shouldPostRunnable() { detector.enable(action) // simulate notification expand shadeExpansionStateManager.onPanelExpansionChanged(5566f, false, true, 5566f) verify(action).run() } @Test fun testEnableDetector_expandOnly_shouldPostRunnable() { detector.enable(action) // simulate notification expand shadeExpansionStateManager.onPanelExpansionChanged(5566f, true, false, 5566f) verify(action).run() } @Test fun testEnableDetector_shouldNotPostRunnable() { var detector = AuthDialogPanelInteractionDetector(shadeExpansionStateManager, mContext.mainExecutor) detector.enable(action) detector.disable() shadeExpansionStateManager.onPanelExpansionChanged(5566f, true, true, 5566f) Loading