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

Commit 4127e460 authored by Alex Chau's avatar Alex Chau
Browse files

Move common code from DesktopTaskView and GroupedTaskView to TaskView

- Most TaskView method will now loop through taskContainer instead of accessing the first/second
- Moved TaskThumbnailView, showWindowsView, and TaskOverlay to be part of TaskContainer. There are still some TaskOverlay access from TaskThumbnailViewDeprecated that should be remove as we start using TaskThumbnailView

Fix: 339787250
Test: Manual
Flag: EXEMPT refactor
Change-Id: Icfaa4f5eb50582faed01113465335b6d2899f781
parent 5a4b813d
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ import com.android.launcher3.views.ArrowTipView;
import com.android.quickstep.util.AssistContentRequester;
import com.android.quickstep.util.RecentsOrientedState;
import com.android.quickstep.views.GoOverviewActionsView;
import com.android.quickstep.views.TaskThumbnailViewDeprecated;
import com.android.quickstep.views.TaskView.TaskContainer;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;

@@ -101,8 +101,8 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory {
    /**
     * Create a new overlay instance for the given View
     */
    public TaskOverlayGo createOverlay(TaskThumbnailViewDeprecated thumbnailView) {
        return new TaskOverlayGo(thumbnailView, mContentRequester);
    public TaskOverlayGo createOverlay(TaskContainer taskContainer) {
        return new TaskOverlayGo(taskContainer, mContentRequester);
    }

    /**
@@ -120,9 +120,9 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory {
        private OverlayDialogGo mDialog;
        private ArrowTipView mArrowTipView;

        private TaskOverlayGo(TaskThumbnailViewDeprecated taskThumbnailView,
        private TaskOverlayGo(TaskContainer taskContainer,
                AssistContentRequester assistContentRequester) {
            super(taskThumbnailView);
            super(taskContainer);
            mFactoryContentRequester = assistContentRequester;
            mSharedPreferences = LauncherPrefs.getPrefs(mApplicationContext);
        }
@@ -148,7 +148,8 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory {
            // Disable Overview Actions for Work Profile apps
            boolean isManagedProfileTask =
                    UserManager.get(mApplicationContext).isManagedProfile(task.key.userId);
            boolean isAllowedByPolicy = mThumbnailView.isRealSnapshot() && !isManagedProfileTask;
            boolean isAllowedByPolicy = mTaskContainer.getThumbnailViewDeprecated().isRealSnapshot()
                    && !isManagedProfileTask;
            getActionsView().setCallbacks(new OverlayUICallbacksGoImpl(isAllowedByPolicy, task));
            mTaskPackageName = task.key.getPackageName();
            mSharedPreferences = LauncherPrefs.getPrefs(mApplicationContext);
@@ -162,8 +163,7 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory {
            int taskId = task.key.id;
            mFactoryContentRequester.requestAssistContent(taskId, this::onAssistContentReceived);

            RecentsOrientedState orientedState =
                    mThumbnailView.getTaskView().getRecentsView().getPagedViewOrientedState();
            RecentsOrientedState orientedState = mTaskContainer.getTaskView().getOrientedState();
            boolean isInLandscape = orientedState.getDisplayRotation() != ROTATION_0;

            // show tooltips in portrait mode only
+2 −2
Original line number Diff line number Diff line
@@ -269,8 +269,8 @@ public class TaskbarUIController {
                                    foundTaskView,
                                    foundTask,
                                    taskContainer.getIconView().getDrawable(),
                                    taskContainer.getThumbnailView(),
                                    taskContainer.getThumbnailView().getThumbnail(),
                                    taskContainer.getThumbnailViewDeprecated(),
                                    taskContainer.getThumbnailViewDeprecated().getThumbnail(),
                                    null /* intent */,
                                    null /* user */,
                                    info);
+1 −1
Original line number Diff line number Diff line
@@ -151,7 +151,7 @@ public class QuickSwitchTouchController extends AbstractStateChangeTouchControll
            int sysuiFlags = 0;
            TaskView tv = mOverviewPanel.getTaskViewAt(0);
            if (tv != null) {
                sysuiFlags = tv.getFirstThumbnailView().getSysUiStatusNavFlags();
                sysuiFlags = tv.getFirstThumbnailViewDeprecated().getSysUiStatusNavFlags();
            }
            mLauncher.getSystemUiController().updateUiState(UI_STATE_FULLSCREEN_TASK, sysuiFlags);
        } else {
+1 −1
Original line number Diff line number Diff line
@@ -252,7 +252,7 @@ public abstract class TaskViewTouchController<CONTAINER extends Context & Recent
                    mTaskBeingDragged, maxDuration, currentInterpolator);

            // Since the thumbnail is what is filling the screen, based the end displacement on it.
            View thumbnailView = mTaskBeingDragged.getFirstThumbnailView();
            View thumbnailView = mTaskBeingDragged.getFirstThumbnailViewDeprecated();
            mTempCords[1] = orientationHandler.getSecondaryDimension(thumbnailView);
            dl.getDescendantCoordRelativeToSelf(thumbnailView, mTempCords);
            mEndDisplacement = secondaryLayerDimension - mTempCords[1];
+4 −4
Original line number Diff line number Diff line
@@ -107,7 +107,6 @@ import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.dragndrop.DragView;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.logging.StatsLogManager.StatsLogger;
import com.android.launcher3.statehandlers.DesktopVisibilityController;
import com.android.launcher3.statemanager.BaseState;
import com.android.launcher3.taskbar.TaskbarThresholdUtils;
import com.android.launcher3.taskbar.TaskbarUIController;
@@ -926,7 +925,7 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer,
            TaskView runningTask = mRecentsView.getRunningTaskView();
            TaskView centermostTask = mRecentsView.getTaskViewNearestToCenterOfScreen();
            int centermostTaskFlags = centermostTask == null ? 0
                    : centermostTask.getFirstThumbnailView().getSysUiStatusNavFlags();
                    : centermostTask.getFirstThumbnailViewDeprecated().getSysUiStatusNavFlags();
            boolean swipeUpThresholdPassed = windowProgress > 1 - UPDATE_SYSUI_FLAGS_THRESHOLD;
            boolean quickswitchThresholdPassed = centermostTask != runningTask;

@@ -1478,7 +1477,7 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer,
                        ? SysUiStatsLog.LAUNCHER_UICHANGED__INPUT_TYPE__TRACKPAD
                        : SysUiStatsLog.LAUNCHER_UICHANGED__INPUT_TYPE__TOUCH);
        if (targetTask != null) {
            logger.withItemInfo(targetTask.getItemInfo());
            logger.withItemInfo(targetTask.getFirstItemInfo());
        }

        int pageIndex = endTarget == LAST_TASK || mRecentsView == null
@@ -2424,7 +2423,8 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer,
        RemoteAnimationTarget taskTarget = taskTargetOptional.get();
        TaskView taskView = mRecentsView == null
                ? null : mRecentsView.getTaskViewByTaskId(taskTarget.taskId);
        if (taskView == null || !taskView.getFirstThumbnailView().shouldShowSplashView()) {
        if (taskView == null
                || !taskView.getFirstThumbnailViewDeprecated().shouldShowSplashView()) {
            ActiveGestureLog.INSTANCE.addLog("Invalid task view splash state");
            finishRecentsAnimationOnTasksAppeared(null /* onFinishComplete */);
            return;
Loading