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

Commit 019f8a64 authored by Alex Chau's avatar Alex Chau Committed by Android (Google) Code Review
Browse files

Merge "Remove focus task" into tm-qpr-dev

parents 3addf0b6 aec9d313
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -678,7 +678,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
            @Override
            public void onMotionPauseDetected() {
                mHasMotionEverBeenPaused = true;
                maybeUpdateRecentsAttachedState(true/* animate */, true/* moveFocusedTask */);
                maybeUpdateRecentsAttachedState(true/* animate */, true/* moveRunningTask */);
                Optional.ofNullable(mActivityInterface.getTaskbarController())
                        .ifPresent(TaskbarUIController::startTranslationSpring);
                performHapticFeedback();
@@ -696,7 +696,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
    }

    private void maybeUpdateRecentsAttachedState(boolean animate) {
        maybeUpdateRecentsAttachedState(animate, false /* moveFocusedTask */);
        maybeUpdateRecentsAttachedState(animate, false /* moveRunningTask */);
    }

    /**
@@ -706,9 +706,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
     *
     * Note this method has no effect unless the navigation mode is NO_BUTTON.
     * @param animate whether to animate when attaching RecentsView
     * @param moveFocusedTask whether to move focused task to front when attaching
     * @param moveRunningTask whether to move running task to front when attaching
     */
    private void maybeUpdateRecentsAttachedState(boolean animate, boolean moveFocusedTask) {
    private void maybeUpdateRecentsAttachedState(boolean animate, boolean moveRunningTask) {
        if (!mDeviceState.isFullyGesturalNavMode() || mRecentsView == null) {
            return;
        }
@@ -727,11 +727,11 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
        } else {
            recentsAttachedToAppWindow = mHasMotionEverBeenPaused || mIsLikelyToStartNewTask;
        }
        if (moveFocusedTask && !mAnimationFactory.hasRecentsEverAttachedToAppWindow()
        if (moveRunningTask && !mAnimationFactory.hasRecentsEverAttachedToAppWindow()
                && recentsAttachedToAppWindow) {
            // Only move focused task if RecentsView has never been attached before, to avoid
            // Only move running task if RecentsView has never been attached before, to avoid
            // TaskView jumping to new position as we move the tasks.
            mRecentsView.moveFocusedTaskToFront();
            mRecentsView.moveRunningTaskToFront();
        }
        mAnimationFactory.setRecentsAttachedToAppWindow(recentsAttachedToAppWindow, animate);

+35 −20
Original line number Diff line number Diff line
@@ -231,17 +231,20 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
    /**
     * Calculates the taskView size for the provided device configuration.
     */
    public final void calculateTaskSize(Context context, DeviceProfile dp, Rect outRect) {
        Resources res = context.getResources();
        float maxScale = res.getFloat(R.dimen.overview_max_scale);
    public final void calculateTaskSize(Context context, DeviceProfile dp, Rect outRect,
            PagedOrientationHandler orientedState) {
        if (dp.isTablet) {
            Rect gridRect = new Rect();
            calculateGridSize(dp, gridRect);

            calculateTaskSizeInternal(context, dp, gridRect, maxScale, Gravity.CENTER, outRect);
            if (FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get()) {
                calculateGridTaskSize(context, dp, outRect, orientedState);
            } else {
                calculateFocusTaskSize(context, dp, outRect);
            }
        } else {
            Resources res = context.getResources();
            float maxScale = res.getFloat(R.dimen.overview_max_scale);
            int taskMargin = dp.overviewTaskMarginPx;
            calculateTaskSizeInternal(context, dp,
            calculateTaskSizeInternal(
                    dp,
                    dp.overviewTaskThumbnailTopMarginPx,
                    dp.getOverviewActionsClaimedSpace(),
                    res.getDimensionPixelSize(R.dimen.overview_minimum_next_prev_size) + taskMargin,
@@ -251,7 +254,15 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
        }
    }

    private void calculateTaskSizeInternal(Context context, DeviceProfile dp, int claimedSpaceAbove,
    private void calculateFocusTaskSize(Context context, DeviceProfile dp, Rect outRect) {
        Resources res = context.getResources();
        float maxScale = res.getFloat(R.dimen.overview_max_scale);
        Rect gridRect = new Rect();
        calculateGridSize(dp, gridRect);
        calculateTaskSizeInternal(dp, gridRect, maxScale, Gravity.CENTER, outRect);
    }

    private void calculateTaskSizeInternal(DeviceProfile dp, int claimedSpaceAbove,
            int claimedSpaceBelow, int minimumHorizontalPadding, float maxScale, int gravity,
            Rect outRect) {
        Rect insets = dp.getInsets();
@@ -264,10 +275,10 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
                minimumHorizontalPadding,
                claimedSpaceBelow);

        calculateTaskSizeInternal(context, dp, potentialTaskRect, maxScale, gravity, outRect);
        calculateTaskSizeInternal(dp, potentialTaskRect, maxScale, gravity, outRect);
    }

    private void calculateTaskSizeInternal(Context context, DeviceProfile dp,
    private void calculateTaskSizeInternal(DeviceProfile dp,
            Rect potentialTaskRect, float maxScale, int gravity, Rect outRect) {
        PointF taskDimension = getTaskDimension(dp);

@@ -318,12 +329,15 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
    public final void calculateGridTaskSize(Context context, DeviceProfile dp, Rect outRect,
            PagedOrientationHandler orientedState) {
        Resources res = context.getResources();
        Rect taskRect = new Rect();
        calculateTaskSize(context, dp, taskRect);
        Rect potentialTaskRect = new Rect();
        if (FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get()) {
            calculateGridSize(dp, potentialTaskRect);
        } else {
            calculateFocusTaskSize(context, dp, potentialTaskRect);
        }

        float rowHeight =
                (taskRect.height() + dp.overviewTaskThumbnailTopMarginPx - dp.overviewRowSpacing)
                        / 2f;
        float rowHeight = (potentialTaskRect.height() + dp.overviewTaskThumbnailTopMarginPx
                - dp.overviewRowSpacing) / 2f;

        PointF taskDimension = getTaskDimension(dp);
        float scale = (rowHeight - dp.overviewTaskThumbnailTopMarginPx) / taskDimension.y;
@@ -332,14 +346,15 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T

        int gravity = Gravity.TOP;
        gravity |= orientedState.getRecentsRtlSetting(res) ? Gravity.RIGHT : Gravity.LEFT;
        Gravity.apply(gravity, outWidth, outHeight, taskRect, outRect);
        Gravity.apply(gravity, outWidth, outHeight, potentialTaskRect, outRect);
    }

    /**
     * Calculates the modal taskView size for the provided device configuration
     */
    public final void calculateModalTaskSize(Context context, DeviceProfile dp, Rect outRect) {
        calculateTaskSize(context, dp, outRect);
    public final void calculateModalTaskSize(Context context, DeviceProfile dp, Rect outRect,
            PagedOrientationHandler orientedState) {
        calculateTaskSize(context, dp, outRect, orientedState);
        boolean isGridOnlyOverview = dp.isTablet && FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get();
        int claimedSpaceBelow = isGridOnlyOverview
                ? dp.overviewActionsTopMarginPx + dp.overviewActionsHeight + dp.stashedTaskbarSize
@@ -351,7 +366,7 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
                    Math.round((dp.availableWidthPx - outRect.width() * maxScale) / 2);
        }
        calculateTaskSizeInternal(
                context, dp,
                dp,
                dp.overviewTaskMarginPx,
                claimedSpaceBelow,
                minimumHorizontalPadding,
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ public final class FallbackActivityInterface extends
    @Override
    public int getSwipeUpDestinationAndLength(DeviceProfile dp, Context context, Rect outRect,
            PagedOrientationHandler orientationHandler) {
        calculateTaskSize(context, dp, outRect);
        calculateTaskSize(context, dp, outRect, orientationHandler);
        if (dp.isVerticalBarLayout() && DisplayController.getNavigationMode(context) != NO_BUTTON) {
            return dp.isSeascape() ? outRect.left : (dp.widthPx - outRect.right);
        } else {
+1 −2
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.quickstep;
import static com.android.launcher3.LauncherState.BACKGROUND_APP;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.LauncherState.QUICK_SWITCH_FROM_HOME;
import static com.android.launcher3.anim.AnimatorListeners.forEndCallback;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
@@ -73,7 +72,7 @@ public final class LauncherActivityInterface extends
    @Override
    public int getSwipeUpDestinationAndLength(DeviceProfile dp, Context context, Rect outRect,
            PagedOrientationHandler orientationHandler) {
        calculateTaskSize(context, dp, outRect);
        calculateTaskSize(context, dp, outRect, orientationHandler);
        if (dp.isVerticalBarLayout()
                && DisplayController.getNavigationMode(context) != NavigationMode.NO_BUTTON) {
            return dp.isSeascape() ? outRect.left : (dp.widthPx - outRect.right);
+1 −1
Original line number Diff line number Diff line
@@ -283,7 +283,7 @@ public class OverviewCommandHelper {

        RecentsView<?, ?> visibleRecentsView = activityInterface.getVisibleRecentsView();
        if (visibleRecentsView != null) {
            visibleRecentsView.moveFocusedTaskToFront();
            visibleRecentsView.moveRunningTaskToFront();
        }
        if (mTaskAnimationManager.isRecentsAnimationRunning()) {
            cmd.mActiveCallbacks = mTaskAnimationManager.continueRecentsAnimation(gestureState);
Loading