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

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

Merge changes from topic "quick-assistance" into ub-launcher3-master

* changes:
  [automerger] Fetching assist data only if required by overlay am: b44c6552
  Fetching assist data only if required by overlay
parents f7298380 eb12de06
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import com.android.launcher3.R;
import com.android.launcher3.Workspace;
import com.android.launcher3.allapps.DiscoveryBounce;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.views.RecentsView;

/**
@@ -76,6 +77,7 @@ public class OverviewState extends LauncherState {
    public void onStateDisabled(Launcher launcher) {
        RecentsView rv = launcher.getOverviewPanel();
        rv.setOverviewStateEnabled(false);
        RecentsModel.getInstance(launcher).resetAssistCache();
    }

    @Override
+15 −5
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
    private final MainThreadExecutor mMainThreadExecutor;
    private final Choreographer mBackgroundThreadChoreographer;
    private final OverviewCallbacks mOverviewCallbacks;
    private final TaskOverlayFactory mTaskOverlayFactory;

    private final boolean mIsDeferredDownTarget;
    private final PointF mDownPos = new PointF();
@@ -99,7 +100,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
            RecentsModel recentsModel, Intent homeIntent, ActivityControlHelper activityControl,
            MainThreadExecutor mainThreadExecutor, Choreographer backgroundThreadChoreographer,
            @HitTarget int downHitTarget, OverviewCallbacks overviewCallbacks,
            VelocityTracker velocityTracker) {
            TaskOverlayFactory taskOverlayFactory, VelocityTracker velocityTracker) {
        super(base);

        mRunningTask = runningTaskInfo;
@@ -111,6 +112,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
        mBackgroundThreadChoreographer = backgroundThreadChoreographer;
        mIsDeferredDownTarget = activityControl.deferStartingActivity(downHitTarget);
        mOverviewCallbacks = overviewCallbacks;
        mTaskOverlayFactory = taskOverlayFactory;
    }

    @Override
@@ -233,14 +235,22 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
        handler.initWhenReady();

        TraceHelper.beginSection("RecentsController");
        Runnable startActivity = () -> ActivityManagerWrapper.getInstance().startRecentsActivity(
                mHomeIntent,

        AssistDataReceiver assistDataReceiver = !mTaskOverlayFactory.needAssist() ? null :
                new AssistDataReceiver() {
                    @Override
                    public void onHandleAssistData(Bundle bundle) {
                        if (mInteractionHandler == null) {
                            // Interaction is probably complete
                            mRecentsModel.preloadAssistData(mRunningTask.id, bundle);
                        } else if (handler == mInteractionHandler) {
                            handler.onAssistDataReceived(bundle);
                        }
                }, animationState, null, null);
                    }
                };

        Runnable startActivity = () -> ActivityManagerWrapper.getInstance().startRecentsActivity(
                mHomeIntent, assistDataReceiver, animationState, null, null);

        if (Looper.myLooper() != Looper.getMainLooper()) {
            startActivity.run();
+4 −0
Original line number Diff line number Diff line
@@ -256,6 +256,10 @@ public class RecentsModel extends TaskStackChangeListener {
        }
    }

    public void resetAssistCache() {
        mCachedAssistData.clear();
    }

    @WorkerThread
    public void preloadAssistData(int taskId, Bundle data) {
        mMainThreadExecutor.execute(() -> {
+6 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.quickstep;

import android.content.Context;
import android.graphics.Matrix;
import android.support.annotation.AnyThread;
import android.view.View;

import com.android.launcher3.R;
@@ -42,6 +43,11 @@ public class TaskOverlayFactory {
        return sInstance;
    }

    @AnyThread
    public boolean needAssist() {
        return false;
    }

    public TaskOverlay createOverlay(View thumbnailView) {
        return new TaskOverlay();
    }
+3 −1
Original line number Diff line number Diff line
@@ -171,6 +171,7 @@ public class TouchInteractionService extends Service {
    private OverviewCommandHelper mOverviewCommandHelper;
    private OverviewInteractionState mOverviewInteractionState;
    private OverviewCallbacks mOverviewCallbacks;
    private TaskOverlayFactory mTaskOverlayFactory;

    private Choreographer mMainThreadChoreographer;
    private Choreographer mBackgroundThreadChoreographer;
@@ -187,6 +188,7 @@ public class TouchInteractionService extends Service {
        mEventQueue = new MotionEventQueue(mMainThreadChoreographer, mNoOpTouchConsumer);
        mOverviewInteractionState = OverviewInteractionState.getInstance(this);
        mOverviewCallbacks = OverviewCallbacks.get(this);
        mTaskOverlayFactory = TaskOverlayFactory.get(this);

        sConnected = true;

@@ -239,7 +241,7 @@ public class TouchInteractionService extends Service {
                            mOverviewCommandHelper.overviewIntent,
                            mOverviewCommandHelper.getActivityControlHelper(), mMainThreadExecutor,
                            mBackgroundThreadChoreographer, downHitTarget, mOverviewCallbacks,
                            tracker);
                            mTaskOverlayFactory, tracker);
        }
    }

Loading