Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 79f40bec authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Synchronizing invalidating interaction handler with the eventQueue."...

Merge "Synchronizing invalidating interaction handler with the eventQueue." into ub-launcher3-master
parents 647d8f5b 5c86b5d9
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -20,13 +20,11 @@ import android.support.annotation.WorkerThread;
import com.android.launcher3.states.InternalStateHandler;
import com.android.quickstep.TouchConsumer.InteractionType;

import java.util.function.Consumer;

public abstract class BaseSwipeInteractionHandler extends InternalStateHandler {

    protected Consumer<BaseSwipeInteractionHandler> mGestureEndCallback;
    protected Runnable mGestureEndCallback;

    public void setGestureEndCallback(Consumer<BaseSwipeInteractionHandler> gestureEndCallback) {
    public void setGestureEndCallback(Runnable gestureEndCallback) {
        mGestureEndCallback = gestureEndCallback;
    }

+1 −1
Original line number Diff line number Diff line
@@ -347,7 +347,7 @@ public class NavBarSwipeInteractionHandler extends BaseSwipeInteractionHandler i
    public void reset() {
        mCurrentShift.cancelAnimation();
        if (mGestureEndCallback != null) {
            mGestureEndCallback.accept(this);
            mGestureEndCallback.run();
        }
    }

+6 −9
Original line number Diff line number Diff line
@@ -230,6 +230,9 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
    }

    private void notifyGestureStarted() {
        if (mInteractionHandler == null) {
            return;
        }
        // Notify the handler that the gesture has actually started
        mInteractionHandler.onGestureStarted();

@@ -275,7 +278,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
        // Preload the plan
        mRecentsModel.loadTasks(mRunningTask.id, null);
        mInteractionHandler = handler;
        mInteractionHandler.setGestureEndCallback(this::onFinish);
        mInteractionHandler.setGestureEndCallback(mEventQueue::reset);
    }

    private Bitmap getCurrentTaskSnapshot() {
@@ -314,7 +317,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
        // Preload the plan
        mRecentsModel.loadTasks(mRunningTask.id, null);
        mInteractionHandler = handler;
        handler.setGestureEndCallback(this::onFinish);
        handler.setGestureEndCallback(mEventQueue::reset);

        CountDownLatch drawWaitLock = new CountDownLatch(1);
        handler.setLauncherOnDrawCallback(() -> {
@@ -408,8 +411,8 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
        // Clean up the old interaction handler
        if (mInteractionHandler != null) {
            final BaseSwipeInteractionHandler handler = mInteractionHandler;
            mMainThreadExecutor.execute(handler::reset);
            mInteractionHandler = null;
            mMainThreadExecutor.execute(handler::reset);
        }
    }

@@ -450,12 +453,6 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
        }
    }

    private void onFinish(BaseSwipeInteractionHandler handler) {
        if (mInteractionHandler == handler) {
            mInteractionHandler = null;
        }
    }

    public void switchToMainChoreographer() {
        mEventQueue.setInterimChoreographer(null);
    }
+1 −1
Original line number Diff line number Diff line
@@ -688,7 +688,7 @@ public class WindowTransformSwipeHandler extends BaseSwipeInteractionHandler {
        mCurrentShift.cancelAnimation();

        if (mGestureEndCallback != null) {
            mGestureEndCallback.accept(this);
            mGestureEndCallback.run();
        }

        clearReference();