diff options
author | Winson Chung <winsonc@google.com> | 2019-06-04 12:20:05 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2019-06-04 12:20:05 -0700 |
commit | a3ed49d566d9c2cabe17d5d4f0026f3d59f0a785 (patch) | |
tree | 09139ba2bf4725ca17c959fca1739034cbfa5053 /quickstep | |
parent | 0ef6fe00b0e2a7ef59db149b5031a0fbcdde86b2 (diff) | |
parent | 8789aa05a1b5af25c727814331ac126a3007c528 (diff) | |
download | android_packages_apps_Trebuchet-a3ed49d566d9c2cabe17d5d4f0026f3d59f0a785.tar.gz android_packages_apps_Trebuchet-a3ed49d566d9c2cabe17d5d4f0026f3d59f0a785.tar.bz2 android_packages_apps_Trebuchet-a3ed49d566d9c2cabe17d5d4f0026f3d59f0a785.zip |
Merging ub-launcher3-qt-dev, build 5633311
Test: Manual
Bug:119330044 P1 [STOPSHIP] Add back shape detection in Launcher icons
Bug:123900446 P1 App to home animation should zoom into the app icon
Bug:132298752 P1 Adding widget locks home screen page
Bug:132757019 P1 Swipe up twice quickly from app in 2 button mode; can't access all apps
Bug:133518678 P1 In 2 button mode, flinging up strongly favours quickswitch
Bug:133806285 P1 All apps causes overview to peek in
Bug:133844237 P1 Respect limited width Exclusion Rects in bottom area?
Bug:133867119 P2 Lab-only flake: want to switch from workspace to all apps; Swipe failed to receive an event for the swipe end
Bug:134062513 P1 Quickswitch sends lifecycle events to -1
Bug:134094839 P1 Launcher kept crashing on OTA update
Bug:134096917 P1 Launcher animation component gets stuck during swipe up
Bug:134164918 P1 STOPSHIP: Disable chips hard-coded value in qt_dev Launcher
Bug:134172603 P1 Tracing for lab-only flakes
Bug:134442147 P1 Sometimes All Apps won't update on app install/uninstall/update
Change-Id: Ia530fbf9bb5fa67b602ce44aef0cc4a1d1494e13
Diffstat (limited to 'quickstep')
14 files changed, 140 insertions, 71 deletions
diff --git a/quickstep/recents_ui_overrides/res/values/dimens.xml b/quickstep/recents_ui_overrides/res/values/dimens.xml index c80e531e6..863a8ba52 100644 --- a/quickstep/recents_ui_overrides/res/values/dimens.xml +++ b/quickstep/recents_ui_overrides/res/values/dimens.xml @@ -27,5 +27,5 @@ <!-- Swipe up to home related --> <dimen name="swipe_up_fling_min_visible_change">18dp</dimen> <dimen name="swipe_up_y_overshoot">10dp</dimen> - <dimen name="swipe_up_max_workspace_trans_y">-80dp</dimen> + <dimen name="swipe_up_max_workspace_trans_y">-60dp</dimen> </resources>
\ No newline at end of file diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java index 4a486f8e5..cb5cbddd4 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java @@ -164,13 +164,6 @@ public class PredictionRowView extends LinearLayout implements mParent = parent; } - private void setPredictionsEnabled(boolean predictionsEnabled) { - if (predictionsEnabled != mPredictionsEnabled) { - mPredictionsEnabled = predictionsEnabled; - updateVisibility(); - } - } - private void updateVisibility() { setVisibility(mPredictionsEnabled ? VISIBLE : GONE); } @@ -220,8 +213,7 @@ public class PredictionRowView extends LinearLayout implements * If the number of predicted apps is the same as the previous list of predicted apps, * we can optimize by swapping them in place. */ - public void setPredictedApps(boolean predictionsEnabled, List<ComponentKeyMapper> apps) { - setPredictionsEnabled(predictionsEnabled); + public void setPredictedApps(List<ComponentKeyMapper> apps) { mPredictedAppComponents.clear(); mPredictedAppComponents.addAll(apps); @@ -237,11 +229,6 @@ public class PredictionRowView extends LinearLayout implements } private void applyPredictionApps() { - if (!mPredictionsEnabled) { - mParent.onHeightUpdated(); - return; - } - if (getChildCount() != mNumPredictedAppsPerRow) { while (getChildCount() > mNumPredictedAppsPerRow) { removeViewAt(0); @@ -282,8 +269,11 @@ public class PredictionRowView extends LinearLayout implements } } - if (predictionCount == 0) { - setPredictionsEnabled(false); + boolean predictionsEnabled = predictionCount > 0; + if (predictionsEnabled != mPredictionsEnabled) { + mPredictionsEnabled = predictionsEnabled; + mLauncher.reapplyUi(); + updateVisibility(); } mParent.onHeightUpdated(); } diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java index 64cb4b465..085bbc4a5 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java @@ -177,16 +177,10 @@ public class PredictionUiStateManager implements OnGlobalLayoutListener, ItemInf } private void applyState(PredictionState state) { - boolean wasEnabled = mCurrentState.isEnabled; mCurrentState = state; if (mAppsView != null) { mAppsView.getFloatingHeaderView().findFixedRowByType(PredictionRowView.class) - .setPredictedApps(mCurrentState.isEnabled, mCurrentState.apps); - - if (wasEnabled != mCurrentState.isEnabled) { - // Reapply state as the State UI might have changed. - Launcher.getLauncher(mAppsView.getContext()).getStateManager().reapplyState(true); - } + .setPredictedApps(mCurrentState.apps); } } diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java index a662d7433..8436fe5f9 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java @@ -32,7 +32,8 @@ import com.android.quickstep.views.TaskView; public class BackgroundAppState extends OverviewState { private static final int STATE_FLAGS = - FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_DISABLE_ACCESSIBILITY; + FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_DISABLE_ACCESSIBILITY + | FLAG_DISABLE_INTERACTION; public BackgroundAppState(int id) { this(id, LauncherLogProto.ContainerType.TASKSWITCHER); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java index f12efc83c..dc58a4efc 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java @@ -70,7 +70,7 @@ public final class FallbackActivityControllerHelper implements } @Override - public void onSwipeUpComplete(RecentsActivity activity) { + public void onSwipeUpToRecentsComplete(RecentsActivity activity) { RecentsView recentsView = activity.getOverviewPanel(); recentsView.getClearAllButton().setVisibilityAlpha(1); recentsView.setDisallowScrollToClearAll(false); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java index 5af09f7fd..d0a41f3b5 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java @@ -91,7 +91,7 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe } @Override - public void onSwipeUpComplete(Launcher activity) { + public void onSwipeUpToRecentsComplete(Launcher activity) { // Re apply state in case we did something funky during the transition. activity.getStateManager().reapplyState(); DiscoveryBounce.showForOverviewIfNeeded(activity); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java index 7563c3f55..294a997f3 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java @@ -58,6 +58,8 @@ import android.view.MotionEvent; import android.view.Surface; import android.view.WindowManager; +import androidx.annotation.BinderThread; + import com.android.launcher3.MainThreadExecutor; import com.android.launcher3.R; import com.android.launcher3.ResourceUtils; @@ -84,6 +86,7 @@ import com.android.systemui.shared.system.InputConsumerController; import com.android.systemui.shared.system.InputMonitorCompat; import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags; +import com.android.systemui.shared.system.SystemGestureExclusionListenerCompat; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -268,6 +271,9 @@ public class TouchInteractionService extends Service implements private final RectF mSwipeTouchRegion = new RectF(); private ComponentName mGestureBlockingActivity; + private Region mExclusionRegion; + private SystemGestureExclusionListenerCompat mExclusionListener; + @Override public void onCreate() { super.onCreate(); @@ -284,14 +290,23 @@ public class TouchInteractionService extends Service implements mIsUserUnlocked = false; registerReceiver(mUserUnlockedReceiver, new IntentFilter(Intent.ACTION_USER_UNLOCKED)); } - onNavigationModeChanged(SysUINavigationMode.INSTANCE.get(this).addModeChangeListener(this)); mDefaultDisplayId = getSystemService(WindowManager.class).getDefaultDisplay() .getDisplayId(); - String blockingActivity = getString(R.string.gesture_blocking_activity); mGestureBlockingActivity = TextUtils.isEmpty(blockingActivity) ? null : ComponentName.unflattenFromString(blockingActivity); + + mExclusionListener = new SystemGestureExclusionListenerCompat(mDefaultDisplayId) { + @Override + @BinderThread + public void onExclusionChanged(Region region) { + // Assignments are atomic, it should be safe on binder thread + mExclusionRegion = region; + } + }; + + onNavigationModeChanged(SysUINavigationMode.INSTANCE.get(this).addModeChangeListener(this)); sConnected = true; } @@ -370,6 +385,12 @@ public class TouchInteractionService extends Service implements disposeEventHandlers(); initInputMonitor(); + + if (mMode == Mode.NO_BUTTON) { + mExclusionListener.register(); + } else { + mExclusionListener.unregister(); + } } @Override @@ -437,6 +458,7 @@ public class TouchInteractionService extends Service implements sConnected = false; Utilities.unregisterReceiverSafely(this, mUserUnlockedReceiver); SysUINavigationMode.INSTANCE.get(this).removeModeChangeListener(this); + mExclusionListener.unregister(); super.onDestroy(); } @@ -557,10 +579,15 @@ public class TouchInteractionService extends Service implements final ActivityControlHelper activityControl = mOverviewComponentObserver.getActivityControlHelper(); boolean shouldDefer = activityControl.deferStartingActivity(mActiveNavBarRegion, event); + + // mExclusionRegion can change on binder thread, use a local instance here. + Region exclusionRegion = mExclusionRegion; + boolean disableHorizontalSwipe = mMode == Mode.NO_BUTTON && exclusionRegion != null + && exclusionRegion.contains((int) event.getX(), (int) event.getY()); return new OtherActivityInputConsumer(this, runningTaskInfo, mRecentsModel, mOverviewComponentObserver.getOverviewIntent(), activityControl, shouldDefer, mOverviewCallbacks, mInputConsumer, this::onConsumerInactive, - mSwipeSharedState, mInputMonitorCompat, mSwipeTouchRegion); + mSwipeSharedState, mInputMonitorCompat, mSwipeTouchRegion, disableHorizontalSwipe); } private InputConsumer createDeviceLockedInputConsumer(RunningTaskInfo taskInfo) { diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java index 0d0478ae0..87b732664 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -19,6 +19,7 @@ import static com.android.launcher3.BaseActivity.INVISIBLE_BY_STATE_HANDLER; import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS; import static com.android.launcher3.Utilities.SINGLE_FRAME_MS; import static com.android.launcher3.Utilities.postAsyncCallback; +import static com.android.launcher3.anim.Interpolators.ACCEL_1_5; import static com.android.launcher3.anim.Interpolators.DEACCEL; import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN; import static com.android.launcher3.anim.Interpolators.LINEAR; @@ -106,7 +107,6 @@ import com.android.quickstep.views.TaskView; import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.system.InputConsumerController; import com.android.systemui.shared.system.LatencyTrackerCompat; -import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat; import com.android.systemui.shared.system.WindowCallbacksCompat; @@ -353,7 +353,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> | STATE_LAUNCHER_DRAWN | STATE_SCALED_CONTROLLER_RECENTS | STATE_CURRENT_TASK_FINISHED | STATE_GESTURE_COMPLETED | STATE_GESTURE_STARTED, - this::setupLauncherUiAfterSwipeUpAnimation); + this::setupLauncherUiAfterSwipeUpToRecentsAnimation); mStateCallback.addCallback(STATE_HANDLER_INVALIDATED, this::invalidateHandler); mStateCallback.addCallback(STATE_LAUNCHER_PRESENT | STATE_HANDLER_INVALIDATED, @@ -647,6 +647,12 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> } private void buildAnimationController() { + if (mGestureEndTarget == HOME || (mLauncherTransitionController != null + && mLauncherTransitionController.getAnimationPlayer().isStarted())) { + // We don't want a new mLauncherTransitionController if mGestureEndTarget == HOME (it + // has its own animation) or if we're already animating the current controller. + return; + } initTransitionEndpoints(mActivity.getDeviceProfile()); mAnimationFactory.createActivityController(mTransitionDragLength); } @@ -902,10 +908,14 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> // If swiping at a diagonal, base end target on the faster velocity. endTarget = goingToNewTask && Math.abs(velocity.x) > Math.abs(endVelocity) ? NEW_TASK : HOME; - } else if (endVelocity < 0 && (!goingToNewTask || reachedOverviewThreshold)) { - // If user scrolled to a new task, only go to recents if they already passed - // the overview threshold. Otherwise, we'll snap to the new task and launch it. - endTarget = RECENTS; + } else if (endVelocity < 0) { + if (reachedOverviewThreshold) { + endTarget = RECENTS; + } else { + // If swiping at a diagonal, base end target on the faster velocity. + endTarget = goingToNewTask && Math.abs(velocity.x) > Math.abs(endVelocity) + ? NEW_TASK : RECENTS; + } } else { endTarget = goingToNewTask ? NEW_TASK : LAST_TASK; } @@ -976,6 +986,12 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> } else if (endTarget == RECENTS) { mLiveTileOverlay.startIconAnimation(); if (mRecentsView != null) { + int nearestPage = mRecentsView.getPageNearestToCenterOfScreen(); + if (mRecentsView.getNextPage() != nearestPage) { + // We shouldn't really scroll to the next page when swiping up to recents. + // Only allow settling on the next page if it's nearest to the center. + mRecentsView.snapToPage(nearestPage, Math.toIntExact(duration)); + } if (mRecentsView.getScroller().getDuration() > MAX_SWIPE_DURATION) { mRecentsView.snapToPage(mRecentsView.getNextPage(), (int) MAX_SWIPE_DURATION); } @@ -1057,8 +1073,8 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> setStateOnUiThread(target.endState); } }); - homeAnimFactory.playAtomicAnimation(velocityPxPerMs.y); windowAnim.start(velocityPxPerMs); + homeAnimFactory.playAtomicAnimation(velocityPxPerMs.y); mRunningWindowAnim = RunningWindowAnim.wrap(windowAnim); mLauncherTransitionController = null; } else { @@ -1131,16 +1147,25 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> AnimatorPlaybackController homeAnim = homeAnimationFactory.createActivityAnimationToHome(); + // End on a "round-enough" radius so that the shape reveal doesn't have to do too much + // rounding at the end of the animation. + float startRadius = mClipAnimationHelper.getCurrentCornerRadius(); + float endRadius = startRect.width() / 6f; // We want the window alpha to be 0 once this threshold is met, so that the // FolderIconView can be seen morphing into the icon shape. final float windowAlphaThreshold = isFloatingIconView ? 1f - SHAPE_PROGRESS_DURATION : 1f; anim.addOnUpdateListener((currentRect, progress) -> { homeAnim.setPlayFraction(progress); - float windowAlpha = Math.max(0, Utilities.mapToRange(progress, 0, - windowAlphaThreshold, 1f, 0f, Interpolators.LINEAR)); + float alphaProgress = ACCEL_1_5.getInterpolation(progress); + float windowAlpha = Utilities.boundToRange(Utilities.mapToRange(alphaProgress, 0, + windowAlphaThreshold, 1.5f, 0f, Interpolators.LINEAR), 0, 1); mTransformParams.setProgress(progress) .setCurrentRectAndTargetAlpha(currentRect, windowAlpha); + if (isFloatingIconView) { + mTransformParams.setCornerRadius(endRadius * progress + startRadius + * (1f - progress)); + } mClipAnimationHelper.applyTransform(targetSet, mTransformParams, false /* launcherOnTop */); @@ -1254,12 +1279,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> } private void invalidateHandlerWithLauncher() { - if (mLauncherTransitionController != null) { - if (mLauncherTransitionController.getAnimationPlayer().isStarted()) { - mLauncherTransitionController.getAnimationPlayer().cancel(); - } - mLauncherTransitionController = null; - } + endLauncherTransitionController(); mRecentsView.onGestureAnimationEnd(); @@ -1267,6 +1287,13 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> mActivity.getRootView().getOverlay().remove(mLiveTileOverlay); } + private void endLauncherTransitionController() { + if (mLauncherTransitionController != null) { + mLauncherTransitionController.getAnimationPlayer().end(); + mLauncherTransitionController = null; + } + } + private void notifyTransitionCancelled() { mAnimationFactory.onTransitionCancelled(); } @@ -1368,12 +1395,9 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> doLogGesture(HOME); } - private void setupLauncherUiAfterSwipeUpAnimation() { - if (mLauncherTransitionController != null) { - mLauncherTransitionController.getAnimationPlayer().end(); - mLauncherTransitionController = null; - } - mActivityControlHelper.onSwipeUpComplete(mActivity); + private void setupLauncherUiAfterSwipeUpToRecentsAnimation() { + endLauncherTransitionController(); + mActivityControlHelper.onSwipeUpToRecentsComplete(mActivity); mRecentsAnimationWrapper.setCancelWithDeferredScreenshot(true); mRecentsView.onSwipeUpAnimationSuccess(); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java index bf276e1e1..837423ace 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java @@ -62,6 +62,10 @@ public class AssistantTouchConsumer extends DelegateInputConsumer private static final String TAG = "AssistantTouchConsumer"; private static final long RETRACT_ANIMATION_DURATION_MS = 300; + // From //java/com/google/android/apps/gsa/search/shared/util/OpaContract.java. + private static final String OPA_BUNDLE_TRIGGER = "triggered_by"; + // From //java/com/google/android/apps/gsa/assistant/shared/proto/opa_trigger.proto. + private static final int OPA_BUNDLE_TRIGGER_DIAG_SWIPE_GESTURE = 83; private static final String INVOCATION_TYPE_KEY = "invocation_type"; private static final int INVOCATION_TYPE_GESTURE = 1; private static final int INVOCATION_TYPE_FLING = 6; @@ -230,6 +234,7 @@ public class AssistantTouchConsumer extends DelegateInputConsumer startAssistantInternal(SWIPE); Bundle args = new Bundle(); + args.putInt(OPA_BUNDLE_TRIGGER, OPA_BUNDLE_TRIGGER_DIAG_SWIPE_GESTURE); args.putInt(INVOCATION_TYPE_KEY, INVOCATION_TYPE_GESTURE); mSysUiProxy.startAssistant(args); mLaunchedAssistant = true; diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java index b0acffa39..0ed4c99a6 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java @@ -111,6 +111,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC private final float mDragSlop; private final float mSquaredTouchSlop; + private final boolean mDisableHorizontalSwipe; // Slop used to check when we start moving window. private boolean mPassedDragSlop; @@ -132,7 +133,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC InputConsumerController inputConsumer, Consumer<OtherActivityInputConsumer> onCompleteCallback, SwipeSharedState swipeSharedState, InputMonitorCompat inputMonitorCompat, - RectF swipeTouchRegion) { + RectF swipeTouchRegion, boolean disableHorizontalSwipe) { super(base); mMainThreadHandler = new Handler(Looper.getMainLooper()); @@ -162,6 +163,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC mSquaredTouchSlop = slop * slop; mPassedTouchSlop = mPassedDragSlop = continuingPreviousGesture; + mDisableHorizontalSwipe = !mPassedTouchSlop && disableHorizontalSwipe; } @Override @@ -169,6 +171,13 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC return TYPE_OTHER_ACTIVITY; } + private void forceCancelGesture(MotionEvent ev) { + int action = ev.getAction(); + ev.setAction(ACTION_CANCEL); + finishTouchTracking(ev); + ev.setAction(action); + } + @Override public void onMotionEvent(MotionEvent ev) { if (mVelocityTracker == null) { @@ -216,10 +225,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC // Cancel interaction in case of multi-touch interaction int ptrIdx = ev.getActionIndex(); if (!mSwipeTouchRegion.contains(ev.getX(ptrIdx), ev.getY(ptrIdx))) { - int action = ev.getAction(); - ev.setAction(ACTION_CANCEL); - finishTouchTracking(ev); - ev.setAction(action); + forceCancelGesture(ev); } } break; @@ -258,7 +264,15 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC } if (!mPassedTouchSlop) { - if (squaredHypot(displacementX, mLastPos.y - mDownPos.y) >= mSquaredTouchSlop) { + float displacementY = mLastPos.y - mDownPos.y; + if (squaredHypot(displacementX, displacementY) >= mSquaredTouchSlop) { + if (mDisableHorizontalSwipe + && Math.abs(displacementX) > Math.abs(displacementY)) { + // Horizontal gesture is not allowed in this region + forceCancelGesture(ev); + break; + } + mPassedTouchSlop = true; if (mIsDeferredDownTarget) { diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java index 0ae469c70..19a496346 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java @@ -197,10 +197,15 @@ public class ClipAnimationHelper { mTmpMatrix.postTranslate(app.position.x, app.position.y); mClipRectF.roundOut(crop); if (mSupportsRoundedCornersOnWindows) { - float windowCornerRadius = mUseRoundedCornersOnWindows - ? mWindowCornerRadius : 0; - cornerRadius = Utilities.mapRange(progress, windowCornerRadius, - mTaskCornerRadius); + if (params.cornerRadius > -1) { + cornerRadius = params.cornerRadius; + scale = params.currentRect.width() / crop.width(); + } else { + float windowCornerRadius = mUseRoundedCornersOnWindows + ? mWindowCornerRadius : 0; + cornerRadius = Utilities.mapRange(progress, windowCornerRadius, + mTaskCornerRadius); + } mCurrentCornerRadius = cornerRadius; } } @@ -355,6 +360,7 @@ public class ClipAnimationHelper { @Nullable RectF currentRect; float targetAlpha; boolean forLiveTile; + float cornerRadius; SyncRtSurfaceTransactionApplierCompat syncTransactionApplier; @@ -365,6 +371,7 @@ public class ClipAnimationHelper { currentRect = null; targetAlpha = 0; forLiveTile = false; + cornerRadius = -1; } public TransformParams setProgress(float progress) { @@ -373,6 +380,11 @@ public class ClipAnimationHelper { return this; } + public TransformParams setCornerRadius(float cornerRadius) { + this.cornerRadius = cornerRadius; + return this; + } + public TransformParams setCurrentRectAndTargetAlpha(RectF currentRect, float targetAlpha) { this.currentRect = currentRect; this.targetAlpha = targetAlpha; diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java index 93b6e4ba5..837c2dc93 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java @@ -44,14 +44,13 @@ import static com.android.launcher3.anim.Interpolators.LINEAR; */ public class StaggeredWorkspaceAnim { - private static final int APP_CLOSE_ROW_START_DELAY_MS = 16; - private static final int ALPHA_DURATION_MS = 200; + private static final int APP_CLOSE_ROW_START_DELAY_MS = 10; + private static final int ALPHA_DURATION_MS = 250; private static final float MAX_VELOCITY_PX_PER_S = 22f; - private static final float DAMPING_RATIO = - (SpringForce.DAMPING_RATIO_MEDIUM_BOUNCY + SpringForce.DAMPING_RATIO_LOW_BOUNCY) / 2f; - private static final float STIFFNESS = SpringForce.STIFFNESS_LOW; + private static final float DAMPING_RATIO = 0.7f; + private static final float STIFFNESS = 150f; private final float mVelocity; private final float mSpringTransY; @@ -71,9 +70,9 @@ public class StaggeredWorkspaceAnim { // Scale the translationY based on the initial velocity to better sync the workspace items // with the floating view. - float transFactor = 0.1f + 0.9f * Math.abs(velocity) / MAX_VELOCITY_PX_PER_S; + float transFactor = 0.2f + 0.9f * Math.abs(velocity) / MAX_VELOCITY_PX_PER_S; mSpringTransY = transFactor * launcher.getResources() - .getDimensionPixelSize(R.dimen.swipe_up_max_workspace_trans_y);; + .getDimensionPixelSize(R.dimen.swipe_up_max_workspace_trans_y); DeviceProfile grid = launcher.getDeviceProfile(); ShortcutAndWidgetContainer currentPage = ((CellLayout) launcher.getWorkspace() diff --git a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java index 79540c164..dcf2e3c15 100644 --- a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java +++ b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java @@ -119,6 +119,9 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans private static final long APP_LAUNCH_ALPHA_DOWN_DURATION = (long) (APP_LAUNCH_ALPHA_DURATION * APP_LAUNCH_DOWN_DUR_SCALE_FACTOR); + private static final long CROP_DURATION = 375; + private static final long RADIUS_DURATION = 375; + public static final int RECENTS_LAUNCH_DURATION = 336; private static final int LAUNCHER_RESUME_START_DELAY = 100; private static final int CLOSING_TRANSITION_DURATION_MS = 250; @@ -494,10 +497,10 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans EXAGGERATED_EASE); FloatProp mIconAlpha = new FloatProp(1f, 0f, APP_LAUNCH_ALPHA_START_DELAY, alphaDuration, LINEAR); - FloatProp mCroppedSize = new FloatProp(startCrop, endCrop, 0, APP_LAUNCH_DURATION, + FloatProp mCroppedSize = new FloatProp(startCrop, endCrop, 0, CROP_DURATION, EXAGGERATED_EASE); FloatProp mWindowRadius = new FloatProp(startCrop / 2f, windowRadius, 0, - APP_LAUNCH_DURATION, EXAGGERATED_EASE); + RADIUS_DURATION, EXAGGERATED_EASE); @Override public void onUpdate(float percent) { diff --git a/quickstep/src/com/android/quickstep/ActivityControlHelper.java b/quickstep/src/com/android/quickstep/ActivityControlHelper.java index 279a94619..b17d8d69c 100644 --- a/quickstep/src/com/android/quickstep/ActivityControlHelper.java +++ b/quickstep/src/com/android/quickstep/ActivityControlHelper.java @@ -51,7 +51,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { int getSwipeUpDestinationAndLength(DeviceProfile dp, Context context, Rect outRect); - void onSwipeUpComplete(T activity); + void onSwipeUpToRecentsComplete(T activity); void onAssistantVisibilityChanged(float visibility); |