Merge "Fix invoking transient taskbar in desktop windowing prototypes" into tm-qpr-dev

This commit is contained in:
Ats Jenk
2023-02-09 21:09:43 +00:00
committed by Android (Google) Code Review
6 changed files with 72 additions and 3 deletions

View File

@@ -16,6 +16,7 @@
package com.android.launcher3.statehandlers; package com.android.launcher3.statehandlers;
import android.os.SystemProperties; import android.os.SystemProperties;
import android.util.Log;
import android.view.View; import android.view.View;
import com.android.launcher3.Launcher; import com.android.launcher3.Launcher;
@@ -29,6 +30,9 @@ import com.android.launcher3.uioverrides.QuickstepLauncher;
*/ */
public class DesktopVisibilityController { public class DesktopVisibilityController {
private static final String TAG = "DesktopVisController";
private static final boolean DEBUG = false;
private final Launcher mLauncher; private final Launcher mLauncher;
private boolean mFreeformTasksVisible; private boolean mFreeformTasksVisible;
@@ -58,6 +62,9 @@ public class DesktopVisibilityController {
* Sets whether freeform windows are visible and updates launcher visibility based on that. * Sets whether freeform windows are visible and updates launcher visibility based on that.
*/ */
public void setFreeformTasksVisible(boolean freeformTasksVisible) { public void setFreeformTasksVisible(boolean freeformTasksVisible) {
if (DEBUG) {
Log.d(TAG, "setFreeformTasksVisible: visible=" + freeformTasksVisible);
}
if (!isDesktopModeSupported()) { if (!isDesktopModeSupported()) {
return; return;
} }
@@ -83,6 +90,9 @@ public class DesktopVisibilityController {
* Sets whether the overview is visible and updates launcher visibility based on that. * Sets whether the overview is visible and updates launcher visibility based on that.
*/ */
public void setOverviewStateEnabled(boolean overviewStateEnabled) { public void setOverviewStateEnabled(boolean overviewStateEnabled) {
if (DEBUG) {
Log.d(TAG, "setOverviewStateEnabled: enabled=" + overviewStateEnabled);
}
if (!isDesktopModeSupported()) { if (!isDesktopModeSupported()) {
return; return;
} }
@@ -109,6 +119,9 @@ public class DesktopVisibilityController {
* Sets whether recents gesture is in progress. * Sets whether recents gesture is in progress.
*/ */
public void setGestureInProgress(boolean gestureInProgress) { public void setGestureInProgress(boolean gestureInProgress) {
if (DEBUG) {
Log.d(TAG, "setGestureInProgress: inProgress=" + gestureInProgress);
}
if (!isDesktopModeSupported()) { if (!isDesktopModeSupported()) {
return; return;
} }
@@ -118,6 +131,9 @@ public class DesktopVisibilityController {
} }
private void setLauncherViewsVisibility(int visibility) { private void setLauncherViewsVisibility(int visibility) {
if (DEBUG) {
Log.d(TAG, "setLauncherViewsVisibility: visibility=" + visibility);
}
View workspaceView = mLauncher.getWorkspace(); View workspaceView = mLauncher.getWorkspace();
if (workspaceView != null) { if (workspaceView != null) {
workspaceView.setVisibility(visibility); workspaceView.setVisibility(visibility);
@@ -129,6 +145,9 @@ public class DesktopVisibilityController {
} }
private void markLauncherPaused() { private void markLauncherPaused() {
if (DEBUG) {
Log.d(TAG, "markLauncherPaused");
}
StatefulActivity<LauncherState> activity = StatefulActivity<LauncherState> activity =
QuickstepLauncher.ACTIVITY_TRACKER.getCreatedActivity(); QuickstepLauncher.ACTIVITY_TRACKER.getCreatedActivity();
if (activity != null) { if (activity != null) {
@@ -137,6 +156,9 @@ public class DesktopVisibilityController {
} }
private void markLauncherResumed() { private void markLauncherResumed() {
if (DEBUG) {
Log.d(TAG, "markLauncherResumed");
}
StatefulActivity<LauncherState> activity = StatefulActivity<LauncherState> activity =
QuickstepLauncher.ACTIVITY_TRACKER.getCreatedActivity(); QuickstepLauncher.ACTIVITY_TRACKER.getCreatedActivity();
// Check activity state before calling setResumed(). Launcher may have been actually // Check activity state before calling setResumed(). Launcher may have been actually

View File

@@ -800,7 +800,7 @@ public class QuickstepLauncher extends Launcher {
@Override @Override
public void setResumed() { public void setResumed() {
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED) { if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) {
DesktopVisibilityController controller = mDesktopVisibilityController; DesktopVisibilityController controller = mDesktopVisibilityController;
if (controller != null && controller.areFreeformTasksVisible() if (controller != null && controller.areFreeformTasksVisible()
&& !controller.isGestureInProgress()) { && !controller.isGestureInProgress()) {

View File

@@ -20,6 +20,7 @@ import static com.android.launcher3.anim.Interpolators.ACCEL_2;
import static com.android.launcher3.anim.Interpolators.INSTANT; import static com.android.launcher3.anim.Interpolators.INSTANT;
import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.quickstep.AbsSwipeUpHandler.RECENTS_ATTACH_DURATION; import static com.android.quickstep.AbsSwipeUpHandler.RECENTS_ATTACH_DURATION;
import static com.android.quickstep.GestureState.GestureEndTarget.LAST_TASK;
import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS; import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS;
import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_RECENTS_FADE_ANIM; import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_RECENTS_FADE_ANIM;
import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_RECENTS_TRANSLATE_X_ANIM; import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_RECENTS_TRANSLATE_X_ANIM;
@@ -62,6 +63,7 @@ import com.android.launcher3.util.NavigationMode;
import com.android.launcher3.views.ScrimView; import com.android.launcher3.views.ScrimView;
import com.android.quickstep.util.ActivityInitListener; import com.android.quickstep.util.ActivityInitListener;
import com.android.quickstep.util.AnimatorControllerWithResistance; import com.android.quickstep.util.AnimatorControllerWithResistance;
import com.android.quickstep.views.DesktopTaskView;
import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.recents.model.ThumbnailData;
@@ -107,6 +109,20 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
if (endTarget != null) { if (endTarget != null) {
// We were on our way to this state when we got canceled, end there instead. // We were on our way to this state when we got canceled, end there instead.
startState = stateFromGestureEndTarget(endTarget); startState = stateFromGestureEndTarget(endTarget);
if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) {
DesktopVisibilityController controller = getDesktopVisibilityController();
if (controller != null && controller.areFreeformTasksVisible()
&& endTarget == LAST_TASK) {
// When we are cancelling the transition and going back to last task, move to
// rest state instead when desktop tasks are visible.
// If a fullscreen task is visible, launcher goes to normal state when the
// activity is stopped. This does not happen when freeform tasks are visible
// on top of launcher. Force the launcher state to rest state here.
startState = activity.getStateManager().getRestState();
// Do not animate the transition
activityVisible = false;
}
}
} }
activity.getStateManager().goToState(startState, activityVisible); activity.getStateManager().goToState(startState, activityVisible);
} }

View File

@@ -40,6 +40,7 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.config.FeatureFlags;
import com.android.quickstep.TopTaskTracker.CachedTaskInfo; import com.android.quickstep.TopTaskTracker.CachedTaskInfo;
import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.util.ActiveGestureLog;
import com.android.quickstep.views.DesktopTaskView;
import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.ActivityManagerWrapper;
@@ -238,6 +239,12 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
// to let the transition controller collect Home activity. // to let the transition controller collect Home activity.
CachedTaskInfo cti = gestureState.getRunningTask(); CachedTaskInfo cti = gestureState.getRunningTask();
boolean homeIsOnTop = cti != null && cti.isHomeTask(); boolean homeIsOnTop = cti != null && cti.isHomeTask();
if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) {
if (cti != null && cti.isFreeformTask()) {
// No transient launch when desktop task is on top
homeIsOnTop = true;
}
}
if (!homeIsOnTop) { if (!homeIsOnTop) {
options.setTransientLaunch(); options.setTransientLaunch();
} }

View File

@@ -18,6 +18,7 @@ package com.android.quickstep;
import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT; import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.content.Intent.ACTION_CHOOSER; import static android.content.Intent.ACTION_CHOOSER;
import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS; import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
import static android.view.Display.DEFAULT_DISPLAY; import static android.view.Display.DEFAULT_DISPLAY;
@@ -254,6 +255,15 @@ public class TopTaskTracker extends ISplitScreenListener.Stub implements TaskSta
.getActivityType() == ACTIVITY_TYPE_HOME; .getActivityType() == ACTIVITY_TYPE_HOME;
} }
/**
* Returns {@code true} if this task windowing mode is set to {@link
* android.app.WindowConfiguration#WINDOWING_MODE_FREEFORM}
*/
public boolean isFreeformTask() {
return mTopTask != null && mTopTask.configuration.windowConfiguration.getWindowingMode()
== WINDOWING_MODE_FREEFORM;
}
/** /**
* Returns {@link Task} array which can be used as a placeholder until the true object * Returns {@link Task} array which can be used as a placeholder until the true object
* is loaded by the model * is loaded by the model

View File

@@ -41,8 +41,10 @@ import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.launcher3.util.PendingSplitSelectInfo; import com.android.launcher3.util.PendingSplitSelectInfo;
import com.android.launcher3.util.SplitConfigurationOptions; import com.android.launcher3.util.SplitConfigurationOptions;
import com.android.launcher3.util.SplitConfigurationOptions.SplitSelectSource; import com.android.launcher3.util.SplitConfigurationOptions.SplitSelectSource;
import com.android.quickstep.GestureState;
import com.android.quickstep.LauncherActivityInterface; import com.android.quickstep.LauncherActivityInterface;
import com.android.quickstep.RotationTouchHelper; import com.android.quickstep.RotationTouchHelper;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.util.SplitSelectStateController; import com.android.quickstep.util.SplitSelectStateController;
import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.recents.model.Task;
@@ -223,11 +225,23 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
@Override @Override
public void onGestureAnimationEnd() { public void onGestureAnimationEnd() {
DesktopVisibilityController desktopVisibilityController = null;
boolean showDesktopApps = false;
if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) {
desktopVisibilityController = mActivity.getDesktopVisibilityController();
if (mCurrentGestureEndTarget == GestureState.GestureEndTarget.LAST_TASK
&& desktopVisibilityController.areFreeformTasksVisible()) {
// Recents gesture was cancelled and we are returning to the previous task.
// After super class has handled clean up, show desktop apps on top again
showDesktopApps = true;
}
}
super.onGestureAnimationEnd(); super.onGestureAnimationEnd();
DesktopVisibilityController desktopVisibilityController =
mActivity.getDesktopVisibilityController();
if (desktopVisibilityController != null) { if (desktopVisibilityController != null) {
desktopVisibilityController.setGestureInProgress(false); desktopVisibilityController.setGestureInProgress(false);
} }
if (showDesktopApps) {
SystemUiProxy.INSTANCE.get(mActivity).showDesktopApps();
}
} }
} }