Merge "Hide desktop tile when choosing apps for split" into tm-qpr-dev am: 37d6a2be10

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/21656508

Change-Id: I40adcf60f0628e8cf4e0c0d1198da7ad7ce975fd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Ats Jenk
2023-03-03 19:41:48 +00:00
committed by Automerger Merge Worker
2 changed files with 33 additions and 4 deletions

View File

@@ -381,6 +381,7 @@ public class DesktopTaskView extends TaskView {
}
setOverlayEnabled(false);
onTaskListVisibilityChanged(false);
setVisibility(VISIBLE);
}
@Override

View File

@@ -706,6 +706,12 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
private ObjectAnimator mActionsViewAlphaAnimator;
private float mActionsViewAlphaAnimatorFinalValue;
/**
* Keeps track of the desktop task. Optional and only present when the feature flag is enabled.
*/
@Nullable
private DesktopTaskView mDesktopTaskView;
private MultiWindowModeChangedListener mMultiWindowModeChangedListener =
new MultiWindowModeChangedListener() {
@Override
@@ -1586,6 +1592,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
// update the map of instance counts
mFilterState.updateInstanceCountMap(taskGroups);
// Clear out desktop view if it is set
mDesktopTaskView = null;
DesktopTask desktopTask = null;
// Add views as children based on whether it's grouped or single task. Looping through
@@ -1644,12 +1652,13 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
if (!taskGroups.isEmpty()) {
addView(mClearAllButton);
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED) {
TaskView taskView = getTaskViewFromPool(TaskView.Type.DESKTOP);
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED
&& !getSplitSelectController().isSplitSelectActive()) {
mDesktopTaskView = (DesktopTaskView) getTaskViewFromPool(TaskView.Type.DESKTOP);
// Always add a desktop task to the first position. Even if it is empty
addView(taskView, 0);
addView(mDesktopTaskView, 0);
ArrayList<Task> tasks = desktopTask != null ? desktopTask.tasks : new ArrayList<>();
((DesktopTaskView) taskView).bind(tasks, mOrientationState);
mDesktopTaskView.bind(tasks, mOrientationState);
}
}
@@ -2774,6 +2783,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
} else if (taskView.isDesktopTask()) {
// Desktop task was not focused. Pin it to the right of focused
desktopTaskIndex = i;
if (taskView.getVisibility() == View.GONE) {
// Desktop task view is hidden, skip it from grid calculations
continue;
}
if (!ENABLE_GRID_ONLY_OVERVIEW.get()) {
// Only apply x-translation when using legacy overview grid
gridTranslations[i] += mIsRtl ? taskWidthAndSpacing : -taskWidthAndSpacing;
@@ -4467,6 +4480,9 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
mSplitSelectStateController.setAnimateCurrentTaskDismissal(
true /*animateCurrentTaskDismissal*/);
mSplitHiddenTaskViewIndex = indexOfChild(taskView);
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED) {
updateDesktopTaskVisibility(false /* visible */);
}
}
/**
@@ -4483,6 +4499,15 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
mSplitSelectStateController.setInitialTaskSelect(splitSelectSource.intent,
splitSelectSource.position.stagePosition, splitSelectSource.itemInfo,
splitSelectSource.splitEvent, splitSelectSource.alreadyRunningTaskId);
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED) {
updateDesktopTaskVisibility(false /* visible */);
}
}
private void updateDesktopTaskVisibility(boolean visible) {
if (mDesktopTaskView != null) {
mDesktopTaskView.setVisibility(visible ? VISIBLE : GONE);
}
}
/**
@@ -4633,6 +4658,9 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
mSplitHiddenTaskView.setThumbnailVisibility(VISIBLE);
mSplitHiddenTaskView = null;
}
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED) {
updateDesktopTaskVisibility(true /* visible */);
}
}
private void safeRemoveDragLayerView(@Nullable View viewToRemove) {