From 06db41a823c7b3929f82ddc166f3d500e8ae6e85 Mon Sep 17 00:00:00 2001 From: Justin Weir Date: Mon, 17 Jul 2023 16:32:50 -0400 Subject: [PATCH] Remove getShadeViewController calls Bug: 288868098 Test: updated and ran affected test Change-Id: I5b10c8f05749afea3a1ca0b43b3f6cefd0aa71e0 --- .../systemui/dreams/touch/ShadeTouchHandler.java | 10 ++++------ .../systemui/dreams/touch/ShadeTouchHandlerTest.java | 4 +--- 2 files changed, 5 insertions(+), 9 deletions(-) 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); } /**