Merge "Land ENABLE_TASKBAR_IN_OVERVIEW" into tm-qpr-dev

This commit is contained in:
Alex Chau
2023-03-01 17:13:35 +00:00
committed by Android (Google) Code Review
16 changed files with 24 additions and 200 deletions
@@ -112,7 +112,6 @@ import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
import com.android.launcher3.LauncherAnimationRunner.RemoteAnimationFactory;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorListeners;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.icons.FastBitmapDrawable;
import com.android.launcher3.model.data.ItemInfo;
@@ -557,11 +556,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
final boolean scrimEnabled = ENABLE_SCRIM_FOR_APP_LAUNCH.get();
if (scrimEnabled) {
boolean useTaskbarColor = mDeviceProfile.isTaskbarPresentInApps
&& !FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get();
int scrimColor = useTaskbarColor
? mLauncher.getResources().getColor(R.color.taskbar_background)
: Themes.getAttrColor(mLauncher, R.attr.overviewScrimColor);
int scrimColor = Themes.getAttrColor(mLauncher, R.attr.overviewScrimColor);
int scrimColorTrans = ColorUtils.setAlphaComponent(scrimColor, 0);
int[] colors = isAppOpening
? new int[]{scrimColorTrans, scrimColor}
@@ -575,29 +570,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
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);
}
}
@@ -82,7 +82,8 @@ public class FallbackTaskbarUIController extends TaskbarUIController {
public Animator createAnimToRecentsState(RecentsState toState, long duration) {
boolean useStashedLauncherState = toState.hasOverviewActions();
boolean stashedLauncherState =
useStashedLauncherState && !FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get();
useStashedLauncherState && FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get()
&& toState == RecentsState.MODAL_TASK;
TaskbarStashController stashController = mControllers.taskbarStashController;
// Set both FLAG_IN_STASHED_LAUNCHER_STATE and FLAG_IN_APP to ensure the state is respected.
// For all other states, just use the current stashed-in-app setting (e.g. if long clicked).
@@ -41,7 +41,6 @@ import com.android.launcher3.QuickstepTransitionManager;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatedFloat;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.logging.InstanceId;
import com.android.launcher3.logging.InstanceIdSequence;
import com.android.launcher3.model.data.ItemInfo;
@@ -86,7 +85,6 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
};
// Initialized in init.
private AnimatedFloat mTaskbarOverrideBackgroundAlpha;
private TaskbarKeyguardController mKeyguardController;
private final TaskbarLauncherStateController
mTaskbarLauncherStateController = new TaskbarLauncherStateController();
@@ -100,8 +98,6 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
super.init(taskbarControllers);
mTaskbarLauncherStateController.init(mControllers, mLauncher);
mTaskbarOverrideBackgroundAlpha = mControllers.taskbarDragLayerController
.getOverrideBackgroundAlpha();
mLauncher.setTaskbarUIController(this);
mKeyguardController = taskbarControllers.taskbarKeyguardController;
@@ -255,13 +251,6 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
}
}
/**
* Sets whether the background behind the taskbar/nav bar should be hidden.
*/
public void forceHideBackground(boolean forceHide) {
mTaskbarOverrideBackgroundAlpha.updateValue(forceHide ? 0 : 1);
}
/**
* Starts a Taskbar EDU flow, if the user should see one upon launching an application.
*/
@@ -318,21 +307,6 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
instanceId);
}
@Override
public void setSystemGestureInProgress(boolean inProgress) {
super.setSystemGestureInProgress(inProgress);
if (DisplayController.isTransientTaskbar(mLauncher)) {
forceHideBackground(false);
return;
}
if (!FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get()) {
// Launcher's ScrimView will draw the background throughout the gesture. But once the
// gesture ends, start drawing taskbar's background again since launcher might stop
// drawing.
forceHideBackground(inProgress);
}
}
/**
* Animates Taskbar elements during a transition to a Launcher state that should use in-app
* layouts.
@@ -401,10 +375,6 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
public void dumpLogs(String prefix, PrintWriter pw) {
super.dumpLogs(prefix, pw);
pw.println(String.format(
"%s\tmTaskbarOverrideBackgroundAlpha=%.2f",
prefix,
mTaskbarOverrideBackgroundAlpha.value));
pw.println(String.format("%s\tTaskbar in-app display progress:", prefix));
mTaskbarInAppDisplayProgressMultiProp.dump(
prefix + "\t",
@@ -127,10 +127,6 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa
return mAssistantBgTaskbar;
}
public AnimatedFloat getOverrideBackgroundAlpha() {
return mBgOverride;
}
public AnimatedFloat getTaskbarBackgroundOffset() {
return mBgOffset;
}
@@ -24,9 +24,7 @@ import android.graphics.Color;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
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;
@@ -103,10 +101,6 @@ public class BackgroundAppState extends OverviewState {
@Override
public int getWorkspaceScrimColor(Launcher launcher) {
DeviceProfile dp = launcher.getDeviceProfile();
if (dp.isTaskbarPresentInApps && !FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get()) {
return launcher.getColor(R.color.taskbar_background);
}
return Color.TRANSPARENT;
}
@@ -26,7 +26,6 @@ import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.Themes;
import com.android.quickstep.util.LayoutUtils;
@@ -103,14 +102,9 @@ public class OverviewState extends LauncherState {
return CLEAR_ALL_BUTTON | OVERVIEW_ACTIONS;
}
@Override
public boolean isTaskbarStashed(Launcher launcher) {
return !FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get();
}
@Override
public boolean isTaskbarAlignedWithHotseat(Launcher launcher) {
return !FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get();
return false;
}
@Override
@@ -261,26 +261,8 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
* Offsets OverviewActionsView horizontal position based on 3 button nav container in taskbar.
*/
private void updatePadding() {
if (mDp == null) {
return;
}
boolean largeScreenLandscape = mDp.isTablet && !mDp.isTwoPanels && mDp.isLandscape;
// If in 3-button mode, shift action buttons to accommodate 3-button layout.
// (Special exception for landscape tablets, where there is enough room and we don't need to
// shift the action buttons.)
if (mDp.areNavButtonsInline && !largeScreenLandscape
// If taskbar is in overview, overview action has dedicated space above nav buttons
&& !FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get()) {
// Add extra horizontal spacing
int additionalPadding = mDp.hotseatBarEndOffset;
if (isLayoutRtl()) {
setPadding(mInsets.left + additionalPadding, 0, mInsets.right, 0);
} else {
setPadding(mInsets.left, 0, mInsets.right + additionalPadding, 0);
}
} else {
setPadding(mInsets.left, 0, mInsets.right, 0);
}
// If taskbar is in overview, overview action has dedicated space above nav buttons
setPadding(mInsets.left, 0, mInsets.right, 0);
}
/** Updates vertical margins for different navigation mode or configuration changes. */
@@ -300,11 +282,6 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
return 0;
}
if (!mDp.isGestureMode && mDp.isTaskbarPresent
&& !FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get()) {
return mDp.getOverviewActionsClaimedSpaceBelow();
}
if (mDp.isTablet && FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get()) {
return mDp.stashedTaskbarSize;
}
@@ -44,7 +44,6 @@ import static com.android.launcher3.anim.Interpolators.OVERSHOOT_0_75;
import static com.android.launcher3.anim.Interpolators.clampToProgress;
import static com.android.launcher3.config.FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW;
import static com.android.launcher3.config.FeatureFlags.ENABLE_LAUNCH_FROM_STAGED_APP;
import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_OVERVIEW_ACTIONS_SPLIT;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_CLEAR_ALL;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_DISMISS_SWIPE_UP;
@@ -3681,8 +3680,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
removeViewInLayout(mClearAllButton);
if (isHomeTaskDismissed) {
updateEmptyMessage();
} else if (!(ENABLE_TASKBAR_IN_OVERVIEW.get() &&
mSplitSelectStateController.isSplitSelectActive())) {
} else if (!mSplitSelectStateController.isSplitSelectActive()) {
startHome();
}
} else {
@@ -3785,8 +3783,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
mActionsView.updateHiddenFlags(HIDDEN_SPLIT_SELECT_ACTIVE, isSplitSelectionActive());
mActionsView.updateSplitButtonHiddenFlags(FLAG_IS_NOT_TABLET,
!mActivity.getDeviceProfile().isTablet);
mActionsView.updateSplitButtonDisabledFlags(FLAG_SINGLE_TASK,
!FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get() && getTaskViewCount() <= 1);
mActionsView.updateSplitButtonDisabledFlags(FLAG_SINGLE_TASK, /*enable=*/ false);
if (DESKTOP_MODE_SUPPORTED) {
boolean isCurrentDesktop = getCurrentPageTaskView() instanceof DesktopTaskView;
mActionsView.updateHiddenFlags(HIDDEN_DESKTOP, isCurrentDesktop);
@@ -16,8 +16,6 @@
package com.android.quickstep.views;
import static com.android.launcher3.util.NavigationMode.THREE_BUTTONS;
import android.content.Context;
import android.util.AttributeSet;
import android.util.FloatProperty;
@@ -27,11 +25,8 @@ import android.widget.FrameLayout;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.util.DisplayController;
/**
* A rounded rectangular component containing a single TextView.
@@ -103,36 +98,10 @@ public class SplitInstructionsView extends FrameLayout {
this,
mLauncher.getDeviceProfile(),
getMeasuredHeight(),
getMeasuredWidth(),
getThreeButtonNavShift()
getMeasuredWidth()
);
}
// In some cases, when user is using 3-button nav, there isn't enough room for both the
// 3-button nav and a centered SplitInstructionsView. This function will return an int that will
// be used to shift the SplitInstructionsView over a bit so that everything looks well-spaced.
// In many cases, this will return 0, since we don't need to shift it away from the center.
int getThreeButtonNavShift() {
DeviceProfile dp = mLauncher.getDeviceProfile();
if ((DisplayController.getNavigationMode(getContext()) == THREE_BUTTONS)
&& ((dp.isTwoPanels) || (dp.isTablet && !dp.isLandscape))
// If taskbar is in overview, overview action has dedicated space above nav buttons
&& !FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get()) {
int navButtonWidth = getResources().getDimensionPixelSize(
R.dimen.taskbar_nav_buttons_size);
int extraMargin = getResources().getDimensionPixelSize(
R.dimen.taskbar_split_instructions_margin);
// Explanation: The 3-button nav for non-phones sits on one side of the screen, taking
// up 3 buttons + a side margin worth of space. Our splitInstructionsView starts in the
// center of the screen and we want to center it in the remaining space, therefore we
// want to shift it over by half the 3-button layout's width.
// If the user is using an RtL layout, we shift it the opposite way.
return -((3 * navButtonWidth + extraMargin) / 2) * (isLayoutRtl() ? -1 : 1);
} else {
return 0;
}
}
public AppCompatTextView getTextView() {
return mTextView;
}
-4
View File
@@ -415,10 +415,6 @@
<dimen name="split_instructions_elevation">1dp</dimen>
<dimen name="split_instructions_horizontal_padding">24dp</dimen>
<dimen name="split_instructions_vertical_padding">12dp</dimen>
<dimen name="split_instructions_bottom_margin_tablet_landscape">32dp</dimen>
<dimen name="split_instructions_bottom_margin_tablet_portrait">44dp</dimen>
<dimen name="split_instructions_bottom_margin_twopanels_landscape">33dp</dimen>
<dimen name="split_instructions_bottom_margin_twopanels_portrait">51dp</dimen>
<dimen name="split_instructions_bottom_margin_phone_landscape">24dp</dimen>
<dimen name="split_instructions_bottom_margin_phone_portrait">60dp</dimen>
+1 -8
View File
@@ -1417,14 +1417,7 @@ public class DeviceProfile {
*/
public int getOverviewActionsClaimedSpaceBelow() {
if (isTaskbarPresent) {
if (FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get()) {
return transientTaskbarSize + transientTaskbarMargin * 2;
}
return isGestureMode
? stashedTaskbarSize
// Align vertically to where nav buttons are.
: ((taskbarSize - overviewActionsHeight) / 2) + getTaskbarOffsetY();
return transientTaskbarSize + transientTaskbarMargin * 2;
}
return mInsets.bottom;
}
@@ -216,10 +216,6 @@ public final class FeatureFlags {
"ENABLE_ALL_APPS_ONE_SEARCH_IN_TASKBAR", false,
"Enables One Search box in Taskbar All Apps.");
public static final BooleanFlag ENABLE_TASKBAR_IN_OVERVIEW = getDebugFlag(270393449,
"ENABLE_TASKBAR_IN_OVERVIEW", true,
"Enables accessing the system Taskbar in overview.");
public static final BooleanFlag ENABLE_SPLIT_FROM_WORKSPACE = getDebugFlag(270393906,
"ENABLE_SPLIT_FROM_WORKSPACE", true,
"Enable initiating split screen from workspace.");
@@ -448,7 +448,7 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
@Override
public void setSplitInstructionsParams(View out, DeviceProfile dp, int splitInstructionsHeight,
int splitInstructionsWidth, int threeButtonNavShift) {
int splitInstructionsWidth) {
out.setPivotX(0);
out.setPivotY(splitInstructionsHeight);
out.setRotation(getDegreesRotated());
@@ -142,7 +142,7 @@ public interface PagedOrientationHandler {
* @param splitInstructionsWidth The SplitInstructionView's width.
*/
void setSplitInstructionsParams(View out, DeviceProfile dp, int splitInstructionsHeight,
int splitInstructionsWidth, int threeButtonNavShift);
int splitInstructionsWidth);
/**
* @param splitDividerSize height of split screen drag handle in portrait, width in landscape
@@ -27,7 +27,6 @@ import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X;
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y;
import static com.android.launcher3.touch.SingleAxisSwipeDetector.VERTICAL;
import static com.android.launcher3.util.NavigationMode.THREE_BUTTONS;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_MAIN;
@@ -51,8 +50,6 @@ import android.widget.LinearLayout;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.SplitConfigurationOptions;
import com.android.launcher3.util.SplitConfigurationOptions.SplitBounds;
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
@@ -517,57 +514,29 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
@Override
public void setSplitInstructionsParams(View out, DeviceProfile dp, int splitInstructionsHeight,
int splitInstructionsWidth, int threeButtonNavShift) {
int splitInstructionsWidth) {
out.setPivotX(0);
out.setPivotY(splitInstructionsHeight);
out.setRotation(getDegreesRotated());
int distanceToEdge;
if ((DisplayController.getNavigationMode(out.getContext()) == THREE_BUTTONS)
&& (dp.isTwoPanels || dp.isTablet)
// If taskbar is in overview, overview action has dedicated space above nav buttons
&& !FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get()) {
// If 3-button nav is active, align the splitInstructionsView with it.
distanceToEdge = dp.getTaskbarOffsetY()
+ ((dp.taskbarSize - splitInstructionsHeight) / 2);
} else {
// If 3-button nav is not active, set bottom margin according to spec.
if (dp.isPhone) {
if (dp.isLandscape) {
distanceToEdge = out.getResources().getDimensionPixelSize(
R.dimen.split_instructions_bottom_margin_phone_landscape);
} else {
distanceToEdge = out.getResources().getDimensionPixelSize(
R.dimen.split_instructions_bottom_margin_phone_portrait);
}
} else if (dp.isTwoPanels) {
if (dp.isLandscape) {
distanceToEdge = out.getResources().getDimensionPixelSize(
R.dimen.split_instructions_bottom_margin_twopanels_landscape);
} else {
distanceToEdge = out.getResources().getDimensionPixelSize(
R.dimen.split_instructions_bottom_margin_twopanels_portrait);
}
if (dp.isPhone) {
if (dp.isLandscape) {
distanceToEdge = out.getResources().getDimensionPixelSize(
R.dimen.split_instructions_bottom_margin_phone_landscape);
} else {
if (dp.isLandscape) {
distanceToEdge = out.getResources().getDimensionPixelSize(
R.dimen.split_instructions_bottom_margin_tablet_landscape);
} else {
distanceToEdge = out.getResources().getDimensionPixelSize(
R.dimen.split_instructions_bottom_margin_tablet_portrait);
}
distanceToEdge = out.getResources().getDimensionPixelSize(
R.dimen.split_instructions_bottom_margin_phone_portrait);
}
} else {
distanceToEdge = dp.getOverviewActionsClaimedSpaceBelow();
}
// Center the view in case of unbalanced insets on left or right of screen
int insetCorrectionX = (dp.getInsets().right - dp.getInsets().left) / 2;
// Adjust for any insets on the bottom edge
int insetCorrectionY = dp.getInsets().bottom;
// Adjust for taskbar in overview
int taskbarCorrectionY =
dp.isTaskbarPresent && FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get()
? dp.taskbarSize : 0;
out.setTranslationX(insetCorrectionX + threeButtonNavShift);
out.setTranslationY(-distanceToEdge + insetCorrectionY - taskbarCorrectionY);
out.setTranslationX(insetCorrectionX);
out.setTranslationY(-distanceToEdge + insetCorrectionY);
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) out.getLayoutParams();
lp.gravity = CENTER_HORIZONTAL | BOTTOM;
out.setLayoutParams(lp);
@@ -184,7 +184,7 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler {
@Override
public void setSplitInstructionsParams(View out, DeviceProfile dp, int splitInstructionsHeight,
int splitInstructionsWidth, int threeButtonNavShift) {
int splitInstructionsWidth) {
out.setPivotX(0);
out.setPivotY(splitInstructionsHeight);
out.setRotation(getDegreesRotated());