Merge "Use unbatched inputeventreceiver, reduce touchslop" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2fb4cb55f0
@@ -18,7 +18,6 @@ package com.android.systemui.shared.system;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Looper;
|
||||
import android.util.Pair;
|
||||
import android.view.BatchedInputEventReceiver;
|
||||
import android.view.Choreographer;
|
||||
import android.view.InputChannel;
|
||||
@@ -41,19 +40,6 @@ public class InputChannelCompat {
|
||||
void onInputEvent(InputEvent ev);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a dispatcher and receiver pair to better handle events across threads.
|
||||
*/
|
||||
public static Pair<InputEventDispatcher, InputEventReceiver> createPair(String name,
|
||||
Looper looper, Choreographer choreographer, InputEventListener listener) {
|
||||
InputChannel[] channels = InputChannel.openInputChannelPair(name);
|
||||
|
||||
InputEventDispatcher dispatcher = new InputEventDispatcher(channels[0], looper);
|
||||
InputEventReceiver receiver = new InputEventReceiver(channels[1], looper, choreographer,
|
||||
listener);
|
||||
return Pair.create(dispatcher, receiver);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a dispatcher from the extras received as part on onInitialize
|
||||
*/
|
||||
|
||||
@@ -33,13 +33,14 @@ import android.os.RemoteException;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import android.util.MathUtils;
|
||||
import android.view.Choreographer;
|
||||
import android.view.Gravity;
|
||||
import android.view.IPinnedStackController;
|
||||
import android.view.IPinnedStackListener;
|
||||
import android.view.ISystemGestureExclusionListener;
|
||||
import android.view.InputChannel;
|
||||
import android.view.InputDevice;
|
||||
import android.view.InputEvent;
|
||||
import android.view.InputEventReceiver;
|
||||
import android.view.InputMonitor;
|
||||
import android.view.KeyCharacterMap;
|
||||
import android.view.KeyEvent;
|
||||
@@ -53,7 +54,6 @@ import com.android.systemui.Dependency;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.bubbles.BubbleController;
|
||||
import com.android.systemui.recents.OverviewProxyService;
|
||||
import com.android.systemui.shared.system.InputChannelCompat.InputEventReceiver;
|
||||
import com.android.systemui.shared.system.QuickStepContract;
|
||||
import com.android.systemui.shared.system.WindowManagerWrapper;
|
||||
|
||||
@@ -165,12 +165,14 @@ public class EdgeBackGestureHandler implements DisplayListener {
|
||||
mEdgeWidth = res.getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.config_backGestureInset);
|
||||
|
||||
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
|
||||
// Reduce the default touch slop to ensure that we can intercept the gesture
|
||||
// before the app starts to react to it.
|
||||
// TODO(b/130352502) Tune this value and extract into a constant
|
||||
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop() * 0.75f;
|
||||
mLongPressTimeout = ViewConfiguration.getLongPressTimeout();
|
||||
|
||||
mNavBarHeight = res.getDimensionPixelSize(R.dimen.navigation_bar_frame_height);
|
||||
mMinArrowPosition = res.getDimensionPixelSize(
|
||||
R.dimen.navigation_edge_arrow_min_y);
|
||||
mMinArrowPosition = res.getDimensionPixelSize(R.dimen.navigation_edge_arrow_min_y);
|
||||
mFingerOffset = res.getDimensionPixelSize(R.dimen.navigation_edge_finger_offset);
|
||||
}
|
||||
|
||||
@@ -250,9 +252,8 @@ public class EdgeBackGestureHandler implements DisplayListener {
|
||||
// Register input event receiver
|
||||
mInputMonitor = InputManager.getInstance().monitorGestureInput(
|
||||
"edge-swipe", mDisplayId);
|
||||
mInputEventReceiver = new InputEventReceiver(mInputMonitor.getInputChannel(),
|
||||
Looper.getMainLooper(), Choreographer.getMainThreadInstance(),
|
||||
this::onInputEvent);
|
||||
mInputEventReceiver = new SysUiInputEventReceiver(
|
||||
mInputMonitor.getInputChannel(), Looper.getMainLooper());
|
||||
|
||||
// Add a nav bar panel window
|
||||
mEdgePanel = new NavigationBarEdgePanel(mContext);
|
||||
@@ -440,4 +441,15 @@ public class EdgeBackGestureHandler implements DisplayListener {
|
||||
}
|
||||
InputManager.getInstance().injectInputEvent(ev, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC);
|
||||
}
|
||||
|
||||
class SysUiInputEventReceiver extends InputEventReceiver {
|
||||
SysUiInputEventReceiver(InputChannel channel, Looper looper) {
|
||||
super(channel, looper);
|
||||
}
|
||||
|
||||
public void onInputEvent(InputEvent event) {
|
||||
EdgeBackGestureHandler.this.onInputEvent(event);
|
||||
finishInputEvent(event, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user