diff --git a/protos/launcher_atom.proto b/protos/launcher_atom.proto index f1db144604..5f5fab0f8c 100644 --- a/protos/launcher_atom.proto +++ b/protos/launcher_atom.proto @@ -49,15 +49,26 @@ message ContainerInfo { FolderContainer folder = 3; AllAppsContainer all_apps_container = 4; WidgetsContainer widgets_container = 5; + PredictionContainer prediction_container = 6; + SearchResultContainer search_result_container = 7; } } +// Represents the apps list sorted alphabetically inside the all-apps view. message AllAppsContainer { } message WidgetsContainer { } +// Represents the predicted apps row(top row) in the all-apps view. +message PredictionContainer { +} + +// Represents the apps container within search results. +message SearchResultContainer { +} + enum Origin { UNKNOWN = 0; DEFAULT_LAYOUT = 1; // icon automatically placed in workspace, folder, hotseat diff --git a/quickstep/recents_ui_overrides/res/layout/fallback_recents_activity.xml b/quickstep/recents_ui_overrides/res/layout/fallback_recents_activity.xml index ffe906c179..7b3e37835f 100644 --- a/quickstep/recents_ui_overrides/res/layout/fallback_recents_activity.xml +++ b/quickstep/recents_ui_overrides/res/layout/fallback_recents_activity.xml @@ -18,6 +18,7 @@ android:id="@+id/drag_layer" android:layout_width="match_parent" android:layout_height="match_parent" + android:clipChildren="false" android:fitsSystemWindows="true"> appInfos, IntArray ranks) { super.bindPredictedItems(appInfos, ranks); 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 fa0d3f347b..8ff05f2aaa 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 @@ -45,8 +45,10 @@ public class BackgroundAppState extends OverviewState { if (launcher.getDeviceProfile().isVerticalBarLayout()) { return super.getVerticalProgress(launcher); } + RecentsView recentsView = launcher.getOverviewPanel(); int transitionLength = LayoutUtils.getShelfTrackingDistance(launcher, - launcher.getDeviceProfile()); + launcher.getDeviceProfile(), + recentsView.getPagedOrientationHandler()); AllAppsTransitionController controller = launcher.getAllAppsController(); float scrollRange = Math.max(controller.getShiftRange(), 1); float progressDelta = (transitionLength / scrollRange); @@ -73,9 +75,11 @@ public class BackgroundAppState extends OverviewState { public ScaleAndTranslation getHotseatScaleAndTranslation(Launcher launcher) { if ((getVisibleElements(launcher) & HOTSEAT_ICONS) != 0) { // Translate hotseat offscreen if we show it in overview. + RecentsView recentsView = launcher.getOverviewPanel(); ScaleAndTranslation scaleAndTranslation = super.getHotseatScaleAndTranslation(launcher); scaleAndTranslation.translationY += LayoutUtils.getShelfTrackingDistance(launcher, - launcher.getDeviceProfile()); + launcher.getDeviceProfile(), + recentsView.getPagedOrientationHandler()); return scaleAndTranslation; } return super.getHotseatScaleAndTranslation(launcher); diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java index 9b4e8906a1..d174bfd2d9 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java @@ -19,8 +19,7 @@ import static com.android.launcher3.anim.Interpolators.DEACCEL_2; import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS; import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; -import static com.android.quickstep.SysUINavigationMode.Mode.TWO_BUTTONS; -import static com.android.quickstep.SysUINavigationMode.getMode; +import static com.android.quickstep.SysUINavigationMode.hideShelfInTwoButtonLandscape; import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; import android.content.Context; @@ -130,10 +129,8 @@ public class OverviewState extends LauncherState { @Override public int getVisibleElements(Launcher launcher) { RecentsView recentsView = launcher.getOverviewPanel(); - boolean hideShelfTwoButtonLandscape = getMode(launcher) == TWO_BUTTONS && - !recentsView.getPagedOrientationHandler().isLayoutNaturalToLauncher(); if (ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(launcher) || - hideShelfTwoButtonLandscape) { + hideShelfInTwoButtonLandscape(launcher, recentsView.getPagedOrientationHandler())) { return OVERVIEW_BUTTONS; } else if (launcher.getDeviceProfile().isVerticalBarLayout()) { return VERTICAL_SWIPE_INDICATOR | OVERVIEW_BUTTONS; diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java index 11593a16c1..94c7771513 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java @@ -49,64 +49,62 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_S import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE; import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; -import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET; import android.animation.Animator; import android.animation.AnimatorSet; -import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.view.View; import android.view.animation.Interpolator; import com.android.launcher3.CellLayout; import com.android.launcher3.Hotseat; +import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.LauncherState.ScaleAndTranslation; import com.android.launcher3.Workspace; import com.android.launcher3.allapps.AllAppsContainerView; import com.android.launcher3.allapps.AllAppsTransitionController; -import com.android.launcher3.anim.SpringAnimationBuilder; import com.android.launcher3.statemanager.StateManager; -import com.android.launcher3.statemanager.StateManager.AtomicAnimationFactory; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.quickstep.SysUINavigationMode; +import com.android.quickstep.util.RecentsAtomicAnimationFactory; import com.android.quickstep.views.RecentsView; /** * Animation factory for quickstep specific transitions */ -public class QuickstepAtomicAnimationFactory extends AtomicAnimationFactory { +public class QuickstepAtomicAnimationFactory extends + RecentsAtomicAnimationFactory { // Scale recents takes before animating in private static final float RECENTS_PREPARE_SCALE = 1.33f; - public static final int INDEX_SHELF_ANIM = 0; - public static final int INDEX_RECENTS_FADE_ANIM = 1; - public static final int INDEX_RECENTS_TRANSLATE_X_ANIM = 2; - public static final int INDEX_PAUSE_TO_OVERVIEW_ANIM = 3; - private static final int ANIM_COUNT = 4; + public static final int INDEX_SHELF_ANIM = RecentsAtomicAnimationFactory.NEXT_INDEX + 0; + public static final int INDEX_PAUSE_TO_OVERVIEW_ANIM = + RecentsAtomicAnimationFactory.NEXT_INDEX + 1; + + private static final int MY_ANIM_COUNT = 2; + protected static final int NEXT_INDEX = RecentsAtomicAnimationFactory.NEXT_INDEX + + MY_ANIM_COUNT; public static final long ATOMIC_DURATION_FROM_PAUSED_TO_OVERVIEW = 300; - private final QuickstepLauncher mLauncher; - - public QuickstepAtomicAnimationFactory(QuickstepLauncher launcher) { - super(ANIM_COUNT); - mLauncher = launcher; + public QuickstepAtomicAnimationFactory(QuickstepLauncher activity) { + super(activity, MY_ANIM_COUNT); } @Override public Animator createStateElementAnimation(int index, float... values) { switch (index) { case INDEX_SHELF_ANIM: { - AllAppsTransitionController aatc = mLauncher.getAllAppsController(); + AllAppsTransitionController aatc = mActivity.getAllAppsController(); Animator springAnim = aatc.createSpringAnimation(values); - if ((OVERVIEW.getVisibleElements(mLauncher) & HOTSEAT_ICONS) != 0) { + if ((OVERVIEW.getVisibleElements(mActivity) & HOTSEAT_ICONS) != 0) { // Translate hotseat with the shelf until reaching overview. - float overviewProgress = OVERVIEW.getVerticalProgress(mLauncher); - ScaleAndTranslation sat = OVERVIEW.getHotseatScaleAndTranslation(mLauncher); + float overviewProgress = OVERVIEW.getVerticalProgress(mActivity); + ScaleAndTranslation sat = OVERVIEW.getHotseatScaleAndTranslation(mActivity); float shiftRange = aatc.getShiftRange(); if (values.length == 1) { values = new float[] {aatc.getProgress(), values[0]}; @@ -114,9 +112,9 @@ public class QuickstepAtomicAnimationFactory extends AtomicAnimationFactory { float progress = (Float) anim.getAnimatedValue(); - if (progress >= overviewProgress || mLauncher.isInState(BACKGROUND_APP)) { + if (progress >= overviewProgress || mActivity.isInState(BACKGROUND_APP)) { float hotseatShift = (progress - overviewProgress) * shiftRange; - mLauncher.getHotseat().setTranslationY(hotseatShift + sat.translationY); + mActivity.getHotseat().setTranslationY(hotseatShift + sat.translationY); } }); hotseatAnim.setInterpolator(LINEAR); @@ -130,34 +128,21 @@ public class QuickstepAtomicAnimationFactory extends AtomicAnimationFactory stateManager = mLauncher.getStateManager(); + StateManager stateManager = mActivity.getStateManager(); return stateManager.createAtomicAnimation( stateManager.getCurrentStableState(), OVERVIEW, config); } - default: return super.createStateElementAnimation(index, values); } @@ -172,7 +157,7 @@ public class QuickstepAtomicAnimationFactory extends AtomicAnimationFactory 0; if (!isHotseatVisible) { hotseat.setScaleX(0.92f); hotseat.setScaleY(0.92f); if (ENABLE_OVERVIEW_ACTIONS.get()) { - AllAppsContainerView qsbContainer = mLauncher.getAppsView(); + AllAppsContainerView qsbContainer = mActivity.getAppsView(); View qsb = qsbContainer.getSearchView(); boolean qsbVisible = qsb.getVisibility() == VISIBLE && qsb.getAlpha() > 0; if (!qsbVisible) { @@ -209,7 +194,7 @@ public class QuickstepAtomicAnimationFactory extends AtomicAnimationFactory> extend controller.dispatchOnStart(); controller.getAnimationPlayer().end(); }); - factory.onRemoteAnimationReceived(null); factory.createActivityInterface(RECENTS_LAUNCH_DURATION); factory.setRecentsAttachedToAppWindow(true, false); mActivity = activity; @@ -137,10 +136,13 @@ final class AppToOverviewAnimationProvider> extend new SyncRtSurfaceTransactionApplierCompat(mActivity.getRootView())); AnimatedFloat recentsAlpha = new AnimatedFloat(() -> { }); - params.setBaseAlphaCallback((t, a) -> recentsAlpha.value); + params.setBaseBuilderProxy((builder, app, p) + -> builder.withAlpha(recentsAlpha.value)); Interpolator taskInterpolator; if (targets.isAnimatingHome()) { + params.setHomeBuilderProxy((builder, app, p) -> builder.withAlpha(1 - p.getProgress())); + taskInterpolator = TOUCH_RESPONSE_INTERPOLATOR; pa.addFloat(recentsAlpha, AnimatedFloat.VALUE, 0, 1, TOUCH_RESPONSE_INTERPOLATOR); } else { diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java index 614ba46503..5b396dd547 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java @@ -55,7 +55,6 @@ import com.android.launcher3.views.FloatingIconView; import com.android.quickstep.RecentsAnimationCallbacks.RecentsAnimationListener; import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.util.ActivityInitListener; -import com.android.quickstep.util.AppWindowAnimationHelper; import com.android.quickstep.util.RectFSpringAnim; import com.android.quickstep.util.TaskViewSimulator; import com.android.quickstep.util.TransformParams; @@ -234,7 +233,6 @@ public abstract class BaseSwipeUpHandler, Q extend } mCanceled = false; } - ActiveGestureLog.INSTANCE.addLog("finishRecentsAnimation", true); } /** @@ -247,7 +245,9 @@ public abstract class BaseSwipeUpHandler, Q extend protected void onRestartLastAppearedTask() { // Finish the controller here, since we won't get onTaskAppeared() for a task that already // appeared. - mRecentsAnimationController.finish(false, null); + if (mRecentsAnimationController != null) { + mRecentsAnimationController.finish(false, null); + } } /** @@ -329,6 +329,7 @@ public abstract class BaseSwipeUpHandler, Q extend mRecentsAnimationController.finish(false /* toRecents */, null /* onFinishComplete */); mActivityInterface.onLaunchTaskSuccess(); + ActiveGestureLog.INSTANCE.addLog("finishRecentsAnimation", false); } } } @@ -357,12 +358,13 @@ public abstract class BaseSwipeUpHandler, Q extend protected void initTransitionEndpoints(DeviceProfile dp) { mDp = dp; - mTransitionDragLength = mActivityInterface.getSwipeUpDestinationAndLength( - dp, mContext, TEMP_RECT); mTaskViewSimulator.setDp(dp); mTaskViewSimulator.setLayoutRotation( mDeviceState.getCurrentActiveRotation(), mDeviceState.getDisplayRotation()); + mTransitionDragLength = mActivityInterface.getSwipeUpDestinationAndLength( + dp, mContext, TEMP_RECT, + mTaskViewSimulator.getOrientationState().getOrientationHandler()); if (mDeviceState.isFullyGesturalNavMode()) { // We can drag all the way to the top of the screen. @@ -510,8 +512,8 @@ public abstract class BaseSwipeUpHandler, Q extend public interface Factory { - BaseSwipeUpHandler newHandler(GestureState gestureState, long touchTimeMs, - boolean continuingLastGesture, boolean isLikelyToStartNewTask); + BaseSwipeUpHandler newHandler( + GestureState gestureState, long touchTimeMs, boolean continuingLastGesture); } protected interface RunningWindowAnim { diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java similarity index 90% rename from quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java rename to quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java index a8fa630b7b..46799ff272 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java @@ -17,7 +17,6 @@ package com.android.quickstep; 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.LauncherState.NORMAL; import static com.android.launcher3.anim.Interpolators.DEACCEL; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2; @@ -38,29 +37,24 @@ import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.PEEK; import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD; import android.animation.Animator; -import android.animation.AnimatorSet; import android.animation.TimeInterpolator; import android.animation.ValueAnimator; import android.annotation.TargetApi; import android.content.Context; import android.content.Intent; import android.graphics.PointF; -import android.graphics.RectF; import android.os.Build; import android.os.SystemClock; -import android.os.UserHandle; import android.view.View; import android.view.View.OnApplyWindowInsetsListener; import android.view.ViewTreeObserver.OnDrawListener; import android.view.WindowInsets; import android.view.animation.Interpolator; -import androidx.annotation.NonNull; import androidx.annotation.UiThread; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.DeviceProfile; -import com.android.launcher3.Launcher; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimationSuccessListener; @@ -72,7 +66,6 @@ import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.util.TraceHelper; -import com.android.launcher3.views.FloatingIconView; import com.android.quickstep.BaseActivityInterface.AnimationFactory; import com.android.quickstep.GestureState.GestureEndTarget; import com.android.quickstep.inputconsumers.OverviewInputConsumer; @@ -80,8 +73,6 @@ import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.util.RectFSpringAnim; import com.android.quickstep.util.ShelfPeekAnim; import com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState; -import com.android.quickstep.util.StaggeredWorkspaceAnim; -import com.android.quickstep.util.TransformParams.TargetAlphaProvider; import com.android.quickstep.views.LiveTileOverlay; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; @@ -92,11 +83,12 @@ import com.android.systemui.shared.system.RemoteAnimationTargetCompat; /** * Handles the navigation gestures when Launcher is the default home activity. + * TODO: Merge this with BaseSwipeUpHandler */ @TargetApi(Build.VERSION_CODES.O) -public class LauncherSwipeHandler extends BaseSwipeUpHandler - implements OnApplyWindowInsetsListener { - private static final String TAG = LauncherSwipeHandler.class.getSimpleName(); +public abstract class BaseSwipeUpHandlerV2, Q extends RecentsView> + extends BaseSwipeUpHandler implements OnApplyWindowInsetsListener { + private static final String TAG = BaseSwipeUpHandlerV2.class.getSimpleName(); private static final String[] STATE_NAMES = DEBUG_STATES ? new String[16] : null; @@ -108,9 +100,11 @@ public class LauncherSwipeHandler extends BaseSwipeUpHandler