Loading packages/SystemUI/shared/src/com/android/systemui/shared/system/InputConsumerController.java +11 −12 Original line number Diff line number Diff line Loading @@ -27,26 +27,26 @@ import android.os.RemoteException; import android.util.Log; import android.view.BatchedInputEventReceiver; import android.view.Choreographer; import android.view.IWindowManager; import android.view.InputChannel; import android.view.InputEvent; import android.view.IWindowManager; import android.view.MotionEvent; import android.view.WindowManagerGlobal; import java.io.PrintWriter; /** * Manages the input consumer that allows the SystemUI to directly receive touch input. * Manages the input consumer that allows the SystemUI to directly receive input. */ public class InputConsumerController { private static final String TAG = InputConsumerController.class.getSimpleName(); /** * Listener interface for callers to subscribe to touch events. * Listener interface for callers to subscribe to input events. */ public interface TouchListener { boolean onTouchEvent(MotionEvent ev); public interface InputListener { /** Handles any input event. */ boolean onInputEvent(InputEvent ev); } /** Loading @@ -71,9 +71,8 @@ public class InputConsumerController { public void onInputEvent(InputEvent event) { boolean handled = true; try { if (mListener != null && event instanceof MotionEvent) { MotionEvent ev = (MotionEvent) event; handled = mListener.onTouchEvent(ev); if (mListener != null) { handled = mListener.onInputEvent(event); } } finally { finishInputEvent(event, handled); Loading @@ -86,7 +85,7 @@ public class InputConsumerController { private final String mName; private InputEventReceiver mInputEventReceiver; private TouchListener mListener; private InputListener mListener; private RegistrationListener mRegistrationListener; /** Loading Loading @@ -115,9 +114,9 @@ public class InputConsumerController { } /** * Sets the touch listener. * Sets the input listener. */ public void setTouchListener(TouchListener listener) { public void setInputListener(InputListener listener) { mListener = listener; } Loading packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java +8 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import android.os.RemoteException; import android.util.Log; import android.util.Size; import android.view.IPinnedStackController; import android.view.InputEvent; import android.view.MotionEvent; import android.view.ViewConfiguration; import android.view.accessibility.AccessibilityEvent; Loading Loading @@ -206,7 +207,7 @@ public class PipTouchHandler { mEnableDimissDragToEdge = res.getBoolean(R.bool.config_pipEnableDismissDragToEdge); // Register the listener for input consumer touch events inputConsumerController.setTouchListener(this::handleTouchEvent); inputConsumerController.setInputListener(this::handleTouchEvent); inputConsumerController.setRegistrationListener(this::onRegistrationChanged); onRegistrationChanged(inputConsumerController.isRegistered()); } Loading Loading @@ -370,11 +371,16 @@ public class PipTouchHandler { mMovementBounds, true /* allowMenuTimeout */, willResizeMenu()); } private boolean handleTouchEvent(MotionEvent ev) { private boolean handleTouchEvent(InputEvent inputEvent) { // Skip any non motion events if (!(inputEvent instanceof MotionEvent)) { return true; } // Skip touch handling until we are bound to the controller if (mPinnedStackController == null) { return true; } MotionEvent ev = (MotionEvent) inputEvent; // Update the touch state mTouchState.onTouchEvent(ev); Loading Loading
packages/SystemUI/shared/src/com/android/systemui/shared/system/InputConsumerController.java +11 −12 Original line number Diff line number Diff line Loading @@ -27,26 +27,26 @@ import android.os.RemoteException; import android.util.Log; import android.view.BatchedInputEventReceiver; import android.view.Choreographer; import android.view.IWindowManager; import android.view.InputChannel; import android.view.InputEvent; import android.view.IWindowManager; import android.view.MotionEvent; import android.view.WindowManagerGlobal; import java.io.PrintWriter; /** * Manages the input consumer that allows the SystemUI to directly receive touch input. * Manages the input consumer that allows the SystemUI to directly receive input. */ public class InputConsumerController { private static final String TAG = InputConsumerController.class.getSimpleName(); /** * Listener interface for callers to subscribe to touch events. * Listener interface for callers to subscribe to input events. */ public interface TouchListener { boolean onTouchEvent(MotionEvent ev); public interface InputListener { /** Handles any input event. */ boolean onInputEvent(InputEvent ev); } /** Loading @@ -71,9 +71,8 @@ public class InputConsumerController { public void onInputEvent(InputEvent event) { boolean handled = true; try { if (mListener != null && event instanceof MotionEvent) { MotionEvent ev = (MotionEvent) event; handled = mListener.onTouchEvent(ev); if (mListener != null) { handled = mListener.onInputEvent(event); } } finally { finishInputEvent(event, handled); Loading @@ -86,7 +85,7 @@ public class InputConsumerController { private final String mName; private InputEventReceiver mInputEventReceiver; private TouchListener mListener; private InputListener mListener; private RegistrationListener mRegistrationListener; /** Loading Loading @@ -115,9 +114,9 @@ public class InputConsumerController { } /** * Sets the touch listener. * Sets the input listener. */ public void setTouchListener(TouchListener listener) { public void setInputListener(InputListener listener) { mListener = listener; } Loading
packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java +8 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import android.os.RemoteException; import android.util.Log; import android.util.Size; import android.view.IPinnedStackController; import android.view.InputEvent; import android.view.MotionEvent; import android.view.ViewConfiguration; import android.view.accessibility.AccessibilityEvent; Loading Loading @@ -206,7 +207,7 @@ public class PipTouchHandler { mEnableDimissDragToEdge = res.getBoolean(R.bool.config_pipEnableDismissDragToEdge); // Register the listener for input consumer touch events inputConsumerController.setTouchListener(this::handleTouchEvent); inputConsumerController.setInputListener(this::handleTouchEvent); inputConsumerController.setRegistrationListener(this::onRegistrationChanged); onRegistrationChanged(inputConsumerController.isRegistered()); } Loading Loading @@ -370,11 +371,16 @@ public class PipTouchHandler { mMovementBounds, true /* allowMenuTimeout */, willResizeMenu()); } private boolean handleTouchEvent(MotionEvent ev) { private boolean handleTouchEvent(InputEvent inputEvent) { // Skip any non motion events if (!(inputEvent instanceof MotionEvent)) { return true; } // Skip touch handling until we are bound to the controller if (mPinnedStackController == null) { return true; } MotionEvent ev = (MotionEvent) inputEvent; // Update the touch state mTouchState.onTouchEvent(ev); Loading