Disable batching until the initial gesture is detected

- Just doing other activity since that's the most common case for now

Bug: 167732711
Change-Id: Icc910dbaf057893710c5f0bc6705e57cf8e3ee22
This commit is contained in:
Winson Chung 2020-09-03 17:01:56 -07:00
parent 24c81ad7b5
commit aff3e5263e
2 changed files with 13 additions and 3 deletions

View File

@ -683,7 +683,7 @@ public class TouchInteractionService extends Service implements PluginListener<O
final boolean disableHorizontalSwipe = mDeviceState.isInExclusionRegion(event);
return new OtherActivityInputConsumer(this, mDeviceState, mTaskAnimationManager,
gestureState, shouldDefer, this::onConsumerInactive,
mInputMonitorCompat, disableHorizontalSwipe, factory);
mInputMonitorCompat, mInputEventReceiver, disableHorizontalSwipe, factory);
}
private InputConsumer createDeviceLockedInputConsumer(GestureState gestureState) {
@ -732,6 +732,8 @@ public class TouchInteractionService extends Service implements PluginListener<O
private void reset() {
mConsumer = mUncheckedConsumer = mResetGestureInputConsumer;
mGestureState = DEFAULT_STATE;
// By default, use batching of the input events
mInputEventReceiver.setBatchingEnabled(true);
}
private void preloadOverview(boolean fromInit) {

View File

@ -67,6 +67,7 @@ import com.android.quickstep.util.CachedEventDispatcher;
import com.android.quickstep.util.MotionPauseDetector;
import com.android.quickstep.util.NavBarPosition;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.InputChannelCompat.InputEventReceiver;
import com.android.systemui.shared.system.InputMonitorCompat;
import java.util.function.Consumer;
@ -92,6 +93,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
private RecentsAnimationCallbacks mActiveCallbacks;
private final CachedEventDispatcher mRecentsViewDispatcher = new CachedEventDispatcher();
private final InputMonitorCompat mInputMonitorCompat;
private final InputEventReceiver mInputEventReceiver;
private final BaseActivityInterface mActivityInterface;
private final AbsSwipeUpHandler.Factory mHandlerFactory;
@ -135,8 +137,8 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
public OtherActivityInputConsumer(Context base, RecentsAnimationDeviceState deviceState,
TaskAnimationManager taskAnimationManager, GestureState gestureState,
boolean isDeferredDownTarget, Consumer<OtherActivityInputConsumer> onCompleteCallback,
InputMonitorCompat inputMonitorCompat, boolean disableHorizontalSwipe,
Factory handlerFactory) {
InputMonitorCompat inputMonitorCompat, InputEventReceiver inputEventReceiver,
boolean disableHorizontalSwipe, Factory handlerFactory) {
super(base);
mDeviceState = deviceState;
mNavBarPosition = mDeviceState.getNavBarPosition();
@ -154,6 +156,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
mOnCompleteCallback = onCompleteCallback;
mVelocityTracker = VelocityTracker.obtain();
mInputMonitorCompat = inputMonitorCompat;
mInputEventReceiver = inputEventReceiver;
boolean continuingPreviousGesture = mTaskAnimationManager.isRecentsAnimationRunning();
mIsDeferredDownTarget = !continuingPreviousGesture && isDeferredDownTarget;
@ -215,6 +218,9 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
switch (ev.getActionMasked()) {
case ACTION_DOWN: {
// Until we detect the gesture, handle events as we receive them
mInputEventReceiver.setBatchingEnabled(false);
Object traceToken = TraceHelper.INSTANCE.beginSection(DOWN_EVT,
FLAG_CHECK_FOR_RACE_CONDITIONS);
mActivePointerId = ev.getPointerId(0);
@ -351,6 +357,8 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
}
TestLogging.recordEvent(TestProtocol.SEQUENCE_PILFER, "pilferPointers");
mInputMonitorCompat.pilferPointers();
// Once we detect the gesture, we can enable batching to reduce further updates
mInputEventReceiver.setBatchingEnabled(true);
mActivityInterface.closeOverlay();
ActivityManagerWrapper.getInstance().closeSystemWindows(