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

Commit 80e445d5 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8050481 from 5735251c to sc-v2-release

Change-Id: I74ef02c7f1d330157f84a1cf2e0267eedfd4bd4e
parents bc5cdc0c 5735251c
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -29,12 +29,9 @@ import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW;
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_HORIZONTAL_OFFSET;
import static com.android.quickstep.views.RecentsView.RECENTS_GRID_PROGRESS;
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;
import static com.android.quickstep.views.RecentsView.TASK_PRIMARY_SPLIT_TRANSLATION;
import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_SPLIT_TRANSLATION;
import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION;

import android.util.FloatProperty;
import android.util.Pair;

import androidx.annotation.NonNull;

@@ -43,7 +40,6 @@ import com.android.launcher3.LauncherState;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.statemanager.StateManager.StateHandler;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.quickstep.views.RecentsView;

/**
@@ -100,15 +96,6 @@ public abstract class BaseRecentsViewStateController<T extends RecentsView>
                config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_X, LINEAR));
        setter.setFloat(mRecentsView, TASK_SECONDARY_TRANSLATION, 0f,
                config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, LINEAR));
        PagedOrientationHandler orientationHandler =
                ((RecentsView) mLauncher.getOverviewPanel()).getPagedOrientationHandler();
        Pair<FloatProperty, FloatProperty> taskViewsFloat =
                orientationHandler.getSplitSelectTaskOffset(
                        TASK_PRIMARY_SPLIT_TRANSLATION, TASK_SECONDARY_SPLIT_TRANSLATION,
                        mLauncher.getDeviceProfile());
        setter.setFloat(mRecentsView, taskViewsFloat.first,
                toState.getSplitSelectTranslation(mLauncher), LINEAR);
        setter.setFloat(mRecentsView, taskViewsFloat.second, 0, LINEAR);

        setter.setFloat(mRecentsView, getContentAlphaProperty(), toState.overviewUi ? 1 : 0,
                config.getInterpolator(ANIM_OVERVIEW_FADE, AGGRESSIVE_EASE_IN_OUT));
+49 −15
Original line number Diff line number Diff line
@@ -23,13 +23,17 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_AC
import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA;
import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS;
import static com.android.quickstep.views.RecentsView.TASK_MODALNESS;
import static com.android.quickstep.views.RecentsView.TASK_PRIMARY_SPLIT_TRANSLATION;
import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_SPLIT_TRANSLATION;
import static com.android.quickstep.views.TaskView.FLAG_UPDATE_ALL;

import android.annotation.TargetApi;
import android.os.Build;
import android.util.FloatProperty;
import android.util.Pair;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.launcher3.BaseQuickstepLauncher;
import com.android.launcher3.LauncherState;
@@ -37,6 +41,7 @@ import com.android.launcher3.anim.AnimatorListeners;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.anim.PropertySetter;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.quickstep.views.ClearAllButton;
import com.android.quickstep.views.LauncherRecentsView;
@@ -67,11 +72,7 @@ public final class RecentsViewStateController extends
        // DepthController to prevent optimizations which might occlude the layers behind
        mLauncher.getDepthController().setHasContentBehindLauncher(state.overviewUi);

        if (isSplitSelectionState(state)) {
            mRecentsView.applySplitPrimaryScrollOffset();
        } else {
            mRecentsView.resetSplitPrimaryScrollOffset();
        }
        handleSplitSelectionState(state, null);
    }

    @Override
@@ -92,27 +93,60 @@ public final class RecentsViewStateController extends
        builder.addListener(AnimatorListeners.forSuccessCallback(() ->
                mLauncher.getDepthController().setHasContentBehindLauncher(toState.overviewUi)));

        // Create or dismiss split screen select animations
        handleSplitSelectionState(toState, builder);

        setAlphas(builder, config, toState);
        builder.setFloat(mRecentsView, FULLSCREEN_PROGRESS,
                toState.getOverviewFullscreenProgress(), LINEAR);
    }

    /**
     * Create or dismiss split screen select animations.
     * @param builder if null then this will run the split select animations right away, otherwise
     *                will add animations to builder.
     */
    private void handleSplitSelectionState(@NonNull LauncherState toState,
            @Nullable PendingAnimation builder) {
        LauncherState currentState = mLauncher.getStateManager().getState();
        if (isSplitSelectionState(toState) && !isSplitSelectionState(currentState)) {
            builder.add(mRecentsView.createSplitSelectInitAnimation().buildAnim());
        boolean animate = builder != null;
        PagedOrientationHandler orientationHandler =
                ((RecentsView) mLauncher.getOverviewPanel()).getPagedOrientationHandler();
        Pair<FloatProperty, FloatProperty> taskViewsFloat =
                orientationHandler.getSplitSelectTaskOffset(
                        TASK_PRIMARY_SPLIT_TRANSLATION, TASK_SECONDARY_SPLIT_TRANSLATION,
                        mLauncher.getDeviceProfile());

        if (isSplitSelectionState(currentState, toState)) {
            // Animation to "dismiss" selected taskView
            PendingAnimation splitSelectInitAnimation =
                    mRecentsView.createSplitSelectInitAnimation();
            // Add properties to shift remaining taskViews to get out of placeholder view
            splitSelectInitAnimation.setFloat(mRecentsView, taskViewsFloat.first,
                    toState.getSplitSelectTranslation(mLauncher), LINEAR);
            splitSelectInitAnimation.setFloat(mRecentsView, taskViewsFloat.second, 0, LINEAR);

            if (!animate && isSplitSelectionState(currentState, toState)) {
                splitSelectInitAnimation.buildAnim().start();
            } else if (animate &&
                    isSplitSelectionState(currentState, toState)) {
                builder.add(splitSelectInitAnimation.buildAnim());
            }
        if (isSplitSelectionState(toState)) {
        }

        if (isSplitSelectionState(currentState, toState)) {
            mRecentsView.applySplitPrimaryScrollOffset();
        } else {
            mRecentsView.resetSplitPrimaryScrollOffset();
        }

        setAlphas(builder, config, toState);
        builder.setFloat(mRecentsView, FULLSCREEN_PROGRESS,
                toState.getOverviewFullscreenProgress(), LINEAR);
    }

    /**
     * @return true if {@param toState} is {@link LauncherState#OVERVIEW_SPLIT_SELECT}
     *          and {@param fromState} is not {@link LauncherState#OVERVIEW_SPLIT_SELECT}
     */
    private boolean isSplitSelectionState(@NonNull LauncherState toState) {
        return toState == OVERVIEW_SPLIT_SELECT;
    private boolean isSplitSelectionState(@NonNull LauncherState fromState,
            @NonNull LauncherState toState) {
        return fromState != OVERVIEW_SPLIT_SELECT && toState == OVERVIEW_SPLIT_SELECT;
    }

    private void setAlphas(PropertySetter propertySetter, StateAnimationConfig config,
+13 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package com.android.launcher3.uioverrides.states;

import static android.view.View.VISIBLE;

import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.HINT_STATE;
import static com.android.launcher3.LauncherState.HINT_STATE_TWO_BUTTON;
import static com.android.launcher3.LauncherState.NORMAL;
@@ -44,6 +45,10 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE;
import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController.ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD;
import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController.ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD;
import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController.ALL_APPS_SCRIM_OPAQUE_THRESHOLD;
import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController.ALL_APPS_SCRIM_VISIBLE_THRESHOLD;
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;

import android.animation.ValueAnimator;
@@ -52,6 +57,7 @@ import com.android.launcher3.CellLayout;
import com.android.launcher3.Hotseat;
import com.android.launcher3.LauncherState;
import com.android.launcher3.Workspace;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.quickstep.SysUINavigationMode;
@@ -171,6 +177,13 @@ public class QuickstepAtomicAnimationFactory extends
                mHintToNormalDuration = (int) va.getDuration();
            }
            config.duration = Math.max(config.duration, mHintToNormalDuration);
        } else if (fromState == ALL_APPS && toState == NORMAL) {
            config.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(DEACCEL,
                    1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD,
                    1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD));
            config.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(DEACCEL,
                    1 - ALL_APPS_SCRIM_OPAQUE_THRESHOLD,
                    1 - ALL_APPS_SCRIM_VISIBLE_THRESHOLD));
        }
    }
}
+4 −4
Original line number Diff line number Diff line
@@ -52,22 +52,22 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
    /**
     * The progress at which all apps content will be fully visible.
     */
    protected static final float ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD = 0.8f;
    public static final float ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD = 0.8f;

    /**
     * Minimum clamping progress for fading in all apps content
     */
    protected static final float ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD = 0.5f;
    public static final float ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD = 0.5f;

    /**
     * Minimum clamping progress for fading in all apps scrim
     */
    protected static final float ALL_APPS_SCRIM_VISIBLE_THRESHOLD = .1f;
    public static final float ALL_APPS_SCRIM_VISIBLE_THRESHOLD = .1f;

    /**
     * Maximum clamping progress for opaque all apps scrim
     */
    protected static final float ALL_APPS_SCRIM_OPAQUE_THRESHOLD = .5f;
    public static final float ALL_APPS_SCRIM_OPAQUE_THRESHOLD = .5f;

    private final PortraitOverviewStateTouchHelper mOverviewPortraitStateTouchHelper;

+2 −2
Original line number Diff line number Diff line
@@ -1001,7 +1001,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
                }
                if (mRecentsAnimationTargets != null) {
                    TaskViewUtils.setSplitAuxiliarySurfacesShown(mRecentsAnimationTargets.nonApps,
                            true /*shown*/, true /*animate*/);
                            true /*shown*/, false /*animate*/);
                }
                break;
        }
@@ -1654,7 +1654,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,

        if (mRecentsAnimationTargets != null) {
            TaskViewUtils.setSplitAuxiliarySurfacesShown(mRecentsAnimationTargets.nonApps,
                    true /*shown*/, true /*animate*/);
                    true /*shown*/, false /*animate*/);
        }

        // Leave the pending invisible flag, as it may be used by wallpaper open animation.
Loading