Merge "Fix taskbar drag view scale when returning to original icon" into tm-qpr-dev
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
index 49dec1e..ab52adb 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
@@ -877,9 +877,9 @@
* (potentially breaking a split pair).
*/
private void launchFromTaskbarPreservingSplitIfVisible(RecentsView recents, ItemInfo info) {
- recents.findLastActiveTaskAndRunCallback(
+ recents.getSplitSelectController().findLastActiveTaskAndRunCallback(
info.getTargetComponent(),
- (Consumer<Task>) foundTask -> {
+ foundTask -> {
if (foundTask != null) {
TaskView foundTaskView =
recents.getTaskViewByTaskId(foundTask.key.id);
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
index 1c6aca7..0b86155 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
@@ -38,7 +38,6 @@
import com.android.launcher3.anim.AnimatorListeners;
import com.android.launcher3.statemanager.StateManager;
import com.android.launcher3.uioverrides.QuickstepLauncher;
-import com.android.launcher3.uioverrides.states.OverviewState;
import com.android.launcher3.util.MultiPropertyFactory.MultiProperty;
import com.android.launcher3.util.window.RefreshRateTracker;
import com.android.quickstep.RecentsAnimationCallbacks;
@@ -119,11 +118,10 @@
mLauncherState = finalState;
updateStateForFlag(FLAG_TRANSITION_STATE_RUNNING, false);
applyState();
- boolean finalStateOverview = finalState instanceof OverviewState;
boolean disallowLongClick = finalState == LauncherState.OVERVIEW_SPLIT_SELECT;
com.android.launcher3.taskbar.Utilities.setOverviewDragState(
- mControllers, finalStateOverview /*disallowGlobalDrag*/,
- disallowLongClick, finalStateOverview /*allowInitialSplitSelection*/);
+ mControllers, finalState.disallowTaskbarGlobalDrag(),
+ disallowLongClick, finalState.allowTaskbarInitialSplitSelection());
}
};
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
index 24a089c..3479255 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
@@ -189,9 +189,9 @@
if (recentsView == null) {
return;
}
- recentsView.findLastActiveTaskAndRunCallback(
+ recentsView.getSplitSelectController().findLastActiveTaskAndRunCallback(
splitSelectSource.intent.getComponent(),
- (Consumer<Task>) foundTask -> {
+ foundTask -> {
splitSelectSource.alreadyRunningTaskId = foundTask == null
? INVALID_TASK_ID
: foundTask.key.id;
@@ -206,9 +206,9 @@
*/
public void triggerSecondAppForSplit(ItemInfoWithIcon info, Intent intent, View startingView) {
RecentsView recents = getRecentsView();
- recents.findLastActiveTaskAndRunCallback(
+ recents.getSplitSelectController().findLastActiveTaskAndRunCallback(
info.getTargetComponent(),
- (Consumer<Task>) foundTask -> {
+ foundTask -> {
if (foundTask != null) {
TaskView foundTaskView = recents.getTaskViewByTaskId(foundTask.key.id);
// TODO (b/266482558): This additional null check is needed because there
diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
index 46cd045..3dbe6c8 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -579,9 +579,9 @@
RecentsView recentsView = getOverviewPanel();
// Check if there is already an instance of this app running, if so, initiate the split
// using that.
- recentsView.findLastActiveTaskAndRunCallback(
+ mSplitSelectStateController.findLastActiveTaskAndRunCallback(
splitSelectSource.intent.getComponent(),
- (Consumer<Task>) foundTask -> {
+ foundTask -> {
splitSelectSource.alreadyRunningTaskId = foundTask == null
? INVALID_TASK_ID
: foundTask.key.id;
@@ -595,8 +595,7 @@
}
/** TODO(b/266482558) Migrate into SplitSelectStateController or someplace split specific. */
- private void startSplitToHome(
- SplitSelectSource source) {
+ private void startSplitToHome(SplitSelectSource source) {
AbstractFloatingView.closeAllOpenViews(this);
int splitPlaceholderSize = getResources().getDimensionPixelSize(
R.dimen.split_placeholder_size);
@@ -604,14 +603,14 @@
R.dimen.split_placeholder_inset);
Rect tempRect = new Rect();
- SplitSelectStateController controller = getSplitSelectStateController();
- controller.setInitialTaskSelect(source.intent, source.position.stagePosition,
- source.itemInfo, source.splitEvent, source.alreadyRunningTaskId);
+ mSplitSelectStateController.setInitialTaskSelect(source.intent,
+ source.position.stagePosition, source.itemInfo, source.splitEvent,
+ source.alreadyRunningTaskId);
RecentsView recentsView = getOverviewPanel();
recentsView.getPagedOrientationHandler().getInitialSplitPlaceholderBounds(
splitPlaceholderSize, splitPlaceholderInset, getDeviceProfile(),
- controller.getActiveSplitStagePosition(), tempRect);
+ mSplitSelectStateController.getActiveSplitStagePosition(), tempRect);
PendingAnimation anim = new PendingAnimation(TABLET_HOME_TO_SPLIT.getDuration());
RectF startingTaskRect = new RectF();
@@ -620,12 +619,12 @@
floatingTaskView.setAlpha(1);
floatingTaskView.addStagingAnimation(anim, startingTaskRect, tempRect,
false /* fadeWithThumbnail */, true /* isStagedTask */);
- controller.setFirstFloatingTaskView(floatingTaskView);
+ mSplitSelectStateController.setFirstFloatingTaskView(floatingTaskView);
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationCancel(Animator animation) {
getDragLayer().removeView(floatingTaskView);
- controller.resetState();
+ mSplitSelectStateController.resetState();
}
});
anim.buildAnim().start();
@@ -1156,14 +1155,12 @@
// Launcher to first restore into Overview state, wait for the relevant tasks and icons to
// load in, and then proceed to OverviewSplitSelect.
if (isInState(OVERVIEW_SPLIT_SELECT)) {
- SplitSelectStateController splitSelectStateController =
- ((RecentsView) getOverviewPanel()).getSplitSelectController();
// Launcher will restart in Overview and then transition to OverviewSplitSelect.
outState.putIBinder(PENDING_SPLIT_SELECT_INFO, ObjectWrapper.wrap(
new PendingSplitSelectInfo(
- splitSelectStateController.getInitialTaskId(),
- splitSelectStateController.getActiveSplitStagePosition(),
- splitSelectStateController.getSplitEvent())
+ mSplitSelectStateController.getInitialTaskId(),
+ mSplitSelectStateController.getActiveSplitStagePosition(),
+ mSplitSelectStateController.getSplitEvent())
));
outState.putInt(RUNTIME_STATE, OVERVIEW.ordinal);
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
index 95eb128..8125fc8 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
@@ -116,6 +116,18 @@
return super.isTaskbarAlignedWithHotseat(launcher);
}
+ @Override
+ public boolean disallowTaskbarGlobalDrag() {
+ // Enable global drag in overview
+ return false;
+ }
+
+ @Override
+ public boolean allowTaskbarInitialSplitSelection() {
+ // Disallow split select from taskbar items in overview
+ return false;
+ }
+
public static float[] getOverviewScaleAndOffsetForBackgroundState(
BaseDraggingActivity activity) {
return new float[] {
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java
index 0c49e5f..b9221ee 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java
@@ -18,12 +18,12 @@
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW;
import android.content.Context;
-import android.graphics.Point;
import android.graphics.Rect;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
+import com.android.launcher3.config.FeatureFlags;
import com.android.quickstep.views.RecentsView;
/**
@@ -70,13 +70,22 @@
}
}
- public static float[] getOverviewScaleAndOffsetForModalState(BaseDraggingActivity activity) {
- Point taskSize = activity.<RecentsView>getOverviewPanel().getSelectedTaskSize();
- Rect modalTaskSize = new Rect();
- activity.<RecentsView>getOverviewPanel().getModalTaskSize(modalTaskSize);
+ @Override
+ public boolean isTaskbarStashed(Launcher launcher) {
+ if (FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get()) {
+ return true;
+ }
+ return super.isTaskbarStashed(launcher);
+ }
- float scale = Math.min((float) modalTaskSize.height() / taskSize.y,
- (float) modalTaskSize.width() / taskSize.x);
+ public static float[] getOverviewScaleAndOffsetForModalState(BaseDraggingActivity activity) {
+ RecentsView recentsView = activity.<RecentsView>getOverviewPanel();
+ Rect taskSize = recentsView.getSelectedTaskBounds();
+ Rect modalTaskSize = new Rect();
+ recentsView.getModalTaskSize(modalTaskSize);
+
+ float scale = Math.min((float) modalTaskSize.height() / taskSize.height(),
+ (float) modalTaskSize.width() / taskSize.width());
return new float[] {scale, NO_OFFSET};
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java
index d075750..233ed46 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java
@@ -124,6 +124,18 @@
}
@Override
+ public boolean disallowTaskbarGlobalDrag() {
+ // Disable global drag in overview
+ return true;
+ }
+
+ @Override
+ public boolean allowTaskbarInitialSplitSelection() {
+ // Allow split select from taskbar items in overview
+ return true;
+ }
+
+ @Override
public String getDescription(Launcher launcher) {
return launcher.getString(R.string.accessibility_recent_apps);
}
diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
index f9ad749..998439e 100644
--- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
@@ -52,6 +52,7 @@
import com.android.launcher3.R;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.PendingAnimation;
+import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.statehandlers.DepthController;
import com.android.launcher3.statehandlers.DesktopVisibilityController;
import com.android.launcher3.statemanager.BaseState;
@@ -339,12 +340,21 @@
*/
public final void calculateModalTaskSize(Context context, DeviceProfile dp, Rect outRect) {
calculateTaskSize(context, dp, outRect);
- float maxScale = context.getResources().getFloat(R.dimen.overview_modal_max_scale);
+ boolean isGridOnlyOverview = dp.isTablet && FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get();
+ int claimedSpaceBelow = isGridOnlyOverview
+ ? dp.overviewActionsTopMarginPx + dp.overviewActionsHeight + dp.stashedTaskbarSize
+ : (dp.heightPx - outRect.bottom - dp.getInsets().bottom);
+ int minimumHorizontalPadding = 0;
+ if (!isGridOnlyOverview) {
+ float maxScale = context.getResources().getFloat(R.dimen.overview_modal_max_scale);
+ minimumHorizontalPadding =
+ Math.round((dp.availableWidthPx - outRect.width() * maxScale) / 2);
+ }
calculateTaskSizeInternal(
context, dp,
dp.overviewTaskMarginPx,
- dp.heightPx - outRect.bottom - dp.getInsets().bottom,
- Math.round((dp.availableWidthPx - outRect.width() * maxScale) / 2),
+ claimedSpaceBelow,
+ minimumHorizontalPadding,
1f /*maxScale*/,
Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM,
outRect);
diff --git a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
index 0dcd723..72330ef 100644
--- a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
+++ b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
@@ -80,9 +80,9 @@
boolean isInLandscape = orientedState.getTouchRotation() != ROTATION_0;
boolean isTablet = activity.getDeviceProfile().isTablet;
+ boolean isGridOnlyOverview = isTablet && FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get();
// Add overview actions to the menu when in in-place rotate landscape mode.
- if ((!canLauncherRotate && isInLandscape)
- || (isTablet && FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get())) {
+ if ((!canLauncherRotate && isInLandscape) || isGridOnlyOverview) {
// Add screenshot action to task menu.
List<SystemShortcut> screenshotShortcuts = TaskShortcutFactory.SCREENSHOT
.getShortcuts(activity, taskContainer);
diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java
index db6d56b..4b1dd43 100644
--- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java
+++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java
@@ -15,6 +15,8 @@
*/
package com.android.quickstep.fallback;
+import static android.app.ActivityTaskManager.INVALID_TASK_ID;
+
import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS;
import static com.android.quickstep.fallback.RecentsState.DEFAULT;
import static com.android.quickstep.fallback.RecentsState.HOME;
@@ -200,8 +202,9 @@
}
@Override
- public void setModalStateEnabled(boolean isModalState, boolean animate) {
- if (isModalState) {
+ public void setModalStateEnabled(int taskId, boolean animate) {
+ if (taskId != INVALID_TASK_ID) {
+ setSelectedTask(taskId);
mActivity.getStateManager().goToState(RecentsState.MODAL_TASK, animate);
} else {
if (mActivity.isInState(RecentsState.MODAL_TASK)) {
diff --git a/quickstep/src/com/android/quickstep/util/BaseUnfoldMoveFromCenterAnimator.java b/quickstep/src/com/android/quickstep/util/BaseUnfoldMoveFromCenterAnimator.java
index 543ca89..2a8bfa2 100644
--- a/quickstep/src/com/android/quickstep/util/BaseUnfoldMoveFromCenterAnimator.java
+++ b/quickstep/src/com/android/quickstep/util/BaseUnfoldMoveFromCenterAnimator.java
@@ -100,22 +100,34 @@
mMoveFromCenterAnimation.registerViewForAnimation(view);
}
- protected void disableClipping(ViewGroup view) {
+ /**
+ * Sets clipToPadding for the view which then could be restored to the original value
+ * using {@link BaseUnfoldMoveFromCenterAnimator#restoreClippings} method call
+ * @param view view to set the property
+ * @param clipToPadding value of the property
+ */
+ protected void setClipToPadding(ViewGroup view, boolean clipToPadding) {
mOriginalClipToPadding.put(view, view.getClipToPadding());
- mOriginalClipChildren.put(view, view.getClipChildren());
- view.setClipToPadding(false);
- view.setClipChildren(false);
+ view.setClipToPadding(clipToPadding);
}
- protected void restoreClipping(ViewGroup view) {
- final Boolean originalClipToPadding = mOriginalClipToPadding.get(view);
- if (originalClipToPadding != null) {
- view.setClipToPadding(originalClipToPadding);
- }
- final Boolean originalClipChildren = mOriginalClipChildren.get(view);
- if (originalClipChildren != null) {
- view.setClipChildren(originalClipChildren);
- }
+ /**
+ * Sets clipChildren for the view which then could be restored to the original value
+ * using {@link BaseUnfoldMoveFromCenterAnimator#restoreClippings} method call
+ * @param view view to set the property
+ * @param clipChildren value of the property
+ */
+ protected void setClipChildren(ViewGroup view, boolean clipChildren) {
+ mOriginalClipChildren.put(view, view.getClipChildren());
+ view.setClipChildren(clipChildren);
+ }
+
+ /**
+ * Restores original clip properties after their modifications
+ */
+ protected void restoreClippings() {
+ mOriginalClipToPadding.forEach(ViewGroup::setClipToPadding);
+ mOriginalClipChildren.forEach(ViewGroup::setClipChildren);
}
private class UnfoldMoveFromCenterRotationListener implements
diff --git a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
index 1b2bfc9..51afb5b 100644
--- a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
+++ b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
@@ -29,6 +29,7 @@
import android.app.ActivityOptions;
import android.app.ActivityThread;
import android.app.PendingIntent;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
@@ -59,6 +60,7 @@
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.util.SplitConfigurationOptions;
import com.android.launcher3.util.SplitConfigurationOptions.StagePosition;
+import com.android.quickstep.RecentsModel;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.TaskAnimationManager;
import com.android.quickstep.TaskViewUtils;
@@ -79,10 +81,12 @@
private final Context mContext;
private final Handler mHandler;
+ private final RecentsModel mRecentTasksModel;
private StatsLogManager mStatsLogManager;
private final SystemUiProxy mSystemUiProxy;
private final StateManager mStateManager;
- private final DepthController mDepthController;
+ @Nullable
+ private DepthController mDepthController;
private @StagePosition int mStagePosition;
private ItemInfo mItemInfo;
private Intent mInitialTaskIntent;
@@ -110,6 +114,7 @@
mSystemUiProxy = SystemUiProxy.INSTANCE.get(mContext);
mStateManager = stateManager;
mDepthController = depthController;
+ mRecentTasksModel = RecentsModel.INSTANCE.get(context);
}
/**
@@ -149,6 +154,50 @@
}
/**
+ * Pulls the list of active Tasks from RecentsModel, and finds the most recently active Task
+ * matching a given ComponentName. Then uses that Task (which could be null) with the given
+ * callback.
+ *
+ * Used in various task-switching or splitscreen operations when we need to check if there is a
+ * currently running Task of a certain type and use the most recent one.
+ */
+ public void findLastActiveTaskAndRunCallback(ComponentName componentName,
+ Consumer<Task> callback) {
+ mRecentTasksModel.getTasks(taskGroups -> {
+ Task lastActiveTask = null;
+ // Loop through tasks in reverse, since they are ordered with most-recent tasks last.
+ for (int i = taskGroups.size() - 1; i >= 0; i--) {
+ GroupTask groupTask = taskGroups.get(i);
+ Task task1 = groupTask.task1;
+ if (isInstanceOfComponent(task1, componentName)) {
+ lastActiveTask = task1;
+ break;
+ }
+ Task task2 = groupTask.task2;
+ if (isInstanceOfComponent(task2, componentName)) {
+ lastActiveTask = task2;
+ break;
+ }
+ }
+
+ callback.accept(lastActiveTask);
+ });
+ }
+
+ /**
+ * Checks if a given Task is the most recently-active Task of type componentName. Used for
+ * selecting already-running Tasks for splitscreen.
+ */
+ public boolean isInstanceOfComponent(@Nullable Task task, ComponentName componentName) {
+ // Exclude the task that is already staged
+ if (task == null || task.key.id == mInitialTaskId) {
+ return false;
+ }
+
+ return task.key.baseIntent.getComponent().equals(componentName);
+ }
+
+ /**
* To be called when the actual tasks ({@link #mInitialTaskId}, {@link #mSecondTaskId}) are
* to be launched. Call after launcher side animations are complete.
*/
diff --git a/quickstep/src/com/android/quickstep/util/UnfoldMoveFromCenterHotseatAnimator.java b/quickstep/src/com/android/quickstep/util/UnfoldMoveFromCenterHotseatAnimator.java
index 01a997a..70a12d6 100644
--- a/quickstep/src/com/android/quickstep/util/UnfoldMoveFromCenterHotseatAnimator.java
+++ b/quickstep/src/com/android/quickstep/util/UnfoldMoveFromCenterHotseatAnimator.java
@@ -41,7 +41,8 @@
Hotseat hotseat = mLauncher.getHotseat();
ViewGroup hotseatIcons = hotseat.getShortcutsAndWidgets();
- disableClipping(hotseat);
+ setClipChildren(hotseat, false);
+ setClipToPadding(hotseat, false);
for (int i = 0; i < hotseatIcons.getChildCount(); i++) {
View child = hotseatIcons.getChildAt(i);
@@ -51,7 +52,7 @@
@Override
public void onTransitionFinished() {
- restoreClipping(mLauncher.getHotseat());
+ restoreClippings();
super.onTransitionFinished();
}
}
diff --git a/quickstep/src/com/android/quickstep/util/UnfoldMoveFromCenterWorkspaceAnimator.java b/quickstep/src/com/android/quickstep/util/UnfoldMoveFromCenterWorkspaceAnimator.java
index 95a4b8f..7da103e 100644
--- a/quickstep/src/com/android/quickstep/util/UnfoldMoveFromCenterWorkspaceAnimator.java
+++ b/quickstep/src/com/android/quickstep/util/UnfoldMoveFromCenterWorkspaceAnimator.java
@@ -47,7 +47,8 @@
final CellLayout cellLayout = (CellLayout) page;
ShortcutAndWidgetContainer itemsContainer = cellLayout
.getShortcutsAndWidgets();
- disableClipping(cellLayout);
+ setClipChildren(cellLayout, false);
+ setClipToPadding(cellLayout, false);
for (int i = 0; i < itemsContainer.getChildCount(); i++) {
View child = itemsContainer.getChildAt(i);
@@ -55,13 +56,13 @@
}
});
- disableClipping(workspace);
+ setClipChildren(workspace, false);
+ setClipToPadding(workspace, true);
}
@Override
public void onTransitionFinished() {
- restoreClipping(mLauncher.getWorkspace());
- mLauncher.getWorkspace().forEachVisiblePage(page -> restoreClipping((CellLayout) page));
+ restoreClippings();
super.onTransitionFinished();
}
}
diff --git a/quickstep/src/com/android/quickstep/views/LaunchableConstraintLayout.kt b/quickstep/src/com/android/quickstep/views/LaunchableConstraintLayout.kt
new file mode 100644
index 0000000..537eca1
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/views/LaunchableConstraintLayout.kt
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.quickstep.views
+
+import android.content.Context
+import android.util.AttributeSet
+import androidx.constraintlayout.widget.ConstraintLayout
+import com.android.systemui.animation.LaunchableView
+import com.android.systemui.animation.LaunchableViewDelegate
+
+/** A [ConstraintLayout] that also implements [LaunchableView]. */
+open class LaunchableConstraintLayout : ConstraintLayout, LaunchableView {
+ private val delegate =
+ LaunchableViewDelegate(
+ this,
+ superSetVisibility = { super.setVisibility(it) },
+ )
+
+ constructor(context: Context) : super(context)
+ constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
+ constructor(
+ context: Context,
+ attrs: AttributeSet?,
+ defStyleAttr: Int,
+ ) : super(context, attrs, defStyleAttr)
+
+ constructor(
+ context: Context,
+ attrs: AttributeSet?,
+ defStyleAttr: Int,
+ defStyleRes: Int,
+ ) : super(context, attrs, defStyleAttr, defStyleRes)
+
+ override fun setShouldBlockVisibilityChanges(block: Boolean) {
+ delegate.setShouldBlockVisibilityChanges(block)
+ }
+
+ override fun setVisibility(visibility: Int) {
+ // Note that super.setVisibility() is passed to the delegate upon creation and called by it.
+ // This method is just a passthrough if no animation is in progress, whereas otherwise it
+ // caches the passed value and restores it at the end of the animation.
+ delegate.setVisibility(visibility)
+ }
+}
diff --git a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
index ff26129..c165acc 100644
--- a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
@@ -15,6 +15,8 @@
*/
package com.android.quickstep.views;
+import static android.app.ActivityTaskManager.INVALID_TASK_ID;
+
import static com.android.launcher3.LauncherState.CLEAR_ALL_BUTTON;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
@@ -171,8 +173,9 @@
}
@Override
- public void setModalStateEnabled(boolean isModalState, boolean animate) {
- if (isModalState) {
+ public void setModalStateEnabled(int taskId, boolean animate) {
+ if (taskId != INVALID_TASK_ID) {
+ setSelectedTask(taskId);
mActivity.getStateManager().goToState(LauncherState.OVERVIEW_MODAL_TASK, animate);
} else {
if (mActivity.isInState(LauncherState.OVERVIEW_MODAL_TASK)) {
diff --git a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
index 0d21e60..f578b87 100644
--- a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
+++ b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
@@ -303,6 +303,10 @@
return mDp.getOverviewActionsClaimedSpaceBelow();
}
+ if (mDp.isTablet && FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get()) {
+ return mDp.stashedTaskbarSize;
+ }
+
// Align to bottom of task Rect.
return mDp.heightPx - mTaskSize.bottom - mDp.overviewActionsTopMarginPx
- mDp.overviewActionsHeight;
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 5ecc05a..e529b04 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -453,6 +453,7 @@
protected final Rect mLastComputedTaskSize = new Rect();
protected final Rect mLastComputedGridSize = new Rect();
protected final Rect mLastComputedGridTaskSize = new Rect();
+ private TaskView mSelectedTask = null;
// How much a task that is directly offscreen will be pushed out due to RecentsView scale/pivot.
@Nullable
protected Float mLastComputedTaskStartPushOutDistance = null;
@@ -1084,6 +1085,16 @@
super.draw(canvas);
}
+ @Override
+ public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) {
+ if (isModal()) {
+ // Do not scroll when clicking on a modal grid task, as it will already be centered
+ // on screen.
+ return false;
+ }
+ return super.requestChildRectangleOnScreen(child, rectangle, immediate);
+ }
+
public void addSideTaskLaunchCallback(RunnableList callback) {
if (mSideTaskLaunchCallback == null) {
mSideTaskLaunchCallback = new RunnableList();
@@ -1272,7 +1283,7 @@
*/
@Nullable
public TaskView getTaskViewByTaskId(int taskId) {
- if (taskId == -1) {
+ if (taskId == INVALID_TASK_ID) {
return null;
}
@@ -1285,53 +1296,6 @@
return null;
}
- /**
- * Pulls the list of active Tasks from RecentsModel, and finds the most recently active Task
- * matching a given ComponentName. Then uses that Task (which could be null) with the given
- * callback.
- *
- * Used in various task-switching or splitscreen operations when we need to check if there is a
- * currently running Task of a certain type and use the most recent one.
- */
- public void findLastActiveTaskAndRunCallback(ComponentName componentName,
- Consumer<Task> callback) {
- mModel.getTasks(taskGroups -> {
- Task lastActiveTask = null;
- // Loop through tasks in reverse, since they are ordered with most-recent tasks last.
- for (int i = taskGroups.size() - 1; i >= 0; i--) {
- GroupTask groupTask = taskGroups.get(i);
- Task task1 = groupTask.task1;
- if (isInstanceOfComponent(task1, componentName)) {
- lastActiveTask = task1;
- break;
- }
- Task task2 = groupTask.task2;
- if (isInstanceOfComponent(task2, componentName)) {
- lastActiveTask = task2;
- break;
- }
- }
-
- callback.accept(lastActiveTask);
- });
- }
-
- /**
- * Checks if a given Task is the most recently-active Task of type componentName. Used for
- * selecting already-running Tasks for splitscreen.
- */
- public boolean isInstanceOfComponent(@Nullable Task task, ComponentName componentName) {
- if (task == null) {
- return false;
- }
- // Exclude the task that is already staged
- if (mSplitHiddenTaskView != null && mSplitHiddenTaskView.getTask().equals(task)) {
- return false;
- }
-
- return task.key.baseIntent.getComponent().equals(componentName);
- }
-
public void setOverviewStateEnabled(boolean enabled) {
mOverviewStateEnabled = enabled;
updateTaskStackListenerState();
@@ -1967,7 +1931,7 @@
private void onOrientationChanged() {
// If overview is in modal state when rotate, reset it to overview state without running
// animation.
- setModalStateEnabled(/* isModalState= */ false, /* animate= */ false);
+ setModalStateEnabled(/* taskId= */ INVALID_TASK_ID, /* animate= */ false);
if (isSplitSelectionActive()) {
onRotateInSplitSelectionState();
}
@@ -2040,12 +2004,33 @@
}
/**
- * Returns the size of task selected to enter modal state.
+ * Sets the last TaskView selected.
*/
- public Point getSelectedTaskSize() {
- mSizeStrategy.calculateTaskSize(mActivity, mActivity.getDeviceProfile(),
- mTempRect);
- return new Point(mTempRect.width(), mTempRect.height());
+ public void setSelectedTask(int lastSelectedTaskId) {
+ mSelectedTask = getTaskViewByTaskId(lastSelectedTaskId);
+ }
+
+ /**
+ * Returns the bounds of the task selected to enter modal state.
+ */
+ public Rect getSelectedTaskBounds() {
+ if (mSelectedTask == null) {
+ return mLastComputedTaskSize;
+ }
+ return getTaskBounds(mSelectedTask);
+ }
+
+ private Rect getTaskBounds(TaskView taskView) {
+ int selectedPage = indexOfChild(taskView);
+ int primaryScroll = mOrientationHandler.getPrimaryScroll(this);
+ int selectedPageScroll = getScrollForPage(selectedPage);
+ boolean isTopRow = taskView != null && mTopRowIdSet.contains(taskView.getTaskViewId());
+ Rect outRect = new Rect(mLastComputedTaskSize);
+ outRect.offset(
+ -(primaryScroll - (selectedPageScroll + getOffsetFromScrollPosition(selectedPage))),
+ (int) (showAsGrid() && ENABLE_GRID_ONLY_OVERVIEW.get() && !isTopRow
+ ? mTopBottomRowHeightDiff : 0));
+ return outRect;
}
/** Gets the last computed task size */
@@ -4169,8 +4154,13 @@
private void updatePivots() {
if (mOverviewSelectEnabled) {
- setPivotX(mLastComputedTaskSize.centerX());
- setPivotY(mLastComputedTaskSize.bottom);
+ getModalTaskSize(mTempRect);
+ Rect selectedTaskPosition = getSelectedTaskBounds();
+
+ Utilities.getPivotsForScalingRectToRect(mTempRect, selectedTaskPosition,
+ mTempPointF);
+ setPivotX(mTempPointF.x);
+ setPivotY(mTempPointF.y);
} else {
getPagedViewOrientedState().getFullScreenScaleAndPivot(mTempRect,
mActivity.getDeviceProfile(), mTempPointF);
@@ -4183,11 +4173,17 @@
float offset = mAdjacentPageHorizontalOffset;
float modalOffset = ACCEL_0_75.getInterpolation(mTaskModalness);
int count = getChildCount();
+ boolean showAsGrid = showAsGrid();
TaskView runningTask = mRunningTaskViewId == -1 || !mRunningTaskTileHidden
? null : getRunningTaskView();
int midpoint = runningTask == null ? -1 : indexOfChild(runningTask);
int modalMidpoint = getCurrentPage();
+ boolean isModalGridWithoutFocusedTask =
+ showAsGrid && ENABLE_GRID_ONLY_OVERVIEW.get() && mTaskModalness > 0;
+ if (isModalGridWithoutFocusedTask) {
+ modalMidpoint = indexOfChild(mSelectedTask);
+ }
float midpointOffsetSize = 0;
float leftOffsetSize = midpoint - 1 >= 0
@@ -4197,7 +4193,6 @@
? getHorizontalOffsetSize(midpoint + 1, midpoint, offset)
: 0;
- boolean showAsGrid = showAsGrid();
float modalMidpointOffsetSize = 0;
float modalLeftOffsetSize = 0;
float modalRightOffsetSize = 0;
@@ -4225,23 +4220,34 @@
: i < midpoint
? leftOffsetSize
: rightOffsetSize;
+ if (isModalGridWithoutFocusedTask) {
+ gridOffsetSize = getHorizontalOffsetSize(i, modalMidpoint, modalOffset);
+ gridOffsetSize = Math.abs(gridOffsetSize) * (i <= modalMidpoint ? 1 : -1);
+ }
float modalTranslation = i == modalMidpoint
? modalMidpointOffsetSize
: showAsGrid
? gridOffsetSize
: i < modalMidpoint ? modalLeftOffsetSize : modalRightOffsetSize;
- float totalTranslation = translation + modalTranslation;
+ float totalTranslationX = translation + modalTranslation;
View child = getChildAt(i);
- FloatProperty translationProperty = child instanceof TaskView
+ FloatProperty translationPropertyX = child instanceof TaskView
? ((TaskView) child).getPrimaryTaskOffsetTranslationProperty()
: mOrientationHandler.getPrimaryViewTranslate();
- translationProperty.set(child, totalTranslation);
+ translationPropertyX.set(child, totalTranslationX);
if (mEnableDrawingLiveTile && i == getRunningTaskIndex()) {
runActionOnRemoteHandles(
remoteTargetHandle -> remoteTargetHandle.getTaskViewSimulator()
- .taskPrimaryTranslation.value = totalTranslation);
+ .taskPrimaryTranslation.value = totalTranslationX);
redrawLiveTile();
}
+
+ if (showAsGrid && ENABLE_GRID_ONLY_OVERVIEW.get() && child instanceof TaskView) {
+ float totalTranslationY = getVerticalOffsetSize(i, modalOffset);
+ FloatProperty translationPropertyY =
+ ((TaskView) child).getSecondaryTaskOffsetTranslationProperty();
+ translationPropertyY.set(child, totalTranslationY);
+ }
}
updateCurveProperties();
}
@@ -4339,6 +4345,38 @@
return distanceToOffscreen * offsetProgress;
}
+ /**
+ * Computes the vertical distance to offset a given child such that it is completely offscreen.
+ *
+ * @param offsetProgress From 0 to 1 where 0 means no offset and 1 means offset offscreen.
+ */
+ private float getVerticalOffsetSize(int childIndex, float offsetProgress) {
+ if (offsetProgress == 0 || !(showAsGrid() && ENABLE_GRID_ONLY_OVERVIEW.get())
+ || mSelectedTask == null) {
+ // Don't bother calculating everything below if we won't offset vertically.
+ return 0;
+ }
+
+ // First, get the position of the task relative to the top row.
+ TaskView child = getTaskViewAt(childIndex);
+ Rect taskPosition = getTaskBounds(child);
+
+ boolean isSelectedTaskTopRow = mTopRowIdSet.contains(mSelectedTask.getTaskViewId());
+ boolean isChildTopRow = mTopRowIdSet.contains(child.getTaskViewId());
+ // Whether the task should be shifted to the top.
+ boolean isTopShift = !isSelectedTaskTopRow && isChildTopRow;
+ boolean isBottomShift = isSelectedTaskTopRow && !isChildTopRow;
+
+ // Next, calculate the distance to move the task off screen at scale = 1.
+ float distanceToOffscreen = 0;
+ if (isTopShift) {
+ distanceToOffscreen = -taskPosition.bottom;
+ } else if (isBottomShift) {
+ distanceToOffscreen = mActivity.getDeviceProfile().heightPx - taskPosition.top;
+ }
+ return distanceToOffscreen * offsetProgress;
+ }
+
protected void setTaskViewsResistanceTranslation(float translation) {
mTaskViewsSecondaryTranslation = translation;
for (int i = 0; i < getTaskViewCount(); i++) {
@@ -4438,9 +4476,8 @@
* Resets the visuals when exit modal state.
*/
public void resetModalVisuals() {
- TaskView taskView = getCurrentPageTaskView();
- if (taskView != null) {
- taskView.getThumbnail().getTaskOverlay().resetModalVisuals();
+ if (mSelectedTask != null) {
+ mSelectedTask.getThumbnail().getTaskOverlay().resetModalVisuals();
}
}
@@ -5442,6 +5479,9 @@
if (mOverviewSelectEnabled != overviewSelectEnabled) {
mOverviewSelectEnabled = overviewSelectEnabled;
updatePivots();
+ if (!mOverviewSelectEnabled) {
+ setSelectedTask(INVALID_TASK_ID);
+ }
}
}
@@ -5512,7 +5552,9 @@
private void setTaskModalness(float modalness) {
mTaskModalness = modalness;
updatePageOffsets();
- if (getCurrentPageTaskView() != null) {
+ if (mSelectedTask != null) {
+ mSelectedTask.setModalness(modalness);
+ } else if (getCurrentPageTaskView() != null) {
getCurrentPageTaskView().setModalness(modalness);
}
// Only show actions view when it's modal for in-place landscape mode.
@@ -5527,7 +5569,7 @@
}
/** Enables or disables modal state for RecentsView */
- public abstract void setModalStateEnabled(boolean isModalState, boolean animate);
+ public abstract void setModalStateEnabled(int taskId, boolean animate);
public TaskOverlayFactory getTaskOverlayFactory() {
return mTaskOverlayFactory;
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index df67b99..fb85605 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -1445,6 +1445,11 @@
TASK_OFFSET_TRANSLATION_X, TASK_OFFSET_TRANSLATION_Y);
}
+ public FloatProperty<TaskView> getSecondaryTaskOffsetTranslationProperty() {
+ return getPagedOrientationHandler().getSecondaryValue(
+ TASK_OFFSET_TRANSLATION_X, TASK_OFFSET_TRANSLATION_Y);
+ }
+
public FloatProperty<TaskView> getTaskResistanceTranslationProperty() {
return getPagedOrientationHandler().getSecondaryValue(
TASK_RESISTANCE_TRANSLATION_X, TASK_RESISTANCE_TRANSLATION_Y);
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index b109e8a..9e28608 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -374,9 +374,7 @@
@UiThread
protected void applyIconAndLabel(ItemInfoWithIcon info) {
- boolean useTheme = mDisplay == DISPLAY_WORKSPACE || mDisplay == DISPLAY_FOLDER
- || mDisplay == DISPLAY_TASKBAR;
- int flags = useTheme ? FLAG_THEMED : 0;
+ int flags = shouldUseTheme() ? FLAG_THEMED : 0;
if (mHideBadge) {
flags |= FLAG_NO_BADGE;
}
@@ -388,6 +386,11 @@
applyLabel(info);
}
+ protected boolean shouldUseTheme() {
+ return mDisplay == DISPLAY_WORKSPACE || mDisplay == DISPLAY_FOLDER
+ || mDisplay == DISPLAY_TASKBAR;
+ }
+
@UiThread
private void applyLabel(ItemInfoWithIcon info) {
setText(info.title);
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index e63b054..90b2374 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -190,10 +190,10 @@
public final int hotseatQsbVisualHeight;
private final int hotseatQsbShadowHeight;
public int hotseatBorderSpace;
- private int minHotseatIconSpacePx;
- private int minHotseatQsbWidthPx;
- private final int maxHotseatIconSpacePx;
- private int inlineNavButtonsEndSpacing;
+ private final int mMinHotseatIconSpacePx;
+ private final int mMinHotseatQsbWidthPx;
+ private final int mMaxHotseatIconSpacePx;
+ private final int mInlineNavButtonsEndSpacingPx;
// Bottom sheets
public int bottomSheetTopPadding;
@@ -490,7 +490,8 @@
hotseatBarSidePaddingStartPx = isVerticalBarLayout() ? workspacePageIndicatorHeight : 0;
updateHotseatSizes(pxFromDp(inv.iconSize[INDEX_DEFAULT], mMetrics));
if (areNavButtonsInline && !isPhone) {
- inlineNavButtonsEndSpacing = res.getDimensionPixelSize(inv.inlineNavButtonsEndSpacing);
+ mInlineNavButtonsEndSpacingPx =
+ res.getDimensionPixelSize(inv.inlineNavButtonsEndSpacing);
/*
* 3 nav buttons +
* Spacing between nav buttons +
@@ -498,9 +499,9 @@
*/
hotseatBarEndOffset = 3 * res.getDimensionPixelSize(R.dimen.taskbar_nav_buttons_size)
+ 2 * res.getDimensionPixelSize(R.dimen.taskbar_button_space_inbetween)
- + inlineNavButtonsEndSpacing;
+ + mInlineNavButtonsEndSpacingPx;
} else {
- inlineNavButtonsEndSpacing = 0;
+ mInlineNavButtonsEndSpacingPx = 0;
hotseatBarEndOffset = 0;
}
@@ -547,9 +548,9 @@
cellLayoutPadding);
updateWorkspacePadding();
- minHotseatIconSpacePx = res.getDimensionPixelSize(R.dimen.min_hotseat_icon_space);
- minHotseatQsbWidthPx = res.getDimensionPixelSize(R.dimen.min_hotseat_qsb_width);
- maxHotseatIconSpacePx = areNavButtonsInline
+ mMinHotseatIconSpacePx = res.getDimensionPixelSize(R.dimen.min_hotseat_icon_space);
+ mMinHotseatQsbWidthPx = res.getDimensionPixelSize(R.dimen.min_hotseat_qsb_width);
+ mMaxHotseatIconSpacePx = areNavButtonsInline
? res.getDimensionPixelSize(R.dimen.max_hotseat_icon_space) : Integer.MAX_VALUE;
// Hotseat and QSB width depends on updated cellSize and workspace padding
recalculateHotseatWidthAndBorderSpace();
@@ -661,39 +662,39 @@
}
// The side space with inline buttons should be what is defined in InvariantDeviceProfile
- int sideSpace = inlineNavButtonsEndSpacing;
- int maxHotseatWidth = availableWidthPx - sideSpace - hotseatBarEndOffset;
- int maxHotseatIconsWidth = maxHotseatWidth - (isQsbInline ? hotseatQsbWidth : 0);
- hotseatBorderSpace = calculateHotseatBorderSpace(maxHotseatIconsWidth,
+ int sideSpacePx = mInlineNavButtonsEndSpacingPx;
+ int maxHotseatWidthPx = availableWidthPx - sideSpacePx - hotseatBarEndOffset;
+ int maxHotseatIconsWidthPx = maxHotseatWidthPx - (isQsbInline ? hotseatQsbWidth : 0);
+ hotseatBorderSpace = calculateHotseatBorderSpace(maxHotseatIconsWidthPx,
(isQsbInline ? 1 : 0) + /* border between nav buttons and first icon */ 1);
- if (hotseatBorderSpace >= minHotseatIconSpacePx) {
+ if (hotseatBorderSpace >= mMinHotseatIconSpacePx) {
return;
}
// Border space can't be less than the minimum
- hotseatBorderSpace = minHotseatIconSpacePx;
+ hotseatBorderSpace = mMinHotseatIconSpacePx;
int requiredWidth = getHotseatRequiredWidth();
// If there is an inline qsb, change its size
if (isQsbInline) {
- hotseatQsbWidth -= requiredWidth - maxHotseatWidth;
- if (hotseatQsbWidth >= minHotseatQsbWidthPx) {
+ hotseatQsbWidth -= requiredWidth - maxHotseatWidthPx;
+ if (hotseatQsbWidth >= mMinHotseatQsbWidthPx) {
return;
}
// QSB can't be less than the minimum
- hotseatQsbWidth = minHotseatQsbWidthPx;
+ hotseatQsbWidth = mMinHotseatQsbWidthPx;
}
- maxHotseatIconsWidth = maxHotseatWidth - (isQsbInline ? hotseatQsbWidth : 0);
+ maxHotseatIconsWidthPx = maxHotseatWidthPx - (isQsbInline ? hotseatQsbWidth : 0);
// If it still doesn't fit, start removing icons
do {
numShownHotseatIcons--;
- hotseatBorderSpace = calculateHotseatBorderSpace(maxHotseatIconsWidth,
+ hotseatBorderSpace = calculateHotseatBorderSpace(maxHotseatIconsWidthPx,
(isQsbInline ? 1 : 0) + /* border between nav buttons and first icon */ 1);
- } while (hotseatBorderSpace < minHotseatIconSpacePx && numShownHotseatIcons > 1);
+ } while (hotseatBorderSpace < mMinHotseatIconSpacePx && numShownHotseatIcons > 1);
}
@@ -993,10 +994,10 @@
*/
private int calculateHotseatBorderSpace(float hotseatWidthPx, int numExtraBorder) {
float hotseatIconsTotalPx = iconSizePx * numShownHotseatIcons;
- int hotseatBorderSpace =
+ int hotseatBorderSpacePx =
(int) (hotseatWidthPx - hotseatIconsTotalPx)
/ (numShownHotseatIcons - 1 + numExtraBorder);
- return Math.min(hotseatBorderSpace, maxHotseatIconSpacePx);
+ return Math.min(hotseatBorderSpacePx, mMaxHotseatIconSpacePx);
}
@@ -1319,7 +1320,7 @@
int endSpacing;
// Hotseat aligns to the left with nav buttons
if (hotseatBarEndOffset > 0) {
- startSpacing = inlineNavButtonsEndSpacing;
+ startSpacing = mInlineNavButtonsEndSpacingPx;
endSpacing = availableWidthPx - hotseatWidth - startSpacing + hotseatBorderSpace;
} else {
startSpacing = (availableWidthPx - hotseatWidth) / 2;
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index 81fbe79..b8d13ed 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -226,6 +226,20 @@
}
/**
+ * Returns whether taskbar global drag is disallowed in this state.
+ */
+ public boolean disallowTaskbarGlobalDrag() {
+ return false;
+ }
+
+ /**
+ * Returns whether the taskbar shortcut should trigger split selection mode.
+ */
+ public boolean allowTaskbarInitialSplitSelection() {
+ return false;
+ }
+
+ /**
* Fraction shift in the vertical translation UI and related properties
*
* @see com.android.launcher3.allapps.AllAppsTransitionController
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index b32ff3c..67bc7fc 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -38,6 +38,7 @@
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Point;
+import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.AdaptiveIconDrawable;
@@ -343,6 +344,21 @@
}
/**
+ * Sets the x and y pivots for scaling from one Rect to another.
+ *
+ * @param src the source rectangle to scale from.
+ * @param dst the destination rectangle to scale to.
+ * @param outPivot the pivots set for scaling from src to dst.
+ */
+ public static void getPivotsForScalingRectToRect(Rect src, Rect dst, PointF outPivot) {
+ float pivotXPct = ((float) src.left - dst.left) / ((float) dst.width() - src.width());
+ outPivot.x = dst.left + dst.width() * pivotXPct;
+
+ float pivotYPct = ((float) src.top - dst.top) / ((float) dst.height() - src.height());
+ outPivot.y = dst.top + dst.height() * pivotYPct;
+ }
+
+ /**
* Maps t from one range to another range.
* @param t The value to map.
* @param fromMin The lower bound of the range that t is being mapped from.
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 92c017c..4430a94 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -200,6 +200,7 @@
? FLAG_DARK_NAV : FLAG_LIGHT_NAV;
setShiftRange(dp.allAppsShiftRange);
+ mAllAppScale.value = 1;
mLauncher.addOnDeviceProfileChangeListener(this);
mVibratorWrapper = VibratorWrapper.INSTANCE.get(mLauncher.getApplicationContext());
}
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index c89a461..0ec036c 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -355,6 +355,9 @@
public static final BooleanFlag ENABLE_ICON_IN_TEXT_HEADER = getDebugFlag(
"ENABLE_ICON_IN_TEXT_HEADER", false, "Show icon in textheader");
+ public static final BooleanFlag ENABLE_APP_ICON_FOR_INLINE_SHORTCUTS = getDebugFlag(
+ "ENABLE_APP_ICON_IN_INLINE_SHORTCUTS", false, "Show app icon for inline shortcut");
+
public static final BooleanFlag SHOW_DOT_PAGINATION = getDebugFlag(
"SHOW_DOT_PAGINATION", false, "Enable showing dot pagination in workspace");