Skip depth and scrim if freeform tasks are visible

If freeform tasks are shown, skip applying depth effect and scrim
changes. These cause the background to flicker while showing freeform
tasks and for example showing the transient taskbar.

Bug: 263264985
Test: swipe up to show transient taskbar, observe launcher background
does not blur or flicker to black

Change-Id: I5b10d0f0c7065e903cb761488367c02d7e31d8b2
This commit is contained in:
Ats Jenk
2023-01-06 09:52:40 -08:00
parent 616de308b7
commit ca009e4e93
4 changed files with 32 additions and 0 deletions
@@ -1002,6 +1002,14 @@ public class QuickstepLauncher extends Launcher {
mPendingSplitSelectInfo = null;
}
@Override
public boolean areFreeformTasksVisible() {
if (mDesktopVisibilityController != null) {
return mDesktopVisibilityController.areFreeformTasksVisible();
}
return false;
}
private static final class LauncherTaskViewController extends
TaskViewTouchController<Launcher> {
@@ -28,6 +28,7 @@ import com.android.launcher3.R;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.config.FeatureFlags;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.views.DesktopTaskView;
import com.android.quickstep.views.RecentsView;
/**
@@ -91,6 +92,12 @@ public class BackgroundAppState extends OverviewState {
@Override
protected float getDepthUnchecked(Context context) {
if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) {
if (Launcher.getLauncher(context).areFreeformTasksVisible()) {
// Don't blur the background while freeform tasks are visible
return 0;
}
}
return 1;
}
@@ -17,10 +17,13 @@ package com.android.launcher3.uioverrides.states;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND;
import android.graphics.Color;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.util.Themes;
import com.android.quickstep.views.DesktopTaskView;
/**
* State to indicate we are about to launch a recent task. Note that this state is only used when
@@ -43,6 +46,12 @@ public class QuickSwitchState extends BackgroundAppState {
@Override
public int getWorkspaceScrimColor(Launcher launcher) {
if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) {
if (launcher.areFreeformTasksVisible()) {
// No scrim while freeform tasks are visible
return Color.TRANSPARENT;
}
}
DeviceProfile dp = launcher.getDeviceProfile();
if (dp.isTaskbarPresentInApps) {
return launcher.getColor(R.color.taskbar_background);
+8
View File
@@ -3317,4 +3317,12 @@ public class Launcher extends StatefulActivity<LauncherState>
return false; // Return false to continue iterating through all the items.
});
}
/**
* Returns {@code true} if there are visible tasks with windowing mode set to
* {@link android.app.WindowConfiguration#WINDOWING_MODE_FREEFORM}
*/
public boolean areFreeformTasksVisible() {
return false; // Base launcher does not track freeform tasks
}
}