diff --git a/packages/SystemUI/src/com/android/systemui/dreams/touch/ShadeTouchHandler.java b/packages/SystemUI/src/com/android/systemui/dreams/touch/ShadeTouchHandler.java index 99451f2ee1b96..6f05e83b22baa 100644 --- a/packages/SystemUI/src/com/android/systemui/dreams/touch/ShadeTouchHandler.java +++ b/packages/SystemUI/src/com/android/systemui/dreams/touch/ShadeTouchHandler.java @@ -37,12 +37,15 @@ import javax.inject.Named; */ public class ShadeTouchHandler implements DreamTouchHandler { private final Optional mSurfaces; + private final ShadeViewController mShadeViewController; private final int mInitiationHeight; @Inject ShadeTouchHandler(Optional centralSurfaces, + ShadeViewController shadeViewController, @Named(NOTIFICATION_SHADE_GESTURE_INITIATION_HEIGHT) int initiationHeight) { mSurfaces = centralSurfaces; + mShadeViewController = shadeViewController; mInitiationHeight = initiationHeight; } @@ -54,12 +57,7 @@ public class ShadeTouchHandler implements DreamTouchHandler { } session.registerInputListener(ev -> { - final ShadeViewController viewController = - mSurfaces.map(CentralSurfaces::getShadeViewController).orElse(null); - - if (viewController != null) { - viewController.handleExternalTouch((MotionEvent) ev); - } + mShadeViewController.handleExternalTouch((MotionEvent) ev); if (ev instanceof MotionEvent) { if (((MotionEvent) ev).getAction() == MotionEvent.ACTION_UP) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/dreams/touch/ShadeTouchHandlerTest.java b/packages/SystemUI/tests/src/com/android/systemui/dreams/touch/ShadeTouchHandlerTest.java index 872c0794ce646..2b9821406feaa 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/dreams/touch/ShadeTouchHandlerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/dreams/touch/ShadeTouchHandlerTest.java @@ -61,10 +61,8 @@ public class ShadeTouchHandlerTest extends SysuiTestCase { @Before public void setup() { MockitoAnnotations.initMocks(this); - mTouchHandler = new ShadeTouchHandler(Optional.of(mCentralSurfaces), + mTouchHandler = new ShadeTouchHandler(Optional.of(mCentralSurfaces), mShadeViewController, TOUCH_HEIGHT); - when(mCentralSurfaces.getShadeViewController()) - .thenReturn(mShadeViewController); } /**