Merge "Desktop windowing wallpaper" into main

This commit is contained in:
Ivan Tkachenko
2024-04-16 15:20:38 +00:00
committed by Android (Google) Code Review
8 changed files with 61 additions and 39 deletions
@@ -19,6 +19,7 @@ import static android.view.View.VISIBLE;
import static com.android.launcher3.LauncherState.BACKGROUND_APP;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.window.flags.Flags.enableDesktopWindowingWallpaperActivity;
import android.os.Debug;
import android.os.SystemProperties;
@@ -141,7 +142,8 @@ public class DesktopVisibilityController {
final boolean isVisible = visibleTasksCount > 0;
mVisibleDesktopTasksCount = visibleTasksCount;
if (wasVisible != isVisible) {
if (!enableDesktopWindowingWallpaperActivity() && wasVisible != isVisible) {
// TODO: b/333533253 - Remove after flag rollout
if (mVisibleDesktopTasksCount > 0) {
setLauncherViewsVisibility(View.INVISIBLE);
if (!mInOverviewState) {
@@ -178,6 +180,10 @@ public class DesktopVisibilityController {
}
if (overviewStateEnabled != mInOverviewState) {
mInOverviewState = overviewStateEnabled;
if (enableDesktopWindowingWallpaperActivity()) {
return;
}
// TODO: b/333533253 - Clean up after flag rollout
if (mInOverviewState) {
setLauncherViewsVisibility(View.VISIBLE);
markLauncherResumed();
@@ -190,6 +196,9 @@ public class DesktopVisibilityController {
}
}
/**
* TODO: b/333533253 - Remove after flag rollout
*/
private void setBackgroundStateEnabled(boolean backgroundStateEnabled) {
if (DEBUG) {
Log.d(TAG, "setBackgroundStateEnabled: enabled=" + backgroundStateEnabled
@@ -210,6 +219,8 @@ public class DesktopVisibilityController {
/**
* Whether recents gesture is currently in progress.
*
* TODO: b/333533253 - Remove after flag rollout
*/
public boolean isRecentsGestureInProgress() {
return mGestureInProgress;
@@ -217,6 +228,8 @@ public class DesktopVisibilityController {
/**
* Notify controller that recents gesture has started.
*
* TODO: b/333533253 - Remove after flag rollout
*/
public void setRecentsGestureStart() {
if (DEBUG) {
@@ -228,6 +241,8 @@ public class DesktopVisibilityController {
/**
* Notify controller that recents gesture finished with the given
* {@link com.android.quickstep.GestureState.GestureEndTarget}
*
* TODO: b/333533253 - Remove after flag rollout
*/
public void setRecentsGestureEnd(@Nullable GestureState.GestureEndTarget endTarget) {
if (DEBUG) {
@@ -241,6 +256,9 @@ public class DesktopVisibilityController {
}
}
/**
* TODO: b/333533253 - Remove after flag rollout
*/
private void setRecentsGestureInProgress(boolean gestureInProgress) {
if (gestureInProgress != mGestureInProgress) {
mGestureInProgress = gestureInProgress;
@@ -256,7 +274,13 @@ public class DesktopVisibilityController {
}
}
/**
* TODO: b/333533253 - Remove after flag rollout
*/
private void setLauncherViewsVisibility(int visibility) {
if (enableDesktopWindowingWallpaperActivity()) {
return;
}
if (DEBUG) {
Log.d(TAG, "setLauncherViewsVisibility: visibility=" + visibility + " "
+ Debug.getCaller());
@@ -275,7 +299,13 @@ public class DesktopVisibilityController {
}
}
/**
* TODO: b/333533253 - Remove after flag rollout
*/
private void markLauncherPaused() {
if (enableDesktopWindowingWallpaperActivity()) {
return;
}
if (DEBUG) {
Log.d(TAG, "markLauncherPaused " + Debug.getCaller());
}
@@ -286,7 +316,13 @@ public class DesktopVisibilityController {
}
}
/**
* TODO: b/333533253 - Remove after flag rollout
*/
private void markLauncherResumed() {
if (enableDesktopWindowingWallpaperActivity()) {
return;
}
if (DEBUG) {
Log.d(TAG, "markLauncherResumed " + Debug.getCaller());
}
@@ -21,6 +21,7 @@ import static com.android.launcher3.statemanager.BaseState.FLAG_NON_INTERACTIVE;
import static com.android.launcher3.taskbar.TaskbarEduTooltipControllerKt.TOOLTIP_STEP_FEATURES;
import static com.android.launcher3.taskbar.TaskbarLauncherStateController.FLAG_VISIBLE;
import static com.android.quickstep.TaskAnimationManager.ENABLE_SHELL_TRANSITIONS;
import static com.android.window.flags.Flags.enableDesktopWindowingWallpaperActivity;
import android.animation.Animator;
import android.animation.AnimatorSet;
@@ -218,9 +219,10 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
DesktopVisibilityController desktopController =
LauncherActivityInterface.INSTANCE.getDesktopVisibilityController();
final boolean onDesktop =
desktopController != null && desktopController.areDesktopTasksVisible();
if (onDesktop) {
if (!enableDesktopWindowingWallpaperActivity()
&& desktopController != null
&& desktopController.areDesktopTasksVisible()) {
// TODO: b/333533253 - Remove after flag rollout
isVisible = false;
}
@@ -837,6 +837,7 @@ public class TaskbarLauncherStateController {
appendFlag(result, flags, FLAG_LAUNCHER_WAS_ACTIVE_WHILE_AWAKE,
"was_active_while_awake");
appendFlag(result, flags, FLAG_DEVICE_LOCKED, "device_locked");
appendFlag(result, flags, FLAG_TASKBAR_HIDDEN, "taskbar_hidden");
return result.toString();
}
@@ -1165,6 +1165,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
appendFlag(sj, flags, FLAG_STASHED_IN_APP_AUTO, "FLAG_STASHED_IN_APP_AUTO");
appendFlag(sj, flags, FLAG_STASHED_SYSUI, "FLAG_STASHED_SYSUI");
appendFlag(sj, flags, FLAG_STASHED_DEVICE_LOCKED, "FLAG_STASHED_DEVICE_LOCKED");
appendFlag(sj, flags, FLAG_IN_OVERVIEW, "FLAG_IN_OVERVIEW");
return sj.toString();
}
@@ -64,6 +64,7 @@ import static com.android.quickstep.util.AnimUtils.completeRunnableListCallback;
import static com.android.quickstep.util.SplitAnimationTimings.TABLET_HOME_TO_SPLIT;
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY;
import static com.android.window.flags.Flags.enableDesktopWindowingMode;
import static com.android.window.flags.Flags.enableDesktopWindowingWallpaperActivity;
import static com.android.wm.shell.common.split.SplitScreenConstants.SNAP_TO_50_50;
import android.animation.Animator;
@@ -965,12 +966,12 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer
@Override
public void setResumed() {
if (mDesktopVisibilityController != null
if (!enableDesktopWindowingWallpaperActivity()
&& mDesktopVisibilityController != null
&& mDesktopVisibilityController.areDesktopTasksVisible()
&& !mDesktopVisibilityController.isRecentsGestureInProgress()) {
// Return early to skip setting activity to appear as resumed
// TODO(b/255649902): shouldn't be needed when we have a separate launcher state
// for desktop that we can use to control other parts of launcher
// TODO: b/333533253 - Remove after flag rollout
return;
}
super.setResumed();
@@ -88,8 +88,11 @@ public class LauncherSwipeHandlerV2 extends
final View workspaceView = findWorkspaceView(launchCookies,
mRecentsView.getRunningTaskView());
boolean canUseWorkspaceView = workspaceView != null && workspaceView.isAttachedToWindow()
&& workspaceView.getHeight() > 0;
boolean canUseWorkspaceView = workspaceView != null
&& workspaceView.isAttachedToWindow()
&& workspaceView.getHeight() > 0
&& (mContainer.getDesktopVisibilityController() == null
|| !mContainer.getDesktopVisibilityController().areDesktopTasksVisible());
mContainer.getRootView().setForceHideBackArrow(true);
if (!TaskAnimationManager.ENABLE_SHELL_TRANSITIONS) {
@@ -222,8 +222,10 @@ public class RemoteTargetGluer {
for (int i = 0; i < mRemoteTargetHandles.length; i++) {
RemoteAnimationTarget primaryTaskTarget = targets.apps[i];
List<RemoteAnimationTarget> excludeTargets = Arrays.stream(targets.apps)
.filter(target -> target.taskId != primaryTaskTarget.taskId).toList();
mRemoteTargetHandles[i].mTransformParams.setTargetSet(
createRemoteAnimationTargetsForTaskId(targets, primaryTaskTarget.taskId));
createRemoteAnimationTargetsForTarget(targets, excludeTargets));
mRemoteTargetHandles[i].mTaskViewSimulator.setPreview(primaryTaskTarget, null);
}
return mRemoteTargetHandles;
@@ -289,33 +291,6 @@ public class RemoteTargetGluer {
filteredApps, targets.wallpapers, targets.nonApps, targets.targetMode);
}
/**
* Ensures that we only animate one specific app target. Includes ancillary targets such as
* home/recents
*
* @param targets remote animation targets to filter
* @param taskId id for a task that we want this remote animation to apply to
* @return {@link RemoteAnimationTargets} where app target only includes the app that has the
* {@code taskId} that was passed in
*/
private RemoteAnimationTargets createRemoteAnimationTargetsForTaskId(
RemoteAnimationTargets targets, int taskId) {
RemoteAnimationTarget[] targetApp = null;
for (RemoteAnimationTarget targetCompat : targets.unfilteredApps) {
if (targetCompat.taskId == taskId) {
targetApp = new RemoteAnimationTarget[]{targetCompat};
break;
}
}
if (targetApp == null) {
targetApp = new RemoteAnimationTarget[0];
}
return new RemoteAnimationTargets(targetApp, targets.wallpapers, targets.nonApps,
targets.targetMode);
}
/**
* The object returned by this is may be modified in
* {@link #assignTargetsForSplitScreen(RemoteAnimationTargets)}, specifically the length of the
@@ -26,6 +26,7 @@ import static com.android.launcher3.LauncherState.OVERVIEW_MODAL_TASK;
import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT;
import static com.android.launcher3.LauncherState.SPRING_LOADED;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SPLIT_SELECTION_EXIT_HOME;
import static com.android.window.flags.Flags.enableDesktopWindowingWallpaperActivity;
import android.annotation.TargetApi;
import android.content.Context;
@@ -260,7 +261,8 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
super.onGestureAnimationStart(runningTasks, rotationTouchHelper);
DesktopVisibilityController desktopVisibilityController =
mContainer.getDesktopVisibilityController();
if (desktopVisibilityController != null) {
if (!enableDesktopWindowingWallpaperActivity() && desktopVisibilityController != null) {
// TODO: b/333533253 - Remove after flag rollout
desktopVisibilityController.setRecentsGestureStart();
}
}
@@ -282,7 +284,8 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
}
}
super.onGestureAnimationEnd();
if (desktopVisibilityController != null) {
if (!enableDesktopWindowingWallpaperActivity() && desktopVisibilityController != null) {
// TODO: b/333533253 - Remove after flag rollout
desktopVisibilityController.setRecentsGestureEnd(endTarget);
}
if (showDesktopApps) {