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

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

Merge "Make sure thumbnailViewDeprecated is only accessed when refactor flag is off" into main

parents 25eaff39 d2640711
Loading
Loading
Loading
Loading
+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.getFirstThumbnailViewDeprecated().getSysUiStatusNavFlags();
                sysuiFlags = tv.getTaskContainers().getFirst().getSysUiStatusNavFlags();
            }
            mLauncher.getSystemUiController().updateUiState(UI_STATE_FULLSCREEN_TASK, sysuiFlags);
        } else {
+4 −4
Original line number Diff line number Diff line
@@ -926,7 +926,7 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer,
            TaskView runningTask = mRecentsView.getRunningTaskView();
            TaskView centermostTask = mRecentsView.getTaskViewNearestToCenterOfScreen();
            int centermostTaskFlags = centermostTask == null ? 0
                    : centermostTask.getFirstThumbnailViewDeprecated().getSysUiStatusNavFlags();
                    : centermostTask.getTaskContainers().getFirst().getSysUiStatusNavFlags();
            boolean swipeUpThresholdPassed = windowProgress > 1 - UPDATE_SYSUI_FLAGS_THRESHOLD;
            boolean quickswitchThresholdPassed = centermostTask != runningTask;

@@ -2456,9 +2456,9 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer,
        RemoteAnimationTarget taskTarget = taskTargets[0];
        TaskView taskView = mRecentsView == null
                ? null : mRecentsView.getTaskViewByTaskId(taskTarget.taskId);
        if (taskView == null
                || !taskView.getFirstThumbnailViewDeprecated().shouldShowSplashView()) {
            ActiveGestureLog.INSTANCE.addLog("Invalid task view splash state");
        if (taskView == null || taskView.getTaskContainers().stream().noneMatch(
                TaskContainer::getShouldShowSplashView)) {
            ActiveGestureLog.INSTANCE.addLog("Splash not needed");
            finishRecentsAnimationOnTasksAppeared(null /* onFinishComplete */);
            return;
        }
+26 −12
Original line number Diff line number Diff line
@@ -135,7 +135,6 @@ import com.android.internal.jank.Cuj;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.BaseActivity.MultiWindowModeChangedListener;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Flags;
import com.android.launcher3.Insettable;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.PagedView;
@@ -1017,6 +1016,8 @@ public abstract class RecentsView<CONTAINER_TYPE extends Context & RecentsViewCo
    @Nullable
    public Task onTaskThumbnailChanged(int taskId, ThumbnailData thumbnailData) {
        if (mHandleTaskStackChanges) {
            // TODO(b/342560598): Handle onTaskThumbnailChanged for new TTV.
            if (!enableRefactorTaskThumbnail()) {
                TaskView taskView = getTaskViewByTaskId(taskId);
                if (taskView != null) {
                    for (TaskContainer container : taskView.getTaskContainers()) {
@@ -1028,6 +1029,7 @@ public abstract class RecentsView<CONTAINER_TYPE extends Context & RecentsViewCo
                    }
                }
            }
        }
        return null;
    }

@@ -1061,6 +1063,10 @@ public abstract class RecentsView<CONTAINER_TYPE extends Context & RecentsViewCo
    @Nullable
    public TaskView updateThumbnail(
            HashMap<Integer, ThumbnailData> thumbnailData, boolean refreshNow) {
        if (enableRefactorTaskThumbnail()) {
            // TODO(b/342560598): Handle updateThumbnail for new TTV.
            return null;
        }
        TaskView updatedTaskView = null;
        for (Map.Entry<Integer, ThumbnailData> entry : thumbnailData.entrySet()) {
            Integer id = entry.getKey();
@@ -2915,7 +2921,7 @@ public abstract class RecentsView<CONTAINER_TYPE extends Context & RecentsViewCo
        int prevRunningTaskViewId = mRunningTaskViewId;
        mRunningTaskViewId = runningTaskViewId;

        if (Flags.enableRefactorTaskThumbnail()) {
        if (enableRefactorTaskThumbnail()) {
            TaskView previousRunningTaskView = getTaskViewFromTaskViewId(prevRunningTaskViewId);
            if (previousRunningTaskView != null) {
                previousRunningTaskView.notifyIsRunningTaskUpdated();
@@ -4861,14 +4867,16 @@ public abstract class RecentsView<CONTAINER_TYPE extends Context & RecentsViewCo
                    == mSplitSelectStateController.getInitialTaskId();
            TaskContainer taskContainer = mSplitHiddenTaskView
                    .getTaskContainers().get(primaryTaskSelected ? 1 : 0);
            TaskThumbnailViewDeprecated thumbnail = taskContainer.getThumbnailViewDeprecated();
            mSplitSelectStateController.getSplitAnimationController()
                    .addInitialSplitFromPair(taskContainer, builder,
                            mContainer.getDeviceProfile(),
                            mSplitHiddenTaskView.getWidth(), mSplitHiddenTaskView.getHeight(),
                            primaryTaskSelected);
            builder.addOnFrameCallback(() ->{
                thumbnail.refreshSplashView();
                // TODO(b/334826842): Handle splash icon for new TTV.
                if (!enableRefactorTaskThumbnail()) {
                    taskContainer.getThumbnailViewDeprecated().refreshSplashView();
                }
                mSplitHiddenTaskView.updateSnapshotRadius();
            });
        } else if (isInitiatingSplitFromTaskView) {
@@ -5260,7 +5268,7 @@ public abstract class RecentsView<CONTAINER_TYPE extends Context & RecentsViewCo
        updateGridProperties();
        updateScrollSynchronously();

        int targetSysUiFlags = tv.getFirstThumbnailViewDeprecated().getSysUiStatusNavFlags();
        int targetSysUiFlags = tv.getTaskContainers().getFirst().getSysUiStatusNavFlags();
        final boolean[] passedOverviewThreshold = new boolean[] {false};
        ValueAnimator progressAnim = ValueAnimator.ofFloat(0, 1);
        progressAnim.addUpdateListener(animator -> {
@@ -5986,6 +5994,12 @@ public abstract class RecentsView<CONTAINER_TYPE extends Context & RecentsViewCo
    }

    private void switchToScreenshotInternal(Runnable onFinishRunnable) {
        // TODO(b/342560598): Handle switchToScreenshot for new TTV.
        if (enableRefactorTaskThumbnail()) {
            onFinishRunnable.run();
            return;
        }

        TaskView taskView = getRunningTaskView();
        if (taskView == null) {
            onFinishRunnable.run();
+11 −0
Original line number Diff line number Diff line
@@ -64,6 +64,17 @@ class TaskContainer(
    val thumbnail: Bitmap?
        get() = thumbnailViewDeprecated.thumbnail

    // TODO(b/334826842): Support shouldShowSplashView for new TTV.
    val shouldShowSplashView: Boolean
        get() =
            if (enableRefactorTaskThumbnail()) false
            else thumbnailViewDeprecated.shouldShowSplashView()

    // TODO(b/350743460) Support sysUiStatusNavFlags for new TTV.
    val sysUiStatusNavFlags: Int
        get() =
            if (enableRefactorTaskThumbnail()) 0 else thumbnailViewDeprecated.sysUiStatusNavFlags

    /** Builds proto for logging */
    val itemInfo: WorkspaceItemInfo
        get() =
+3 −6
Original line number Diff line number Diff line
@@ -155,11 +155,6 @@ constructor(
        /** Returns the first task bound to this TaskView. */
        get() = taskContainers[0].task

    @get:Deprecated("Use [taskContainers] instead.")
    val firstThumbnailViewDeprecated: TaskThumbnailViewDeprecated
        /** Returns the first thumbnailView of the TaskView. */
        get() = taskContainers[0].thumbnailViewDeprecated

    @get:Deprecated("Use [taskContainers] instead.")
    val firstSnapshotView: View
        /** Returns the first snapshotView of the TaskView. */
@@ -1470,7 +1465,9 @@ constructor(
    protected open fun updateSnapshotRadius() {
        updateCurrentFullscreenParams()
        taskContainers.forEach {
            if (!enableRefactorTaskThumbnail()) {
                it.thumbnailViewDeprecated.setFullscreenParams(getThumbnailFullscreenParams())
            }
            it.overlay.setFullscreenParams(getThumbnailFullscreenParams())
        }
    }