Loading quickstep/src/com/android/quickstep/ActivityControlHelper.java +39 −9 Original line number Diff line number Diff line Loading @@ -35,7 +35,6 @@ import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherAppTransitionManagerImpl; import com.android.launcher3.LauncherInitListener; import com.android.launcher3.LauncherState; import com.android.launcher3.allapps.AllAppsTransitionController; Loading @@ -62,7 +61,13 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { void onQuickstepGestureStarted(T activity, boolean activityVisible); void onQuickInteractionStart(T activity, boolean activityVisible); /** * Updates the UI to indicate quick interaction. * @return true if there any any UI change as a result of this */ boolean onQuickInteractionStart(T activity, boolean activityVisible); void executeOnWindowAvailable(T activity, Runnable action); void executeOnNextDraw(T activity, TaskView targetView, Runnable action); Loading @@ -83,6 +88,9 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { void startRecentsFromSwipe(Intent intent, AssistDataReceiver assistDataReceiver, final RecentsAnimationListener remoteAnimationListener); @Nullable T getCreatedActivity(); @UiThread @Nullable RecentsView getVisibleRecentsView(); Loading @@ -103,8 +111,18 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { } @Override public void onQuickInteractionStart(Launcher activity, boolean activityVisible) { public boolean onQuickInteractionStart(Launcher activity, boolean activityVisible) { LauncherState fromState = activity.getStateManager().getState(); activity.getStateManager().goToState(FAST_OVERVIEW, activityVisible); return !fromState.overviewUi; } @Override public void executeOnWindowAvailable(Launcher activity, Runnable action) { if (activity.getWorkspace().runOnOverlayHidden(action)) { // Notify the activity that qiuckscrub has started onQuickstepGestureStarted(activity, true); } } @Override Loading Loading @@ -210,8 +228,8 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { } @Nullable @UiThread private Launcher getLauncher() { @Override public Launcher getCreatedActivity() { LauncherAppState app = LauncherAppState.getInstanceNoCreate(); if (app == null) { return null; Loading @@ -222,7 +240,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { @Nullable @UiThread private Launcher getVisibleLaucher() { Launcher launcher = getLauncher(); Launcher launcher = getCreatedActivity(); return (launcher != null) && launcher.isStarted() && launcher.hasWindowFocus() ? launcher : null; } Loading Loading @@ -254,8 +272,14 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { } @Override public void onQuickInteractionStart(RecentsActivity activity, boolean activityVisible) { // TODO: public boolean onQuickInteractionStart(RecentsActivity activity, boolean activityVisible) { // Activity does not need any UI change for quickscrub. return false; } @Override public void executeOnWindowAvailable(RecentsActivity activity, Runnable action) { action.run(); } @Override Loading Loading @@ -337,10 +361,16 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { intent, assistDataReceiver, remoteAnimationListener, null, null); } @Nullable @Override public RecentsActivity getCreatedActivity() { return RecentsActivityTracker.getCurrentActivity(); } @Nullable @Override public RecentsView getVisibleRecentsView() { RecentsActivity activity = RecentsActivityTracker.getCurrentActivity(); RecentsActivity activity = getCreatedActivity(); if (activity != null && activity.hasWindowFocus()) { return activity.getOverviewPanel(); } Loading quickstep/src/com/android/quickstep/TouchInteractionService.java +42 −27 Original line number Diff line number Diff line Loading @@ -21,8 +21,7 @@ import static android.view.MotionEvent.ACTION_MOVE; import static android.view.MotionEvent.ACTION_POINTER_DOWN; import static android.view.MotionEvent.ACTION_POINTER_UP; import static android.view.MotionEvent.ACTION_UP; import static com.android.launcher3.LauncherState.FAST_OVERVIEW; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_NONE; import android.annotation.TargetApi; Loading @@ -43,9 +42,7 @@ import android.view.VelocityTracker; import android.view.View; import android.view.ViewConfiguration; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherState; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.MainThreadExecutor; import com.android.launcher3.R; import com.android.launcher3.util.TraceHelper; Loading Loading @@ -220,13 +217,13 @@ public class TouchInteractionService extends Service { private TouchConsumer getCurrentTouchConsumer( @HitTarget int downHitTarget, boolean forceToLauncher, VelocityTracker tracker) { RunningTaskInfo runningTaskInfo = mAM.getRunningTask(); RunningTaskInfo runningTaskInfo = mAM.getRunningTask(0); if (runningTaskInfo == null && !forceToLauncher) { return mNoOpTouchConsumer; } else if (forceToLauncher || runningTaskInfo.topActivity.equals(mOverviewCommandHelper.launcher)) { return getLauncherConsumer(); return getOverviewConsumer(); } else { if (tracker == null) { tracker = VelocityTracker.obtain(); Loading @@ -238,18 +235,20 @@ public class TouchInteractionService extends Service { } } private TouchConsumer getLauncherConsumer() { Launcher launcher = (Launcher) LauncherAppState.getInstance(this).getModel().getCallback(); if (launcher == null) { private TouchConsumer getOverviewConsumer() { ActivityControlHelper activityHelper = mOverviewCommandHelper.getActivityControlHelper(); BaseDraggingActivity activity = activityHelper.getCreatedActivity(); if (activity == null) { return mNoOpTouchConsumer; } View target = launcher.getDragLayer(); return new LauncherTouchConsumer(launcher, target); return new OverviewTouchConsumer(activityHelper, activity); } private static class LauncherTouchConsumer implements TouchConsumer { private static class OverviewTouchConsumer<T extends BaseDraggingActivity> implements TouchConsumer { private final Launcher mLauncher; private final ActivityControlHelper<T> mActivityHelper; private final T mActivity; private final View mTarget; private final int[] mLocationOnScreen = new int[2]; private final PointF mDownPos = new PointF(); Loading @@ -260,12 +259,17 @@ public class TouchInteractionService extends Service { private boolean mInvalidated = false; private boolean mHadWindowFocusOnDown; LauncherTouchConsumer(Launcher launcher, View target) { mLauncher = launcher; mTarget = target; private float mLastProgress = 0; private boolean mStartPending = false; private boolean mEndPending = false; OverviewTouchConsumer(ActivityControlHelper<T> activityHelper, T activity) { mActivityHelper = activityHelper; mActivity = activity; mTarget = activity.getDragLayer(); mTouchSlop = ViewConfiguration.get(mTarget.getContext()).getScaledTouchSlop(); mQuickScrubController = mLauncher.<RecentsView>getOverviewPanel() mQuickScrubController = mActivity.<RecentsView>getOverviewPanel() .getQuickScrubController(); } Loading Loading @@ -327,16 +331,22 @@ public class TouchInteractionService extends Service { return; } if (interactionType == INTERACTION_QUICK_SCRUB) { mStartPending = true; Runnable action = () -> { LauncherState fromState = mLauncher.getStateManager().getState(); mLauncher.getStateManager().goToState(FAST_OVERVIEW, true); mQuickScrubController.onQuickScrubStart(fromState == NORMAL); }; mQuickScrubController.onQuickScrubStart( mActivityHelper.onQuickInteractionStart(mActivity, true)); mQuickScrubController.onQuickScrubProgress(mLastProgress); mStartPending = false; if (mLauncher.getWorkspace().runOnOverlayHidden(action)) { // Hide the minus one overlay so launcher can get window focus. mLauncher.onQuickstepGestureStarted(true); if (mEndPending) { mQuickScrubController.onQuickScrubEnd(); mEndPending = false; } }; mActivityHelper.executeOnWindowAvailable(mActivity, action); } } Loading @@ -345,12 +355,17 @@ public class TouchInteractionService extends Service { if (mInvalidated) { return; } if (mStartPending) { mEndPending = true; } else { mQuickScrubController.onQuickScrubEnd(); } } @Override public void onQuickScrubProgress(float progress) { if (mInvalidated) { mLastProgress = progress; if (mInvalidated || mEndPending) { return; } mQuickScrubController.onQuickScrubProgress(progress); Loading Loading
quickstep/src/com/android/quickstep/ActivityControlHelper.java +39 −9 Original line number Diff line number Diff line Loading @@ -35,7 +35,6 @@ import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherAppTransitionManagerImpl; import com.android.launcher3.LauncherInitListener; import com.android.launcher3.LauncherState; import com.android.launcher3.allapps.AllAppsTransitionController; Loading @@ -62,7 +61,13 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { void onQuickstepGestureStarted(T activity, boolean activityVisible); void onQuickInteractionStart(T activity, boolean activityVisible); /** * Updates the UI to indicate quick interaction. * @return true if there any any UI change as a result of this */ boolean onQuickInteractionStart(T activity, boolean activityVisible); void executeOnWindowAvailable(T activity, Runnable action); void executeOnNextDraw(T activity, TaskView targetView, Runnable action); Loading @@ -83,6 +88,9 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { void startRecentsFromSwipe(Intent intent, AssistDataReceiver assistDataReceiver, final RecentsAnimationListener remoteAnimationListener); @Nullable T getCreatedActivity(); @UiThread @Nullable RecentsView getVisibleRecentsView(); Loading @@ -103,8 +111,18 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { } @Override public void onQuickInteractionStart(Launcher activity, boolean activityVisible) { public boolean onQuickInteractionStart(Launcher activity, boolean activityVisible) { LauncherState fromState = activity.getStateManager().getState(); activity.getStateManager().goToState(FAST_OVERVIEW, activityVisible); return !fromState.overviewUi; } @Override public void executeOnWindowAvailable(Launcher activity, Runnable action) { if (activity.getWorkspace().runOnOverlayHidden(action)) { // Notify the activity that qiuckscrub has started onQuickstepGestureStarted(activity, true); } } @Override Loading Loading @@ -210,8 +228,8 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { } @Nullable @UiThread private Launcher getLauncher() { @Override public Launcher getCreatedActivity() { LauncherAppState app = LauncherAppState.getInstanceNoCreate(); if (app == null) { return null; Loading @@ -222,7 +240,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { @Nullable @UiThread private Launcher getVisibleLaucher() { Launcher launcher = getLauncher(); Launcher launcher = getCreatedActivity(); return (launcher != null) && launcher.isStarted() && launcher.hasWindowFocus() ? launcher : null; } Loading Loading @@ -254,8 +272,14 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { } @Override public void onQuickInteractionStart(RecentsActivity activity, boolean activityVisible) { // TODO: public boolean onQuickInteractionStart(RecentsActivity activity, boolean activityVisible) { // Activity does not need any UI change for quickscrub. return false; } @Override public void executeOnWindowAvailable(RecentsActivity activity, Runnable action) { action.run(); } @Override Loading Loading @@ -337,10 +361,16 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { intent, assistDataReceiver, remoteAnimationListener, null, null); } @Nullable @Override public RecentsActivity getCreatedActivity() { return RecentsActivityTracker.getCurrentActivity(); } @Nullable @Override public RecentsView getVisibleRecentsView() { RecentsActivity activity = RecentsActivityTracker.getCurrentActivity(); RecentsActivity activity = getCreatedActivity(); if (activity != null && activity.hasWindowFocus()) { return activity.getOverviewPanel(); } Loading
quickstep/src/com/android/quickstep/TouchInteractionService.java +42 −27 Original line number Diff line number Diff line Loading @@ -21,8 +21,7 @@ import static android.view.MotionEvent.ACTION_MOVE; import static android.view.MotionEvent.ACTION_POINTER_DOWN; import static android.view.MotionEvent.ACTION_POINTER_UP; import static android.view.MotionEvent.ACTION_UP; import static com.android.launcher3.LauncherState.FAST_OVERVIEW; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_NONE; import android.annotation.TargetApi; Loading @@ -43,9 +42,7 @@ import android.view.VelocityTracker; import android.view.View; import android.view.ViewConfiguration; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherState; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.MainThreadExecutor; import com.android.launcher3.R; import com.android.launcher3.util.TraceHelper; Loading Loading @@ -220,13 +217,13 @@ public class TouchInteractionService extends Service { private TouchConsumer getCurrentTouchConsumer( @HitTarget int downHitTarget, boolean forceToLauncher, VelocityTracker tracker) { RunningTaskInfo runningTaskInfo = mAM.getRunningTask(); RunningTaskInfo runningTaskInfo = mAM.getRunningTask(0); if (runningTaskInfo == null && !forceToLauncher) { return mNoOpTouchConsumer; } else if (forceToLauncher || runningTaskInfo.topActivity.equals(mOverviewCommandHelper.launcher)) { return getLauncherConsumer(); return getOverviewConsumer(); } else { if (tracker == null) { tracker = VelocityTracker.obtain(); Loading @@ -238,18 +235,20 @@ public class TouchInteractionService extends Service { } } private TouchConsumer getLauncherConsumer() { Launcher launcher = (Launcher) LauncherAppState.getInstance(this).getModel().getCallback(); if (launcher == null) { private TouchConsumer getOverviewConsumer() { ActivityControlHelper activityHelper = mOverviewCommandHelper.getActivityControlHelper(); BaseDraggingActivity activity = activityHelper.getCreatedActivity(); if (activity == null) { return mNoOpTouchConsumer; } View target = launcher.getDragLayer(); return new LauncherTouchConsumer(launcher, target); return new OverviewTouchConsumer(activityHelper, activity); } private static class LauncherTouchConsumer implements TouchConsumer { private static class OverviewTouchConsumer<T extends BaseDraggingActivity> implements TouchConsumer { private final Launcher mLauncher; private final ActivityControlHelper<T> mActivityHelper; private final T mActivity; private final View mTarget; private final int[] mLocationOnScreen = new int[2]; private final PointF mDownPos = new PointF(); Loading @@ -260,12 +259,17 @@ public class TouchInteractionService extends Service { private boolean mInvalidated = false; private boolean mHadWindowFocusOnDown; LauncherTouchConsumer(Launcher launcher, View target) { mLauncher = launcher; mTarget = target; private float mLastProgress = 0; private boolean mStartPending = false; private boolean mEndPending = false; OverviewTouchConsumer(ActivityControlHelper<T> activityHelper, T activity) { mActivityHelper = activityHelper; mActivity = activity; mTarget = activity.getDragLayer(); mTouchSlop = ViewConfiguration.get(mTarget.getContext()).getScaledTouchSlop(); mQuickScrubController = mLauncher.<RecentsView>getOverviewPanel() mQuickScrubController = mActivity.<RecentsView>getOverviewPanel() .getQuickScrubController(); } Loading Loading @@ -327,16 +331,22 @@ public class TouchInteractionService extends Service { return; } if (interactionType == INTERACTION_QUICK_SCRUB) { mStartPending = true; Runnable action = () -> { LauncherState fromState = mLauncher.getStateManager().getState(); mLauncher.getStateManager().goToState(FAST_OVERVIEW, true); mQuickScrubController.onQuickScrubStart(fromState == NORMAL); }; mQuickScrubController.onQuickScrubStart( mActivityHelper.onQuickInteractionStart(mActivity, true)); mQuickScrubController.onQuickScrubProgress(mLastProgress); mStartPending = false; if (mLauncher.getWorkspace().runOnOverlayHidden(action)) { // Hide the minus one overlay so launcher can get window focus. mLauncher.onQuickstepGestureStarted(true); if (mEndPending) { mQuickScrubController.onQuickScrubEnd(); mEndPending = false; } }; mActivityHelper.executeOnWindowAvailable(mActivity, action); } } Loading @@ -345,12 +355,17 @@ public class TouchInteractionService extends Service { if (mInvalidated) { return; } if (mStartPending) { mEndPending = true; } else { mQuickScrubController.onQuickScrubEnd(); } } @Override public void onQuickScrubProgress(float progress) { if (mInvalidated) { mLastProgress = progress; if (mInvalidated || mEndPending) { return; } mQuickScrubController.onQuickScrubProgress(progress); Loading