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

Commit 2115be26 authored by Daniel Chapin's avatar Daniel Chapin Committed by Android Build Coastguard Worker
Browse files

Revert "Swipe-up Recents transition: override desktop tasks corn..."

Revert submission 30844330-recents_swipeup_cornerradius

Reason for revert: b/388979758

Reverted changes: /q/submissionid:30844330-recents_swipeup_cornerradius
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:e4ec56d65d2b3ded3ebec623866ddf91658fdd0b)
Merged-In: I93e8affa334533818f20c43e0403e223760a59cf
Change-Id: I93e8affa334533818f20c43e0403e223760a59cf
parent c9f92dfb
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -946,8 +946,7 @@ public abstract class WMShellModule {
            FocusTransitionObserver focusTransitionObserver,
            FocusTransitionObserver focusTransitionObserver,
            DesktopModeEventLogger desktopModeEventLogger,
            DesktopModeEventLogger desktopModeEventLogger,
            DesktopModeUiEventLogger desktopModeUiEventLogger,
            DesktopModeUiEventLogger desktopModeUiEventLogger,
            WindowDecorTaskResourceLoader taskResourceLoader,
            WindowDecorTaskResourceLoader taskResourceLoader
            RecentsTransitionHandler recentsTransitionHandler
    ) {
    ) {
        if (!DesktopModeStatus.canEnterDesktopModeOrShowAppHandle(context)) {
        if (!DesktopModeStatus.canEnterDesktopModeOrShowAppHandle(context)) {
            return Optional.empty();
            return Optional.empty();
@@ -963,7 +962,7 @@ public abstract class WMShellModule {
                desktopTasksLimiter, appHandleEducationController, appToWebEducationController,
                desktopTasksLimiter, appHandleEducationController, appToWebEducationController,
                windowDecorCaptionHandleRepository, activityOrientationChangeHandler,
                windowDecorCaptionHandleRepository, activityOrientationChangeHandler,
                focusTransitionObserver, desktopModeEventLogger, desktopModeUiEventLogger,
                focusTransitionObserver, desktopModeEventLogger, desktopModeUiEventLogger,
                taskResourceLoader, recentsTransitionHandler));
                taskResourceLoader));
    }
    }


    @WMSingleton
    @WMSingleton
+2 −4
Original line number Original line Diff line number Diff line
@@ -17,10 +17,9 @@
package com.android.wm.shell.recents;
package com.android.wm.shell.recents;


import android.graphics.Rect;
import android.graphics.Rect;
import android.os.Bundle;
import android.view.RemoteAnimationTarget;
import android.view.RemoteAnimationTarget;
import android.window.TaskSnapshot;
import android.window.TaskSnapshot;
import android.window.TransitionInfo;
import android.os.Bundle;


import com.android.wm.shell.recents.IRecentsAnimationController;
import com.android.wm.shell.recents.IRecentsAnimationController;


