Extend taskbar color to entire screen in overview

Only when taskbar is unstashed in apps:
- Scrim workspace with the taskbar color when opening apps and in BackgroundAppState
- Crop opening apps to above the taskbar
- Crop TaskViews to above the taskbar during gestures

If taskbar is stashed in apps, behavior is the same as before, i.e. no scrim over the wallpaper and no cropping of tasks.

Added a field DeviceProfile#taskbkarPresentInApps to distinguish these cases. LauncherTaskbarUIController and TaskbarStashController ensure this value is set appropriately.

Test: Ensure tasks don't appear behind taskbar when it's unstashed; set ENABLE_SCRIM_FOR_APP_LAUNCH = true to test the whole screen scrimming when opening an app

Bug: 196257194
Fixes: 190681228
Change-Id: I481501457a5a6d49c380feea3db3b4058e4cf3f8
This commit is contained in:
Tony Wickham
2021-07-22 14:28:04 -10:00
parent f5ce2f624d
commit 635e180e56
11 changed files with 107 additions and 17 deletions

View File

@@ -85,6 +85,7 @@ import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.icons.FastBitmapDrawable;
import com.android.launcher3.shortcuts.DeepShortcutView;
import com.android.launcher3.statehandlers.DepthController;
import com.android.launcher3.taskbar.LauncherTaskbarUIController;
import com.android.launcher3.util.ActivityOptionsWrapper;
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.launcher3.util.RunnableList;
@@ -427,6 +428,10 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
4 - rotationChange);
}
}
// TODO(b/196637509): don't do this for immersive apps.
if (mDeviceProfile.isTaskbarPresentInApps) {
bounds.bottom -= mDeviceProfile.taskbarSize;
}
return bounds;
}
@@ -511,7 +516,10 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
final boolean scrimEnabled = ENABLE_SCRIM_FOR_APP_LAUNCH.get();
if (scrimEnabled) {
int scrimColor = Themes.getAttrColor(mLauncher, R.attr.overviewScrimColor);
boolean useTaskbarColor = mDeviceProfile.isTaskbarPresentInApps;
int scrimColor = useTaskbarColor
? mLauncher.getResources().getColor(R.color.taskbar_background)
: Themes.getAttrColor(mLauncher, R.attr.overviewScrimColor);
int scrimColorTrans = ColorUtils.setAlphaComponent(scrimColor, 0);
int[] colors = isAppOpening
? new int[]{scrimColorTrans, scrimColor}
@@ -524,6 +532,30 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
colors);
scrim.setDuration(CONTENT_SCRIM_DURATION);
scrim.setInterpolator(DEACCEL_1_5);
if (useTaskbarColor) {
// Hide the taskbar background color since it would duplicate the scrim.
scrim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
LauncherTaskbarUIController taskbarUIController =
mLauncher.getTaskbarUIController();
if (taskbarUIController != null) {
taskbarUIController.forceHideBackground(true);
}
}
@Override
public void onAnimationEnd(Animator animation) {
LauncherTaskbarUIController taskbarUIController =
mLauncher.getTaskbarUIController();
if (taskbarUIController != null) {
taskbarUIController.forceHideBackground(false);
}
}
});
}
launcherAnimator.play(scrim);
}
}