Keep input consumer registered and rely on enabled state instead
Bug: 117224991 Test: Ensure swipe up still works Change-Id: I719ce41959fca2157a3db614e90d404551299007
This commit is contained in:
parent
6083c63e81
commit
6e11a2d9f2
|
@ -52,6 +52,7 @@ import com.android.quickstep.util.RemoteAnimationTargetSet;
|
|||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
import com.android.systemui.shared.system.AssistDataReceiver;
|
||||
import com.android.systemui.shared.system.BackgroundExecutor;
|
||||
import com.android.systemui.shared.system.InputConsumerController;
|
||||
import com.android.systemui.shared.system.NavigationBarCompat;
|
||||
import com.android.systemui.shared.system.NavigationBarCompat.HitTarget;
|
||||
import com.android.systemui.shared.system.RecentsAnimationControllerCompat;
|
||||
|
@ -80,6 +81,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
|
|||
private final OverviewCallbacks mOverviewCallbacks;
|
||||
private final TaskOverlayFactory mTaskOverlayFactory;
|
||||
private final TouchInteractionLog mTouchInteractionLog;
|
||||
private final InputConsumerController mInputConsumer;
|
||||
|
||||
private final boolean mIsDeferredDownTarget;
|
||||
private final PointF mDownPos = new PointF();
|
||||
|
@ -101,8 +103,8 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
|
|||
RecentsModel recentsModel, Intent homeIntent, ActivityControlHelper activityControl,
|
||||
MainThreadExecutor mainThreadExecutor, Choreographer backgroundThreadChoreographer,
|
||||
@HitTarget int downHitTarget, OverviewCallbacks overviewCallbacks,
|
||||
TaskOverlayFactory taskOverlayFactory, VelocityTracker velocityTracker,
|
||||
TouchInteractionLog touchInteractionLog) {
|
||||
TaskOverlayFactory taskOverlayFactory, InputConsumerController inputConsumer,
|
||||
VelocityTracker velocityTracker, TouchInteractionLog touchInteractionLog) {
|
||||
super(base);
|
||||
|
||||
mRunningTask = runningTaskInfo;
|
||||
|
@ -117,6 +119,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
|
|||
mTaskOverlayFactory = taskOverlayFactory;
|
||||
mTouchInteractionLog = touchInteractionLog;
|
||||
mTouchInteractionLog.setTouchConsumer(this);
|
||||
mInputConsumer = inputConsumer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -226,7 +229,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
|
|||
RecentsAnimationState animationState = new RecentsAnimationState();
|
||||
final WindowTransformSwipeHandler handler = new WindowTransformSwipeHandler(
|
||||
animationState.id, mRunningTask, this, touchTimeMs, mActivityControlHelper,
|
||||
mTouchInteractionLog);
|
||||
mInputConsumer, mTouchInteractionLog);
|
||||
|
||||
// Preload the plan
|
||||
mRecentsModel.loadTasks(mRunningTask.id, null);
|
||||
|
|
|
@ -53,24 +53,18 @@ public class RecentsAnimationWrapper {
|
|||
new LooperExecutor(UiThreadHelper.getBackgroundLooper());
|
||||
|
||||
private final MainThreadExecutor mMainThreadExecutor = new MainThreadExecutor();
|
||||
private InputConsumerController mInputConsumer =
|
||||
InputConsumerController.getRecentsAnimationInputConsumer();
|
||||
private final InputConsumerController mInputConsumer;
|
||||
private final Supplier<TouchConsumer> mTouchProxySupplier;
|
||||
|
||||
private boolean mInputConsumerUnregistered;
|
||||
private boolean mTouchProxyEnabled;
|
||||
|
||||
private TouchConsumer mTouchConsumer;
|
||||
private boolean mTouchInProgress;
|
||||
private boolean mInputConsumerUnregisterPending;
|
||||
|
||||
private boolean mFinishPending;
|
||||
|
||||
public RecentsAnimationWrapper(Supplier<TouchConsumer> touchProxySupplier) {
|
||||
// Register the input consumer on the UI thread, to ensure that it runs after any pending
|
||||
// unregister calls
|
||||
public RecentsAnimationWrapper(InputConsumerController inputConsumer,
|
||||
Supplier<TouchConsumer> touchProxySupplier) {
|
||||
mInputConsumer = inputConsumer;
|
||||
mTouchProxySupplier = touchProxySupplier;
|
||||
mMainThreadExecutor.execute(mInputConsumer::registerInputConsumer);
|
||||
}
|
||||
|
||||
public synchronized void setController(
|
||||
|
@ -109,6 +103,7 @@ public class RecentsAnimationWrapper {
|
|||
public void finish(boolean toHome, Runnable onFinishComplete) {
|
||||
if (!toHome) {
|
||||
mExecutorService.submit(() -> finishBg(false, onFinishComplete));
|
||||
return;
|
||||
}
|
||||
|
||||
mMainThreadExecutor.execute(() -> {
|
||||
|
@ -152,28 +147,12 @@ public class RecentsAnimationWrapper {
|
|||
}
|
||||
}
|
||||
|
||||
public void unregisterInputConsumer() {
|
||||
mMainThreadExecutor.execute(this::unregisterInputConsumerUi);
|
||||
}
|
||||
|
||||
private void unregisterInputConsumerUi() {
|
||||
if (mTouchProxyEnabled && mTouchInProgress) {
|
||||
mInputConsumerUnregisterPending = true;
|
||||
} else {
|
||||
mInputConsumerUnregistered = true;
|
||||
mInputConsumer.unregisterInputConsumer();
|
||||
}
|
||||
}
|
||||
|
||||
public void enableTouchProxy() {
|
||||
mMainThreadExecutor.execute(this::enableTouchProxyUi);
|
||||
}
|
||||
|
||||
private void enableTouchProxyUi() {
|
||||
if (!mInputConsumerUnregistered) {
|
||||
mTouchProxyEnabled = true;
|
||||
mInputConsumer.setTouchListener(this::onInputConsumerTouch);
|
||||
}
|
||||
mInputConsumer.setTouchListener(this::onInputConsumerTouch);
|
||||
}
|
||||
|
||||
private boolean onInputConsumerTouch(MotionEvent ev) {
|
||||
|
@ -184,10 +163,6 @@ public class RecentsAnimationWrapper {
|
|||
} else if (action == ACTION_CANCEL || action == ACTION_UP) {
|
||||
// Finish any pending actions
|
||||
mTouchInProgress = false;
|
||||
if (mInputConsumerUnregisterPending) {
|
||||
mInputConsumerUnregisterPending = false;
|
||||
mInputConsumer.unregisterInputConsumer();
|
||||
}
|
||||
if (mFinishPending) {
|
||||
mFinishPending = false;
|
||||
mExecutorService.submit(() -> finishBg(true, null));
|
||||
|
|
|
@ -51,6 +51,7 @@ import com.android.systemui.shared.recents.IOverviewProxy;
|
|||
import com.android.systemui.shared.recents.ISystemUiProxy;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
import com.android.systemui.shared.system.ChoreographerCompat;
|
||||
import com.android.systemui.shared.system.InputConsumerController;
|
||||
import com.android.systemui.shared.system.NavigationBarCompat.HitTarget;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
|
@ -185,6 +186,7 @@ public class TouchInteractionService extends Service {
|
|||
private OverviewCallbacks mOverviewCallbacks;
|
||||
private TaskOverlayFactory mTaskOverlayFactory;
|
||||
private TouchInteractionLog mTouchInteractionLog;
|
||||
private InputConsumerController mInputConsumer;
|
||||
|
||||
private Choreographer mMainThreadChoreographer;
|
||||
private Choreographer mBackgroundThreadChoreographer;
|
||||
|
@ -203,6 +205,8 @@ public class TouchInteractionService extends Service {
|
|||
mOverviewCallbacks = OverviewCallbacks.get(this);
|
||||
mTaskOverlayFactory = TaskOverlayFactory.get(this);
|
||||
mTouchInteractionLog = new TouchInteractionLog();
|
||||
mInputConsumer = InputConsumerController.getRecentsAnimationInputConsumer();
|
||||
mInputConsumer.registerInputConsumer();
|
||||
|
||||
sConnected = true;
|
||||
|
||||
|
@ -213,6 +217,7 @@ public class TouchInteractionService extends Service {
|
|||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
mInputConsumer.unregisterInputConsumer();
|
||||
mOverviewCommandHelper.onDestroy();
|
||||
sConnected = false;
|
||||
super.onDestroy();
|
||||
|
@ -256,7 +261,7 @@ public class TouchInteractionService extends Service {
|
|||
mOverviewCommandHelper.overviewIntent,
|
||||
mOverviewCommandHelper.getActivityControlHelper(), mMainThreadExecutor,
|
||||
mBackgroundThreadChoreographer, downHitTarget, mOverviewCallbacks,
|
||||
mTaskOverlayFactory, tracker, mTouchInteractionLog);
|
||||
mTaskOverlayFactory, mInputConsumer, tracker, mTouchInteractionLog);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -78,6 +78,7 @@ import com.android.quickstep.views.RecentsView;
|
|||
import com.android.quickstep.views.TaskView;
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
import com.android.systemui.shared.system.InputConsumerController;
|
||||
import com.android.systemui.shared.system.LatencyTrackerCompat;
|
||||
import com.android.systemui.shared.system.RecentsAnimationControllerCompat;
|
||||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
|
@ -226,8 +227,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
|||
|
||||
private @InteractionType int mInteractionType = INTERACTION_NORMAL;
|
||||
|
||||
private final RecentsAnimationWrapper mRecentsAnimationWrapper =
|
||||
new RecentsAnimationWrapper(this::createNewTouchProxyHandler);
|
||||
private final RecentsAnimationWrapper mRecentsAnimationWrapper;
|
||||
|
||||
private final long mTouchTimeMs;
|
||||
private long mLauncherFrameDrawnTime;
|
||||
|
@ -241,7 +241,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
|||
|
||||
WindowTransformSwipeHandler(int id, RunningTaskInfo runningTaskInfo, Context context,
|
||||
long touchTimeMs, ActivityControlHelper<T> controller,
|
||||
TouchInteractionLog touchInteractionLog) {
|
||||
InputConsumerController inputConsumer, TouchInteractionLog touchInteractionLog) {
|
||||
this.id = id;
|
||||
mContext = context;
|
||||
mRunningTaskInfo = runningTaskInfo;
|
||||
|
@ -251,6 +251,8 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
|||
mActivityInitListener = mActivityControlHelper
|
||||
.createActivityInitListener(this::onActivityInit);
|
||||
mTouchInteractionLog = touchInteractionLog;
|
||||
mRecentsAnimationWrapper = new RecentsAnimationWrapper(inputConsumer,
|
||||
this::createNewTouchProxyHandler);
|
||||
|
||||
initStateCallbacks();
|
||||
}
|
||||
|
@ -860,7 +862,6 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
|||
}
|
||||
|
||||
mActivityInitListener.unregister();
|
||||
mRecentsAnimationWrapper.unregisterInputConsumer();
|
||||
mTaskSnapshot = null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue