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

Commit 1d685108 authored by Priyanka Advani's avatar Priyanka Advani Committed by Android (Google) Code Review
Browse files

Merge changes from topic "revert-26414135-RecentsViewContainer-MEROZZOKJQ" into main

* changes:
  Revert "abtracting Activity from recentsView through recentsview..."
  Revert "fixing tests to match new abstraction"
parents 63bf93cf 3c713461
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import androidx.annotation.MainThread;
import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;

import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.R;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.popup.RemoteActionShortcut;
@@ -52,7 +53,6 @@ import com.android.launcher3.util.BgObjectWithLooper;
import com.android.launcher3.util.MainThreadInitializedObject;
import com.android.launcher3.util.Preconditions;
import com.android.launcher3.util.SimpleBroadcastReceiver;
import com.android.launcher3.views.ActivityContext;

import java.util.Arrays;
import java.util.HashMap;
@@ -147,7 +147,7 @@ public final class WellbeingModel extends BgObjectWithLooper {

    @MainThread
    private SystemShortcut getShortcutForApp(String packageName, int userId,
            Context context, ItemInfo info, View originalView) {
            BaseDraggingActivity activity, ItemInfo info, View originalView) {
        Preconditions.assertUIThread();
        // Work profile apps are not recognized by digital wellbeing.
        if (userId != UserHandle.myUserId()) {
@@ -171,7 +171,7 @@ public final class WellbeingModel extends BgObjectWithLooper {
                        "getShortcutForApp [" + packageName + "]: action: '" + action.getTitle()
                                + "'");
            }
            return new RemoteActionShortcut(action, context, info, originalView);
            return new RemoteActionShortcut(action, activity, info, originalView);
        }
    }

@@ -305,10 +305,9 @@ public final class WellbeingModel extends BgObjectWithLooper {
    /**
     * Shortcut factory for generating wellbeing action
     */
    public static final SystemShortcut.Factory<ActivityContext> SHORTCUT_FACTORY =
            (context, info, originalView) ->
                    (info.getTargetComponent() == null) ? null
                    : INSTANCE.get(originalView.getContext()).getShortcutForApp(
    public static final SystemShortcut.Factory<BaseDraggingActivity> SHORTCUT_FACTORY =
            (activity, info, originalView) -> (info.getTargetComponent() == null) ? null
                    : INSTANCE.get(activity).getShortcutForApp(
                            info.getTargetComponent().getPackageName(), info.user.getIdentifier(),
                            originalView.getContext(), info, originalView);
                            activity, info, originalView);
}
+10 −17
Original line number Diff line number Diff line
@@ -181,7 +181,6 @@ import com.android.quickstep.util.unfold.ProxyUnfoldTransitionProvider;
import com.android.quickstep.views.FloatingTaskView;
import com.android.quickstep.views.OverviewActionsView;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.RecentsViewContainer;
import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.system.ActivityManagerWrapper;
@@ -205,7 +204,7 @@ import java.util.function.BiConsumer;
import java.util.function.Predicate;
import java.util.stream.Stream;

public class QuickstepLauncher extends Launcher implements RecentsViewContainer {
public class QuickstepLauncher extends Launcher {
    private static final boolean TRACE_LAYOUTS =
            SystemProperties.getBoolean("persist.debug.trace_layouts", false);
    private static final String TRACE_RELAYOUT_CLASS =
@@ -219,8 +218,7 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer
    private DepthController mDepthController;
    private @Nullable DesktopVisibilityController mDesktopVisibilityController;
    private QuickstepTransitionManager mAppTransitionManager;

    private OverviewActionsView<?> mActionsView;
    private OverviewActionsView mActionsView;
    private TISBindHelper mTISBindHelper;
    private @Nullable LauncherTaskbarUIController mTaskbarUIController;
    // Will be updated when dragging from taskbar.
@@ -246,16 +244,12 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer

    private boolean mIsPredictiveBackToHomeInProgress;

    public static QuickstepLauncher getLauncher(Context context) {
        return fromContext(context);
    }

