Loading packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java +25 −20 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.navigationbar.gestural; import static android.content.pm.ActivityInfo.CONFIG_FONT_SCALE; import static android.view.InputDevice.SOURCE_MOUSE; import static android.view.InputDevice.SOURCE_TOUCHPAD; import static android.view.MotionEvent.TOOL_TYPE_FINGER; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_EXCLUDE_FROM_SCREEN_MAGNIFICATION; import static com.android.systemui.Flags.edgebackGestureHandlerGetRunningTasksBackground; Loading Loading @@ -216,6 +217,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack private final int mDisplayId; private final UiThreadContext mUiThreadContext; private final Handler mBgHandler; private final Executor mBackgroundExecutor; private final Rect mPipExcludedBounds = new Rect(); Loading Loading @@ -378,11 +380,14 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack @Override public void onInputDeviceAdded(int deviceId) { if (isTrackpadDevice(deviceId)) { // This updates the gesture handler state and should be running on the main thread. mUiThreadContext.getHandler().post(() -> { boolean wasEmpty = mTrackpadsConnected.isEmpty(); mTrackpadsConnected.add(deviceId); if (wasEmpty) { update(); } }); } } Loading @@ -391,10 +396,13 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack @Override public void onInputDeviceRemoved(int deviceId) { // This updates the gesture handler state and should be running on the main thread. mUiThreadContext.getHandler().post(() -> { mTrackpadsConnected.remove(deviceId); if (mTrackpadsConnected.isEmpty()) { update(); } }); } private void update() { Loading @@ -408,12 +416,12 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack } private boolean isTrackpadDevice(int deviceId) { // This is a blocking binder call that should run on a bg thread. InputDevice inputDevice = mInputManager.getInputDevice(deviceId); if (inputDevice == null) { return false; } return inputDevice.getSources() == (InputDevice.SOURCE_MOUSE | InputDevice.SOURCE_TOUCHPAD); return inputDevice.getSources() == (SOURCE_MOUSE | SOURCE_TOUCHPAD); } }; Loading Loading @@ -457,6 +465,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack mDisplayId = context.getDisplayId(); mUiThreadContext = uiThreadContext; mBackgroundExecutor = backgroundExecutor; mBgHandler = bgHandler; mUserTracker = userTracker; mOverviewProxyService = overviewProxyService; mSysUiState = sysUiState; Loading Loading @@ -611,9 +620,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack mIsAttached = true; mOverviewProxyService.addCallback(mQuickSwitchListener); mSysUiState.addCallback(mSysUiStateCallback); mInputManager.registerInputDeviceListener( mInputDeviceListener, mUiThreadContext.getHandler()); mInputManager.registerInputDeviceListener(mInputDeviceListener, mBgHandler); int[] inputDevices = mInputManager.getInputDeviceIds(); for (int inputDeviceId : inputDevices) { mInputDeviceListener.onInputDeviceAdded(inputDeviceId); Loading Loading @@ -1202,10 +1209,8 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack } private boolean isButtonPressFromTrackpad(MotionEvent ev) { // We don't allow back for button press from the trackpad, and yet we do with a mouse. int sources = InputManager.getInstance().getInputDevice(ev.getDeviceId()).getSources(); int sourceTrackpad = (SOURCE_MOUSE | SOURCE_TOUCHPAD); return (sources & sourceTrackpad) == sourceTrackpad && ev.getButtonState() != 0; return ev.getSource() == (SOURCE_MOUSE | SOURCE_TOUCHPAD) && ev.getToolType(ev.getActionIndex()) == TOOL_TYPE_FINGER; } private void dispatchToBackAnimation(MotionEvent event) { Loading Loading
packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java +25 −20 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.navigationbar.gestural; import static android.content.pm.ActivityInfo.CONFIG_FONT_SCALE; import static android.view.InputDevice.SOURCE_MOUSE; import static android.view.InputDevice.SOURCE_TOUCHPAD; import static android.view.MotionEvent.TOOL_TYPE_FINGER; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_EXCLUDE_FROM_SCREEN_MAGNIFICATION; import static com.android.systemui.Flags.edgebackGestureHandlerGetRunningTasksBackground; Loading Loading @@ -216,6 +217,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack private final int mDisplayId; private final UiThreadContext mUiThreadContext; private final Handler mBgHandler; private final Executor mBackgroundExecutor; private final Rect mPipExcludedBounds = new Rect(); Loading Loading @@ -378,11 +380,14 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack @Override public void onInputDeviceAdded(int deviceId) { if (isTrackpadDevice(deviceId)) { // This updates the gesture handler state and should be running on the main thread. mUiThreadContext.getHandler().post(() -> { boolean wasEmpty = mTrackpadsConnected.isEmpty(); mTrackpadsConnected.add(deviceId); if (wasEmpty) { update(); } }); } } Loading @@ -391,10 +396,13 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack @Override public void onInputDeviceRemoved(int deviceId) { // This updates the gesture handler state and should be running on the main thread. mUiThreadContext.getHandler().post(() -> { mTrackpadsConnected.remove(deviceId); if (mTrackpadsConnected.isEmpty()) { update(); } }); } private void update() { Loading @@ -408,12 +416,12 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack } private boolean isTrackpadDevice(int deviceId) { // This is a blocking binder call that should run on a bg thread. InputDevice inputDevice = mInputManager.getInputDevice(deviceId); if (inputDevice == null) { return false; } return inputDevice.getSources() == (InputDevice.SOURCE_MOUSE | InputDevice.SOURCE_TOUCHPAD); return inputDevice.getSources() == (SOURCE_MOUSE | SOURCE_TOUCHPAD); } }; Loading Loading @@ -457,6 +465,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack mDisplayId = context.getDisplayId(); mUiThreadContext = uiThreadContext; mBackgroundExecutor = backgroundExecutor; mBgHandler = bgHandler; mUserTracker = userTracker; mOverviewProxyService = overviewProxyService; mSysUiState = sysUiState; Loading Loading @@ -611,9 +620,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack mIsAttached = true; mOverviewProxyService.addCallback(mQuickSwitchListener); mSysUiState.addCallback(mSysUiStateCallback); mInputManager.registerInputDeviceListener( mInputDeviceListener, mUiThreadContext.getHandler()); mInputManager.registerInputDeviceListener(mInputDeviceListener, mBgHandler); int[] inputDevices = mInputManager.getInputDeviceIds(); for (int inputDeviceId : inputDevices) { mInputDeviceListener.onInputDeviceAdded(inputDeviceId); Loading Loading @@ -1202,10 +1209,8 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack } private boolean isButtonPressFromTrackpad(MotionEvent ev) { // We don't allow back for button press from the trackpad, and yet we do with a mouse. int sources = InputManager.getInstance().getInputDevice(ev.getDeviceId()).getSources(); int sourceTrackpad = (SOURCE_MOUSE | SOURCE_TOUCHPAD); return (sources & sourceTrackpad) == sourceTrackpad && ev.getButtonState() != 0; return ev.getSource() == (SOURCE_MOUSE | SOURCE_TOUCHPAD) && ev.getToolType(ev.getActionIndex()) == TOOL_TYPE_FINGER; } private void dispatchToBackAnimation(MotionEvent event) { Loading