@@ -58,8 +57,7 @@ oneway interface IRecentsAnimationRunner {
     */
     */
    void onAnimationStart(in IRecentsAnimationController controller,
    void onAnimationStart(in IRecentsAnimationController controller,
            in RemoteAnimationTarget[] apps, in RemoteAnimationTarget[] wallpapers,
            in RemoteAnimationTarget[] apps, in RemoteAnimationTarget[] wallpapers,
            in Rect homeContentInsets, in Rect minimizedHomeBounds, in Bundle extras,
            in Rect homeContentInsets, in Rect minimizedHomeBounds, in Bundle extras) = 2;
            in TransitionInfo info) = 2;


    /**
    /**
     * Called when the task of an activity that has been started while the recents animation
     * Called when the task of an activity that has been started while the recents animation
+2 −3
Original line number Original line Diff line number Diff line
@@ -587,8 +587,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler,
                mListener.onAnimationStart(this,
                mListener.onAnimationStart(this,
                        apps.toArray(new RemoteAnimationTarget[apps.size()]),
                        apps.toArray(new RemoteAnimationTarget[apps.size()]),
                        new RemoteAnimationTarget[0],
                        new RemoteAnimationTarget[0],
                        new Rect(0, 0, 0, 0), new Rect(), new Bundle(),
                        new Rect(0, 0, 0, 0), new Rect(), new Bundle());
                        null);
                for (int i = 0; i < mStateListeners.size(); i++) {
                for (int i = 0; i < mStateListeners.size(); i++) {
                    mStateListeners.get(i).onTransitionStateChanged(TRANSITION_STATE_ANIMATING);
                    mStateListeners.get(i).onTransitionStateChanged(TRANSITION_STATE_ANIMATING);
                }
                }
@@ -819,7 +818,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler,
                mListener.onAnimationStart(this,
                mListener.onAnimationStart(this,
                        apps.toArray(new RemoteAnimationTarget[apps.size()]),
                        apps.toArray(new RemoteAnimationTarget[apps.size()]),
                        wallpapers.toArray(new RemoteAnimationTarget[wallpapers.size()]),
                        wallpapers.toArray(new RemoteAnimationTarget[wallpapers.size()]),
                        new Rect(0, 0, 0, 0), new Rect(), b, info);
                        new Rect(0, 0, 0, 0), new Rect(), b);
                for (int i = 0; i < mStateListeners.size(); i++) {
                for (int i = 0; i < mStateListeners.size(); i++) {
                    mStateListeners.get(i).onTransitionStateChanged(TRANSITION_STATE_ANIMATING);
                    mStateListeners.get(i).onTransitionStateChanged(TRANSITION_STATE_ANIMATING);
                }
                }
+3 −48
Original line number Original line Diff line number Diff line
@@ -126,8 +126,6 @@ import com.android.wm.shell.desktopmode.common.ToggleTaskSizeUtilsKt;
import com.android.wm.shell.desktopmode.education.AppHandleEducationController;
import com.android.wm.shell.desktopmode.education.AppHandleEducationController;
import com.android.wm.shell.desktopmode.education.AppToWebEducationController;
import com.android.wm.shell.desktopmode.education.AppToWebEducationController;
import com.android.wm.shell.freeform.FreeformTaskTransitionStarter;
import com.android.wm.shell.freeform.FreeformTaskTransitionStarter;
import com.android.wm.shell.recents.RecentsTransitionHandler;
import com.android.wm.shell.recents.RecentsTransitionStateListener;
import com.android.wm.shell.shared.FocusTransitionListener;
import com.android.wm.shell.shared.FocusTransitionListener;
import com.android.wm.shell.shared.annotations.ShellBackgroundThread;
import com.android.wm.shell.shared.annotations.ShellBackgroundThread;
import com.android.wm.shell.shared.annotations.ShellMainThread;
import com.android.wm.shell.shared.annotations.ShellMainThread;
@@ -159,10 +157,8 @@ import kotlinx.coroutines.MainCoroutineDispatcher;


import java.io.PrintWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.List;
import java.util.Optional;
import java.util.Optional;
import java.util.Set;
import java.util.function.Supplier;
import java.util.function.Supplier;


/**
/**
@@ -251,7 +247,6 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
    private final DesktopModeEventLogger mDesktopModeEventLogger;
    private final DesktopModeEventLogger mDesktopModeEventLogger;
    private final DesktopModeUiEventLogger mDesktopModeUiEventLogger;
    private final DesktopModeUiEventLogger mDesktopModeUiEventLogger;
    private final WindowDecorTaskResourceLoader mTaskResourceLoader;
    private final WindowDecorTaskResourceLoader mTaskResourceLoader;
    private final RecentsTransitionHandler mRecentsTransitionHandler;


    public DesktopModeWindowDecorViewModel(
    public DesktopModeWindowDecorViewModel(
            Context context,
            Context context,
@@ -287,8 +282,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
            FocusTransitionObserver focusTransitionObserver,
            FocusTransitionObserver focusTransitionObserver,
            DesktopModeEventLogger desktopModeEventLogger,
            DesktopModeEventLogger desktopModeEventLogger,
            DesktopModeUiEventLogger desktopModeUiEventLogger,
            DesktopModeUiEventLogger desktopModeUiEventLogger,
            WindowDecorTaskResourceLoader taskResourceLoader,
            WindowDecorTaskResourceLoader taskResourceLoader) {
            RecentsTransitionHandler recentsTransitionHandler) {
        this(
        this(
                context,
                context,
                shellExecutor,
                shellExecutor,
@@ -329,8 +323,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
                focusTransitionObserver,
                focusTransitionObserver,
                desktopModeEventLogger,
                desktopModeEventLogger,
                desktopModeUiEventLogger,
                desktopModeUiEventLogger,
                taskResourceLoader,
                taskResourceLoader);
                recentsTransitionHandler);
    }
    }


    @VisibleForTesting
    @VisibleForTesting
@@ -374,8 +367,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
            FocusTransitionObserver focusTransitionObserver,
            FocusTransitionObserver focusTransitionObserver,
            DesktopModeEventLogger desktopModeEventLogger,
            DesktopModeEventLogger desktopModeEventLogger,
            DesktopModeUiEventLogger desktopModeUiEventLogger,
            DesktopModeUiEventLogger desktopModeUiEventLogger,
            WindowDecorTaskResourceLoader taskResourceLoader,
            WindowDecorTaskResourceLoader taskResourceLoader) {
            RecentsTransitionHandler recentsTransitionHandler) {
        mContext = context;
        mContext = context;
        mMainExecutor = shellExecutor;
        mMainExecutor = shellExecutor;
        mMainHandler = mainHandler;
        mMainHandler = mainHandler;
@@ -444,7 +436,6 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
        mDesktopModeEventLogger = desktopModeEventLogger;
        mDesktopModeEventLogger = desktopModeEventLogger;
        mDesktopModeUiEventLogger = desktopModeUiEventLogger;
        mDesktopModeUiEventLogger = desktopModeUiEventLogger;
        mTaskResourceLoader = taskResourceLoader;
        mTaskResourceLoader = taskResourceLoader;
        mRecentsTransitionHandler = recentsTransitionHandler;


        shellInit.addInitCallback(this::onInit, this);
        shellInit.addInitCallback(this::onInit, this);
    }
    }
@@ -459,10 +450,6 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
                new DesktopModeOnTaskResizeAnimationListener());
                new DesktopModeOnTaskResizeAnimationListener());
        mDesktopTasksController.setOnTaskRepositionAnimationListener(
        mDesktopTasksController.setOnTaskRepositionAnimationListener(
                new DesktopModeOnTaskRepositionAnimationListener());
                new DesktopModeOnTaskRepositionAnimationListener());
        if (Flags.enableDesktopRecentsTransitionsCornersBugfix()) {
            mRecentsTransitionHandler.addTransitionStateListener(
                    new DesktopModeRecentsTransitionStateListener());
        }
        mDisplayController.addDisplayChangingController(mOnDisplayChangingListener);
        mDisplayController.addDisplayChangingController(mOnDisplayChangingListener);
        try {
        try {
            mWindowManager.registerSystemGestureExclusionListener(mGestureExclusionListener,
            mWindowManager.registerSystemGestureExclusionListener(mGestureExclusionListener,
@@ -1872,38 +1859,6 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
        }
        }
    }
    }


    private class DesktopModeRecentsTransitionStateListener
            implements RecentsTransitionStateListener {
        final Set<Integer> mAnimatingTaskIds = new HashSet<>();

        @Override
        public void onTransitionStateChanged(int state) {
            switch (state) {
                case RecentsTransitionStateListener.TRANSITION_STATE_REQUESTED:
                    for (int n = 0; n < mWindowDecorByTaskId.size(); n++) {
                        int taskId = mWindowDecorByTaskId.keyAt(n);
                        mAnimatingTaskIds.add(taskId);
                        setIsRecentsTransitionRunningForTask(taskId, true);
                    }
                    return;
                case RecentsTransitionStateListener.TRANSITION_STATE_NOT_RUNNING:
                    // No Recents transition running - clean up window decorations
                    for (int taskId : mAnimatingTaskIds) {
                        setIsRecentsTransitionRunningForTask(taskId, false);
                    }
                    mAnimatingTaskIds.clear();
                    return;
                default:
            }
        }

        private void setIsRecentsTransitionRunningForTask(int taskId, boolean isRecentsRunning) {
            final DesktopModeWindowDecoration decoration = mWindowDecorByTaskId.get(taskId);
            if (decoration == null) return;
            decoration.setIsRecentsTransitionRunning(isRecentsRunning);
        }
    }

    private class DragEventListenerImpl
    private class DragEventListenerImpl
            implements DragPositioningCallbackUtility.DragEventListener {
            implements DragPositioningCallbackUtility.DragEventListener {
        @Override
        @Override
+6 −25
Original line number Original line Diff line number Diff line
@@ -204,7 +204,6 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
    private final MultiInstanceHelper mMultiInstanceHelper;
    private final MultiInstanceHelper mMultiInstanceHelper;
    private final WindowDecorCaptionHandleRepository mWindowDecorCaptionHandleRepository;
    private final WindowDecorCaptionHandleRepository mWindowDecorCaptionHandleRepository;
    private final DesktopUserRepositories mDesktopUserRepositories;
    private final DesktopUserRepositories mDesktopUserRepositories;
    private boolean mIsRecentsTransitionRunning = false;


    private Runnable mLoadAppInfoRunnable;
    private Runnable mLoadAppInfoRunnable;
    private Runnable mSetAppInfoRunnable;
    private Runnable mSetAppInfoRunnable;
@@ -499,7 +498,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
                applyStartTransactionOnDraw, shouldSetTaskVisibilityPositionAndCrop,
                applyStartTransactionOnDraw, shouldSetTaskVisibilityPositionAndCrop,
                mIsStatusBarVisible, mIsKeyguardVisibleAndOccluded, inFullImmersive,
                mIsStatusBarVisible, mIsKeyguardVisibleAndOccluded, inFullImmersive,
                mDisplayController.getInsetsState(taskInfo.displayId), hasGlobalFocus,
                mDisplayController.getInsetsState(taskInfo.displayId), hasGlobalFocus,
                displayExclusionRegion, mIsRecentsTransitionRunning);
                displayExclusionRegion);


        final WindowDecorLinearLayout oldRootView = mResult.mRootView;
        final WindowDecorLinearLayout oldRootView = mResult.mRootView;
        final SurfaceControl oldDecorationSurface = mDecorationContainerSurface;
        final SurfaceControl oldDecorationSurface = mDecorationContainerSurface;
@@ -870,8 +869,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
            boolean inFullImmersiveMode,
            boolean inFullImmersiveMode,
            @NonNull InsetsState displayInsetsState,
            @NonNull InsetsState displayInsetsState,
            boolean hasGlobalFocus,
            boolean hasGlobalFocus,
            @NonNull Region displayExclusionRegion,
            @NonNull Region displayExclusionRegion) {
            boolean shouldIgnoreCornerRadius) {
        final int captionLayoutId = getDesktopModeWindowDecorLayoutId(taskInfo.getWindowingMode());
        final int captionLayoutId = getDesktopModeWindowDecorLayoutId(taskInfo.getWindowingMode());
        final boolean isAppHeader =
        final boolean isAppHeader =
                captionLayoutId == R.layout.desktop_mode_app_header;
                captionLayoutId == R.layout.desktop_mode_app_header;
@@ -1008,19 +1006,13 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
        relayoutParams.mWindowDecorConfig = windowDecorConfig;
        relayoutParams.mWindowDecorConfig = windowDecorConfig;


        if (DesktopModeStatus.useRoundedCorners()) {
        if (DesktopModeStatus.useRoundedCorners()) {
            relayoutParams.mCornerRadius = shouldIgnoreCornerRadius ? INVALID_CORNER_RADIUS :
            relayoutParams.mCornerRadius = taskInfo.getWindowingMode() == WINDOWING_MODE_FREEFORM
                    getCornerRadius(context, relayoutParams.mLayoutResId);
                    ? loadDimensionPixelSize(context.getResources(),
                    R.dimen.desktop_windowing_freeform_rounded_corner_radius)
                    : INVALID_CORNER_RADIUS;
        }
        }
    }
    }


    private static int getCornerRadius(@NonNull Context context, int layoutResId) {
        if (layoutResId == R.layout.desktop_mode_app_header) {
            return loadDimensionPixelSize(context.getResources(),
                    R.dimen.desktop_windowing_freeform_rounded_corner_radius);
        }
        return INVALID_CORNER_RADIUS;
    }

    /**
    /**
     * If task has focused window decor, return the caption id of the fullscreen caption size
     * If task has focused window decor, return the caption id of the fullscreen caption size
     * resource. Otherwise, return ID_NULL and caption width be set to task width.
     * resource. Otherwise, return ID_NULL and caption width be set to task width.
@@ -1747,17 +1739,6 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
                /* maximizeHoverEnabled= */ canOpenMaximizeMenu(animatingTaskResizeOrReposition)));
                /* maximizeHoverEnabled= */ canOpenMaximizeMenu(animatingTaskResizeOrReposition)));
    }
    }


    /**
     * Declares whether a Recents transition is currently active.
     *
     * <p> When a Recents transition is active we allow that transition to take ownership of the
     * corner radius of its task surfaces, so each window decoration should stop updating the corner
     * radius of its task surface during that time.
     */
    void setIsRecentsTransitionRunning(boolean isRecentsTransitionRunning) {
        mIsRecentsTransitionRunning = isRecentsTransitionRunning;
    }

    /**
    /**
     * Called when there is a {@link MotionEvent#ACTION_HOVER_EXIT} on the maximize window button.
     * Called when there is a {@link MotionEvent#ACTION_HOVER_EXIT} on the maximize window button.
     */
     */
Loading