    @Override
    protected void setupViews() {
        super.setupViews();

        mActionsView = findViewById(R.id.overview_actions_view);
        RecentsView<?,?> overviewPanel = getOverviewPanel();
        RecentsView overviewPanel = getOverviewPanel();
        SystemUiProxy systemUiProxy = SystemUiProxy.INSTANCE.get(this);
        mSplitSelectStateController =
                new SplitSelectStateController(this, mHandler, getStateManager(),
@@ -1061,9 +1055,8 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer
                .playPlaceholderDismissAnim(this, splitDismissEvent);
    }

    @Override
    public OverviewActionsView<?> getActionsView() {
        return mActionsView;
    public <T extends OverviewActionsView> T getActionsView() {
        return (T) mActionsView;
    }

    @Override
@@ -1376,25 +1369,25 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer
    }

    private static final class LauncherTaskViewController extends
            TaskViewTouchController<QuickstepLauncher> {
            TaskViewTouchController<Launcher> {

        LauncherTaskViewController(QuickstepLauncher activity) {
        LauncherTaskViewController(Launcher activity) {
            super(activity);
        }

        @Override
        protected boolean isRecentsInteractive() {
            return mContainer.isInState(OVERVIEW) || mContainer.isInState(OVERVIEW_MODAL_TASK);
            return mActivity.isInState(OVERVIEW) || mActivity.isInState(OVERVIEW_MODAL_TASK);
        }

        @Override
        protected boolean isRecentsModal() {
            return mContainer.isInState(OVERVIEW_MODAL_TASK);
            return mActivity.isInState(OVERVIEW_MODAL_TASK);
        }

        @Override
        protected void onUserControlledAnimationCreated(AnimatorPlaybackController animController) {
            mContainer.getStateManager().setCurrentUserControlledAnimation(animController);
            mActivity.getStateManager().setCurrentUserControlledAnimation(animController);
        }
    }

+6 −3
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static com.android.quickstep.TaskAnimationManager.ENABLE_SHELL_TRANSITION
import android.content.Context;
import android.graphics.Color;

import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.allapps.AllAppsTransitionController;
@@ -62,7 +63,7 @@ public class BackgroundAppState extends OverviewState {

    @Override
    public float[] getOverviewScaleAndOffset(Launcher launcher) {
        return getOverviewScaleAndOffsetForBackgroundState(launcher.getOverviewPanel());
        return getOverviewScaleAndOffsetForBackgroundState(launcher);
    }

    @Override
@@ -124,7 +125,9 @@ public class BackgroundAppState extends OverviewState {
    }

    public static float[] getOverviewScaleAndOffsetForBackgroundState(
            RecentsView recentsView) {
        return new float[] {recentsView.getMaxScaleForFullScreen(), NO_OFFSET};
            BaseDraggingActivity activity) {
        return new float[] {
                ((RecentsView) activity.getOverviewPanel()).getMaxScaleForFullScreen(),
                NO_OFFSET};
    }
}
+4 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERV
import android.content.Context;
import android.graphics.Rect;

import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.Flags;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
@@ -50,7 +51,7 @@ public class OverviewModalTaskState extends OverviewState {

    @Override
    public float[] getOverviewScaleAndOffset(Launcher launcher) {
        return getOverviewScaleAndOffsetForModalState(launcher.getOverviewPanel());
        return getOverviewScaleAndOffsetForModalState(launcher);
    }

    @Override
@@ -71,7 +72,8 @@ public class OverviewModalTaskState extends OverviewState {
        return super.isTaskbarStashed(launcher);
    }

    public static float[] getOverviewScaleAndOffsetForModalState(RecentsView recentsView) {
    public static float[] getOverviewScaleAndOffsetForModalState(BaseDraggingActivity activity) {
        RecentsView recentsView = activity.<RecentsView>getOverviewPanel();
        Rect taskSize = recentsView.getSelectedTaskBounds();
        Rect modalTaskSize = new Rect();
        recentsView.getModalTaskSize(modalTaskSize);
+12 −12
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ public class QuickstepAtomicAnimationFactory extends
    @Override
    public void prepareForAtomicAnimation(LauncherState fromState, LauncherState toState,
            StateAnimationConfig config) {
        RecentsView overview = mContainer.getOverviewPanel();
        RecentsView overview = mActivity.getOverviewPanel();
        if ((fromState == OVERVIEW || fromState == OVERVIEW_SPLIT_SELECT) && toState == NORMAL) {
            overview.switchToScreenshot(() ->
                    overview.finishRecentsAnimation(true /* toRecents */, null));
@@ -118,7 +118,7 @@ public class QuickstepAtomicAnimationFactory extends
            config.setInterpolator(ANIM_WORKSPACE_SCALE, DECELERATE);
            config.setInterpolator(ANIM_WORKSPACE_FADE, ACCELERATE);

            if (DisplayController.getNavigationMode(mContainer).hasGestures
            if (DisplayController.getNavigationMode(mActivity).hasGestures
                    && overview.getTaskViewCount() > 0) {
                // Overview is going offscreen, so keep it at its current scale and opacity.
                config.setInterpolator(ANIM_OVERVIEW_SCALE, FINAL_FRAME);
@@ -136,7 +136,7 @@ public class QuickstepAtomicAnimationFactory extends
                config.duration = Math.max(config.duration, scrollDuration);

                // Sync scroll so that it ends before or at the same time as the taskbar animation.
                if (mContainer.getDeviceProfile().isTaskbarPresent) {
                if (mActivity.getDeviceProfile().isTaskbarPresent) {
                    config.duration = Math.min(
                            config.duration, QuickstepTransitionManager.getTaskbarToHomeDuration());
                }
@@ -147,7 +147,7 @@ public class QuickstepAtomicAnimationFactory extends
                config.setInterpolator(ANIM_OVERVIEW_FADE, DECELERATE_1_7);
            }

            Workspace<?> workspace = mContainer.getWorkspace();
            Workspace<?> workspace = mActivity.getWorkspace();
            // Start from a higher workspace scale, but only if we're invisible so we don't jump.
            boolean isWorkspaceVisible = workspace.getVisibility() == VISIBLE;
            if (isWorkspaceVisible) {
@@ -160,7 +160,7 @@ public class QuickstepAtomicAnimationFactory extends
                workspace.setScaleX(WORKSPACE_PREPARE_SCALE);
                workspace.setScaleY(WORKSPACE_PREPARE_SCALE);
            }
            Hotseat hotseat = mContainer.getHotseat();
            Hotseat hotseat = mActivity.getHotseat();
            boolean isHotseatVisible = hotseat.getVisibility() == VISIBLE && hotseat.getAlpha() > 0;
            if (!isHotseatVisible) {
                hotseat.setScaleX(WORKSPACE_PREPARE_SCALE);
@@ -168,7 +168,7 @@ public class QuickstepAtomicAnimationFactory extends
            }
        } else if ((fromState == NORMAL || fromState == HINT_STATE
                || fromState == HINT_STATE_TWO_BUTTON) && toState == OVERVIEW) {
            if (DisplayController.getNavigationMode(mContainer).hasGestures) {
            if (DisplayController.getNavigationMode(mActivity).hasGestures) {
                config.setInterpolator(ANIM_WORKSPACE_SCALE,
                        fromState == NORMAL ? ACCELERATE : OVERSHOOT_1_2);
                config.setInterpolator(ANIM_WORKSPACE_TRANSLATE, ACCELERATE);
@@ -201,18 +201,18 @@ public class QuickstepAtomicAnimationFactory extends
        } else if (fromState == HINT_STATE && toState == NORMAL) {
            config.setInterpolator(ANIM_DEPTH, DECELERATE_3);
            if (mHintToNormalDuration == -1) {
                ValueAnimator va = getWorkspaceSpringScaleAnimator(mContainer,
                        mContainer.getWorkspace(),
                        toState.getWorkspaceScaleAndTranslation(mContainer).scale);
                ValueAnimator va = getWorkspaceSpringScaleAnimator(mActivity,
                        mActivity.getWorkspace(),
                        toState.getWorkspaceScaleAndTranslation(mActivity).scale);
                mHintToNormalDuration = (int) va.getDuration();
            }
            config.duration = Math.max(config.duration, mHintToNormalDuration);
        } else if (fromState == ALL_APPS && toState == NORMAL) {
            AllAppsSwipeController.applyAllAppsToNormalConfig(mContainer, config);
            AllAppsSwipeController.applyAllAppsToNormalConfig(mActivity, config);
        } else if (fromState == NORMAL && toState == ALL_APPS) {
            AllAppsSwipeController.applyNormalToAllAppsAnimConfig(mContainer, config);
            AllAppsSwipeController.applyNormalToAllAppsAnimConfig(mActivity, config);
        } else if (fromState == OVERVIEW && toState == OVERVIEW_SPLIT_SELECT) {
            SplitAnimationTimings timings = mContainer.getDeviceProfile().isTablet
            SplitAnimationTimings timings = mActivity.getDeviceProfile().isTablet
                    ? SplitAnimationTimings.TABLET_OVERVIEW_TO_SPLIT
                    : SplitAnimationTimings.PHONE_OVERVIEW_TO_SPLIT;
            config.setInterpolator(ANIM_OVERVIEW_ACTIONS_FADE, clampToProgress(LINEAR,
Loading