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

Commit 819b8355 authored by Randy Pfohl's avatar Randy Pfohl Committed by randypfohl
Browse files

Revert "Revert "abtracting Activity from recentsView through rec..."

Revert submission 26911513-revert-26414135-RecentsViewContainer-MEROZZOKJQ

Reason for revert: Fix for issue has been found and will be included in this revert.

Reverted changes: /q/submissionid:26911513-revert-26414135-RecentsViewContainer-MEROZZOKJQ

Change-Id: I517e7d2fc0d82d250a6ed40862dd31c194d0a302
parent 2a51fc64
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@ 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;
@@ -53,6 +52,7 @@ 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,
            BaseDraggingActivity activity, ItemInfo info, View originalView) {
            Context context, 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, activity, info, originalView);
            return new RemoteActionShortcut(action, context, info, originalView);
        }
    }

@@ -305,9 +305,11 @@ public final class WellbeingModel extends BgObjectWithLooper {
    /**
     * Shortcut factory for generating wellbeing action
     */
    public static final SystemShortcut.Factory<BaseDraggingActivity> SHORTCUT_FACTORY =
            (activity, info, originalView) -> (info.getTargetComponent() == null) ? null
                    : INSTANCE.get(activity).getShortcutForApp(
    public static final SystemShortcut.Factory<ActivityContext> SHORTCUT_FACTORY =
            (context, info, originalView) ->
                    (info.getTargetComponent() == null) ? null
                            : INSTANCE.get(originalView.getContext()).getShortcutForApp(
                                    info.getTargetComponent().getPackageName(), info.user.getIdentifier(),
                            activity, info, originalView);
                                    ActivityContext.lookupContext(originalView.getContext()),
                                    info, originalView);
}
+17 −10
Original line number Diff line number Diff line
@@ -181,6 +181,7 @@ 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;
@@ -204,7 +205,7 @@ import java.util.function.BiConsumer;
import java.util.function.Predicate;
import java.util.stream.Stream;

public class QuickstepLauncher extends Launcher {
public class QuickstepLauncher extends Launcher implements RecentsViewContainer {
    private static final boolean TRACE_LAYOUTS =
            SystemProperties.getBoolean("persist.debug.trace_layouts", false);
    private static final String TRACE_RELAYOUT_CLASS =
@@ -218,7 +219,8 @@ public class QuickstepLauncher extends Launcher {
    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.
@@ -244,12 +246,16 @@ public class QuickstepLauncher extends Launcher {

    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(),
@@ -1055,8 +1061,9 @@ public class QuickstepLauncher extends Launcher {
                .playPlaceholderDismissAnim(this, splitDismissEvent);
    }

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

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

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

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

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

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

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

+3 −6
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ 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;
@@ -63,7 +62,7 @@ public class BackgroundAppState extends OverviewState {

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

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

    public static float[] getOverviewScaleAndOffsetForBackgroundState(
            BaseDraggingActivity activity) {
        return new float[] {
                ((RecentsView) activity.getOverviewPanel()).getMaxScaleForFullScreen(),
                NO_OFFSET};
            RecentsView recentsView) {
        return new float[] {recentsView.getMaxScaleForFullScreen(), NO_OFFSET};
    }
}
+2 −4
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ 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;
@@ -51,7 +50,7 @@ public class OverviewModalTaskState extends OverviewState {

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

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

    public static float[] getOverviewScaleAndOffsetForModalState(BaseDraggingActivity activity) {
        RecentsView recentsView = activity.<RecentsView>getOverviewPanel();
    public static float[] getOverviewScaleAndOffsetForModalState(RecentsView recentsView) {
        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 = mActivity.getOverviewPanel();
        RecentsView overview = mContainer.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(mActivity).hasGestures
            if (DisplayController.getNavigationMode(mContainer).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 (mActivity.getDeviceProfile().isTaskbarPresent) {
                if (mContainer.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 = mActivity.getWorkspace();
            Workspace<?> workspace = mContainer.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 = mActivity.getHotseat();
            Hotseat hotseat = mContainer.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(mActivity).hasGestures) {
            if (DisplayController.getNavigationMode(mContainer).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(mActivity,
                        mActivity.getWorkspace(),
                        toState.getWorkspaceScaleAndTranslation(mActivity).scale);
                ValueAnimator va = getWorkspaceSpringScaleAnimator(mContainer,
                        mContainer.getWorkspace(),
                        toState.getWorkspaceScaleAndTranslation(mContainer).scale);
                mHintToNormalDuration = (int) va.getDuration();
            }
            config.duration = Math.max(config.duration, mHintToNormalDuration);
        } else if (fromState == ALL_APPS && toState == NORMAL) {
            AllAppsSwipeController.applyAllAppsToNormalConfig(mActivity, config);
            AllAppsSwipeController.applyAllAppsToNormalConfig(mContainer, config);
        } else if (fromState == NORMAL && toState == ALL_APPS) {
            AllAppsSwipeController.applyNormalToAllAppsAnimConfig(mActivity, config);
            AllAppsSwipeController.applyNormalToAllAppsAnimConfig(mContainer, config);
        } else if (fromState == OVERVIEW && toState == OVERVIEW_SPLIT_SELECT) {
            SplitAnimationTimings timings = mActivity.getDeviceProfile().isTablet
            SplitAnimationTimings timings = mContainer.getDeviceProfile().isTablet
                    ? SplitAnimationTimings.TABLET_OVERVIEW_TO_SPLIT
                    : SplitAnimationTimings.PHONE_OVERVIEW_TO_SPLIT;
            config.setInterpolator(ANIM_OVERVIEW_ACTIONS_FADE, clampToProgress(LINEAR,
Loading