Files
Flexera-Launcher/quickstep/src/com/android/quickstep/inputconsumers/DelegateInputConsumer.java
T
Winson Chung 0605ca7bfe Remove legacy unused proto tracing code to prevent confusion
Bug: 290408307
Test: Presubmit
Change-Id: I1bd1270876b8934659194f0ed2b5bcdaef3975bc
2023-07-07 23:02:19 +00:00

57 lines
1.7 KiB
Java

package com.android.quickstep.inputconsumers;
import android.view.MotionEvent;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.quickstep.InputConsumer;
import com.android.systemui.shared.system.InputMonitorCompat;
public abstract class DelegateInputConsumer implements InputConsumer {
protected static final int STATE_INACTIVE = 0;
protected static final int STATE_ACTIVE = 1;
protected static final int STATE_DELEGATE_ACTIVE = 2;
protected final InputConsumer mDelegate;
protected final InputMonitorCompat mInputMonitor;
protected int mState;
public DelegateInputConsumer(InputConsumer delegate, InputMonitorCompat inputMonitor) {
mDelegate = delegate;
mInputMonitor = inputMonitor;
mState = STATE_INACTIVE;
}
@Override
public InputConsumer getActiveConsumerInHierarchy() {
if (mState == STATE_ACTIVE) {
return this;
}
return mDelegate.getActiveConsumerInHierarchy();
}
@Override
public boolean allowInterceptByParent() {
return mDelegate.allowInterceptByParent() && mState != STATE_ACTIVE;
}
@Override
public void onConsumerAboutToBeSwitched() {
mDelegate.onConsumerAboutToBeSwitched();
}
protected void setActive(MotionEvent ev) {
mState = STATE_ACTIVE;
TestLogging.recordEvent(TestProtocol.SEQUENCE_PILFER, "pilferPointers");
mInputMonitor.pilferPointers();
// Send cancel event
MotionEvent event = MotionEvent.obtain(ev);
event.setAction(MotionEvent.ACTION_CANCEL);
mDelegate.onMotionEvent(event);
event.recycle();
}
}