Merge "Moving some callbacks from LauncherCallbacks to OverviewCallbacks" into ub-launcher3-edmonton

This commit is contained in:
android-build-team Robot
2018-05-02 22:06:10 +00:00
committed by Android (Google) Code Review
7 changed files with 22 additions and 41 deletions

View File

@@ -59,8 +59,6 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
LayoutListener createLayoutListener(T activity);
void onQuickstepGestureStarted(T activity, boolean activityVisible);
/**
* Updates the UI to indicate quick interaction.
* @return true if there any any UI change as a result of this
@@ -116,11 +114,6 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
return new LauncherLayoutListener(activity);
}
@Override
public void onQuickstepGestureStarted(Launcher activity, boolean activityVisible) {
activity.onQuickstepGestureStarted(activityVisible);
}
@Override
public boolean onQuickInteractionStart(Launcher activity, boolean activityVisible) {
LauncherState fromState = activity.getStateManager().getState();
@@ -137,10 +130,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
@Override
public void executeOnWindowAvailable(Launcher activity, Runnable action) {
if (activity.getWorkspace().runOnOverlayHidden(action)) {
// Notify the activity that qiuckscrub has started
onQuickstepGestureStarted(activity, true);
}
activity.getWorkspace().runOnOverlayHidden(action);
}
@Override
@@ -309,11 +299,6 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
class FallbackActivityControllerHelper implements ActivityControlHelper<RecentsActivity> {
@Override
public void onQuickstepGestureStarted(RecentsActivity activity, boolean activityVisible) {
// TODO:
}
@Override
public boolean onQuickInteractionStart(RecentsActivity activity, boolean activityVisible) {
// Activity does not need any UI change for quickscrub.

View File

@@ -22,6 +22,8 @@ import static android.view.MotionEvent.ACTION_POINTER_UP;
import static android.view.MotionEvent.ACTION_UP;
import static android.view.MotionEvent.INVALID_POINTER_ID;
import static com.android.systemui.shared.system.ActivityManagerWrapper
.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
import android.annotation.TargetApi;
@@ -73,6 +75,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
private final ActivityControlHelper mActivityControlHelper;
private final MainThreadExecutor mMainThreadExecutor;
private final Choreographer mBackgroundThreadChoreographer;
private final OverviewCallbacks mOverviewCallbacks;
private final boolean mIsDeferredDownTarget;
private final PointF mDownPos = new PointF();
@@ -92,8 +95,10 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
public OtherActivityTouchConsumer(Context base, RunningTaskInfo runningTaskInfo,
RecentsModel recentsModel, Intent homeIntent, ActivityControlHelper activityControl,
MainThreadExecutor mainThreadExecutor, Choreographer backgroundThreadChoreographer,
@HitTarget int downHitTarget, VelocityTracker velocityTracker) {
@HitTarget int downHitTarget, OverviewCallbacks overviewCallbacks,
VelocityTracker velocityTracker) {
super(base);
mRunningTask = runningTaskInfo;
mRecentsModel = recentsModel;
mHomeIntent = homeIntent;
@@ -102,6 +107,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
mMainThreadExecutor = mainThreadExecutor;
mBackgroundThreadChoreographer = backgroundThreadChoreographer;
mIsDeferredDownTarget = activityControl.deferStartingActivity(downHitTarget);
mOverviewCallbacks = overviewCallbacks;
}
@Override
@@ -187,6 +193,11 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
if (mInteractionHandler == null) {
return;
}
mOverviewCallbacks.closeAllWindows();
ActivityManagerWrapper.getInstance().closeSystemWindows(
CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
// Notify the handler that the gesture has actually started
mInteractionHandler.onGestureStarted();
}

View File

@@ -40,4 +40,6 @@ public class OverviewCallbacks {
public void onInitOverviewTransition() { }
public void onResetOverview() { }
public void closeAllWindows() { }
}

View File

@@ -164,6 +164,7 @@ public class TouchInteractionService extends Service {
private ISystemUiProxy mISystemUiProxy;
private OverviewCommandHelper mOverviewCommandHelper;
private OverviewInteractionState mOverviewInteractionState;
private OverviewCallbacks mOverviewCallbacks;
private Choreographer mMainThreadChoreographer;
private Choreographer mBackgroundThreadChoreographer;
@@ -179,6 +180,7 @@ public class TouchInteractionService extends Service {
mMainThreadChoreographer = Choreographer.getInstance();
mEventQueue = new MotionEventQueue(mMainThreadChoreographer, mNoOpTouchConsumer);
mOverviewInteractionState = OverviewInteractionState.getInstance(this);
mOverviewCallbacks = OverviewCallbacks.get(this);
sConnected = true;
@@ -230,7 +232,8 @@ public class TouchInteractionService extends Service {
return new OtherActivityTouchConsumer(this, runningTaskInfo, mRecentsModel,
mOverviewCommandHelper.overviewIntent,
mOverviewCommandHelper.getActivityControlHelper(), mMainThreadExecutor,
mBackgroundThreadChoreographer, downHitTarget, tracker);
mBackgroundThreadChoreographer, downHitTarget, mOverviewCallbacks,
tracker);
}
}
@@ -330,7 +333,7 @@ public class TouchInteractionService extends Service {
if (mInvalidated) {
return;
}
mActivityHelper.onQuickstepGestureStarted(mActivity, true);
OverviewCallbacks.get(mActivity).closeAllWindows();
ActivityManagerWrapper.getInstance()
.closeSystemWindows(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
}
@@ -341,10 +344,11 @@ public class TouchInteractionService extends Service {
return;
}
if (interactionType == INTERACTION_QUICK_SCRUB) {
OverviewCallbacks.get(mActivity).closeAllWindows();
ActivityManagerWrapper.getInstance()
.closeSystemWindows(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
mStartPending = true;
mStartPending = true;
Runnable action = () -> {
mQuickScrubController.onQuickScrubStart(mActivityHelper.onQuickInteractionStart(
mActivity, true), mActivityHelper);

View File

@@ -24,7 +24,6 @@ import static com.android.launcher3.anim.Interpolators.TOUCH_RESPONSE_INTERPOLAT
import static com.android.quickstep.QuickScrubController.QUICK_SCRUB_START_DURATION;
import static com.android.quickstep.TouchConsumer.INTERACTION_NORMAL;
import static com.android.quickstep.TouchConsumer.INTERACTION_QUICK_SCRUB;
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
import android.animation.Animator;
import android.animation.ObjectAnimator;
@@ -69,7 +68,6 @@ import com.android.quickstep.util.SysuiEventLogger;
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;
@@ -564,8 +562,6 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
mGestureStarted = true;
mRecentsAnimationWrapper.hideCurrentInputMethod();
mRecentsAnimationWrapper.enableInputConsumer();
ActivityManagerWrapper.getInstance().closeSystemWindows(
CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
}
/**
@@ -579,8 +575,6 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
// Once the gesture starts, we can no longer transition home through the button, so
// reset the force override of the activity visibility
mActivity.clearForceInvisibleFlag(INVISIBLE_BY_STATE_HANDLER);
mActivityControlHelper.onQuickstepGestureStarted(
curActivity, mWasLauncherAlreadyVisible);
}
}