Loading packages/SystemUI/src/com/android/systemui/dreams/touch/DreamOverlayTouchMonitor.java +9 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import com.google.common.util.concurrent.ListenableFuture; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import java.util.concurrent.Executor; import java.util.function.Consumer; Loading Loading @@ -195,7 +196,14 @@ public class DreamOverlayTouchMonitor { * Called by the monitor when this session is removed. */ private void onRemoved() { mCallbacks.forEach(callback -> callback.onRemoved()); mEventListeners.clear(); mGestureListeners.clear(); final Iterator<Callback> iter = mCallbacks.iterator(); while (iter.hasNext()) { final Callback callback = iter.next(); callback.onRemoved(); iter.remove(); } } @Override Loading packages/SystemUI/tests/src/com/android/systemui/dreams/touch/DreamOverlayTouchMonitorTest.java +24 −0 Original line number Diff line number Diff line Loading @@ -268,6 +268,30 @@ public class DreamOverlayTouchMonitorTest extends SysuiTestCase { verify(eventListener).onInputEvent(eq(event)); } @Test public void testInputEventPropagationAfterRemoval() { final DreamTouchHandler touchHandler = Mockito.mock(DreamTouchHandler.class); final Environment environment = new Environment(Stream.of(touchHandler) .collect(Collectors.toCollection(HashSet::new))); final InputEvent initialEvent = Mockito.mock(InputEvent.class); environment.publishInputEvent(initialEvent); // Ensure session started final DreamTouchHandler.TouchSession session = captureSession(touchHandler); final InputChannelCompat.InputEventListener eventListener = registerInputEventListener(session); session.pop(); environment.executeAll(); final InputEvent event = Mockito.mock(InputEvent.class); environment.publishInputEvent(event); verify(eventListener, never()).onInputEvent(eq(event)); } @Test public void testInputGesturePropagation() { final DreamTouchHandler touchHandler = Mockito.mock(DreamTouchHandler.class); Loading Loading
packages/SystemUI/src/com/android/systemui/dreams/touch/DreamOverlayTouchMonitor.java +9 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import com.google.common.util.concurrent.ListenableFuture; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import java.util.concurrent.Executor; import java.util.function.Consumer; Loading Loading @@ -195,7 +196,14 @@ public class DreamOverlayTouchMonitor { * Called by the monitor when this session is removed. */ private void onRemoved() { mCallbacks.forEach(callback -> callback.onRemoved()); mEventListeners.clear(); mGestureListeners.clear(); final Iterator<Callback> iter = mCallbacks.iterator(); while (iter.hasNext()) { final Callback callback = iter.next(); callback.onRemoved(); iter.remove(); } } @Override Loading
packages/SystemUI/tests/src/com/android/systemui/dreams/touch/DreamOverlayTouchMonitorTest.java +24 −0 Original line number Diff line number Diff line Loading @@ -268,6 +268,30 @@ public class DreamOverlayTouchMonitorTest extends SysuiTestCase { verify(eventListener).onInputEvent(eq(event)); } @Test public void testInputEventPropagationAfterRemoval() { final DreamTouchHandler touchHandler = Mockito.mock(DreamTouchHandler.class); final Environment environment = new Environment(Stream.of(touchHandler) .collect(Collectors.toCollection(HashSet::new))); final InputEvent initialEvent = Mockito.mock(InputEvent.class); environment.publishInputEvent(initialEvent); // Ensure session started final DreamTouchHandler.TouchSession session = captureSession(touchHandler); final InputChannelCompat.InputEventListener eventListener = registerInputEventListener(session); session.pop(); environment.executeAll(); final InputEvent event = Mockito.mock(InputEvent.class); environment.publishInputEvent(event); verify(eventListener, never()).onInputEvent(eq(event)); } @Test public void testInputGesturePropagation() { final DreamTouchHandler touchHandler = Mockito.mock(DreamTouchHandler.class); Loading