Merge "Shows AppPairs in previous tasks" into sc-v2-dev am: 524d6b83e9
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/16134803 Change-Id: I244d0877336d28d6d76a5c45c78811bfc662755b
This commit is contained in:
@@ -1809,13 +1809,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||
mGestureState.updateLastStartedTaskId(taskId);
|
||||
boolean hasTaskPreviouslyAppeared = mGestureState.getPreviouslyAppearedTaskIds()
|
||||
.contains(taskId);
|
||||
boolean isOldTaskSplit = LauncherSplitScreenListener.INSTANCE.getNoCreate()
|
||||
.getRunningSplitTaskIds().length > 0;
|
||||
nextTask.launchTask(success -> {
|
||||
resultCallback.accept(success);
|
||||
if (isOldTaskSplit) {
|
||||
SystemUiProxy.INSTANCE.getNoCreate().exitSplitScreen(taskId);
|
||||
}
|
||||
if (success) {
|
||||
if (hasTaskPreviouslyAppeared) {
|
||||
onRestartPreviouslyAppearedTask();
|
||||
|
||||
@@ -27,12 +27,14 @@ import android.util.SparseBooleanArray;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.quickstep.util.GroupTask;
|
||||
import com.android.launcher3.util.LooperExecutor;
|
||||
import com.android.systemui.shared.recents.model.GroupTask;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
import com.android.systemui.shared.system.KeyguardManagerCompat;
|
||||
import com.android.wm.shell.recents.IRecentTasksListener;
|
||||
import com.android.wm.shell.util.GroupedRecentTaskInfo;
|
||||
import com.android.wm.shell.util.StagedSplitBounds;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -192,12 +194,23 @@ public class RecentTasksList {
|
||||
tmpLockedUsers.get(task2Key.userId) /* isLocked */);
|
||||
task2.setLastSnapshotData(taskInfo2);
|
||||
}
|
||||
allTasks.add(new GroupTask(task1, task2));
|
||||
final SplitConfigurationOptions.StagedSplitBounds launcherSplitBounds =
|
||||
convertSplitBounds(rawTask.mStagedSplitBounds);
|
||||
allTasks.add(new GroupTask(task1, task2, launcherSplitBounds));
|
||||
}
|
||||
|
||||
return allTasks;
|
||||
}
|
||||
|
||||
private SplitConfigurationOptions.StagedSplitBounds convertSplitBounds(
|
||||
StagedSplitBounds shellSplitBounds) {
|
||||
return shellSplitBounds == null ?
|
||||
null :
|
||||
new SplitConfigurationOptions.StagedSplitBounds(
|
||||
shellSplitBounds.leftTopBounds, shellSplitBounds.rightBottomBounds,
|
||||
shellSplitBounds.leftTopTaskId, shellSplitBounds.rightBottomTaskId);
|
||||
}
|
||||
|
||||
private ArrayList<GroupTask> copyOf(ArrayList<GroupTask> tasks) {
|
||||
ArrayList<GroupTask> newTasks = new ArrayList<>();
|
||||
for (int i = 0; i < tasks.size(); i++) {
|
||||
|
||||
@@ -34,7 +34,7 @@ import com.android.launcher3.icons.IconProvider;
|
||||
import com.android.launcher3.icons.IconProvider.IconChangeListener;
|
||||
import com.android.launcher3.util.Executors.SimpleThreadFactory;
|
||||
import com.android.launcher3.util.MainThreadInitializedObject;
|
||||
import com.android.systemui.shared.recents.model.GroupTask;
|
||||
import com.android.quickstep.util.GroupTask;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
|
||||
@@ -20,7 +20,7 @@ import android.content.Context;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.util.SplitConfigurationOptions;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.StagedSplitBounds;
|
||||
import com.android.quickstep.util.AnimatorControllerWithResistance;
|
||||
import com.android.quickstep.util.LauncherSplitScreenListener;
|
||||
import com.android.quickstep.util.TaskViewSimulator;
|
||||
@@ -33,7 +33,7 @@ import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
*/
|
||||
public class RemoteTargetGluer {
|
||||
private RemoteTargetHandle[] mRemoteTargetHandles;
|
||||
private SplitConfigurationOptions.StagedSplitBounds mStagedSplitBounds;
|
||||
private StagedSplitBounds mStagedSplitBounds;
|
||||
|
||||
/**
|
||||
* Use this constructor if remote targets are split-screen independent
|
||||
@@ -108,9 +108,9 @@ public class RemoteTargetGluer {
|
||||
primaryTaskTarget = targets.findTask(splitIds[0]);
|
||||
secondaryTaskTarget = targets.findTask(splitIds[1]);
|
||||
|
||||
mStagedSplitBounds = new SplitConfigurationOptions.StagedSplitBounds(
|
||||
mStagedSplitBounds = new StagedSplitBounds(
|
||||
primaryTaskTarget.screenSpaceBounds,
|
||||
secondaryTaskTarget.screenSpaceBounds);
|
||||
secondaryTaskTarget.screenSpaceBounds, splitIds[0], splitIds[1]);
|
||||
mRemoteTargetHandles[0].mTransformParams.setTargetSet(
|
||||
createRemoteAnimationTargetsForTarget(primaryTaskTarget, targets));
|
||||
mRemoteTargetHandles[0].mTaskViewSimulator.setPreview(primaryTaskTarget,
|
||||
@@ -135,7 +135,7 @@ public class RemoteTargetGluer {
|
||||
return mRemoteTargetHandles;
|
||||
}
|
||||
|
||||
public SplitConfigurationOptions.StagedSplitBounds getStagedSplitBounds() {
|
||||
public StagedSplitBounds getStagedSplitBounds() {
|
||||
return mStagedSplitBounds;
|
||||
}
|
||||
|
||||
|
||||
@@ -572,53 +572,6 @@ public class SystemUiProxy implements ISystemUiProxy,
|
||||
mPendingSplitScreenListener = null;
|
||||
}
|
||||
|
||||
public void setSideStageVisibility(boolean visible) {
|
||||
if (mSplitScreen != null) {
|
||||
try {
|
||||
mSplitScreen.setSideStageVisibility(visible);
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed call setSideStageVisibility");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To be called whenever the user exits out of split screen apps (either by launching another
|
||||
* app or by swiping home)
|
||||
* @param topTaskId The taskId of the new app that was launched. System will then move this task
|
||||
* to the front of what the user sees while removing all other split stages.
|
||||
* If swiping to home (or there is no task to put at the top), can pass in -1.
|
||||
*/
|
||||
public void exitSplitScreen(int topTaskId) {
|
||||
if (mSplitScreen != null) {
|
||||
try {
|
||||
mSplitScreen.exitSplitScreen(topTaskId);
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed call exitSplitScreen");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void exitSplitScreenOnHide(boolean exitSplitScreenOnHide) {
|
||||
if (mSplitScreen != null) {
|
||||
try {
|
||||
mSplitScreen.exitSplitScreenOnHide(exitSplitScreenOnHide);
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed call exitSplitScreen");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void startTask(int taskId, int stage, int position, Bundle options) {
|
||||
if (mSplitScreen != null) {
|
||||
try {
|
||||
mSplitScreen.startTask(taskId, stage, position, options);
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed call startTask");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Start multiple tasks in split-screen simultaneously. */
|
||||
public void startTasks(int mainTaskId, Bundle mainOptions, int sideTaskId, Bundle sideOptions,
|
||||
@SplitConfigurationOptions.StagePosition int sidePosition,
|
||||
|
||||
@@ -42,7 +42,7 @@ import com.android.quickstep.util.TaskViewSimulator;
|
||||
import com.android.quickstep.views.OverviewActionsView;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
import com.android.quickstep.views.TaskView;
|
||||
import com.android.systemui.shared.recents.model.GroupTask;
|
||||
import com.android.quickstep.util.GroupTask;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
import com.android.systemui.shared.recents.model.Task.TaskKey;
|
||||
|
||||
@@ -175,7 +175,7 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity, RecentsSta
|
||||
newList.addAll(taskGroups);
|
||||
newList.add(new GroupTask(
|
||||
Task.from(new TaskKey(mHomeTaskInfo), mHomeTaskInfo, false),
|
||||
null));
|
||||
null, null));
|
||||
taskGroups = newList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.util;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.StagedSplitBounds;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
|
||||
/**
|
||||
* A {@link Task} container that can contain one or two tasks, depending on if the two tasks
|
||||
* are represented as an app-pair in the recents task list.
|
||||
*/
|
||||
public class GroupTask {
|
||||
public @NonNull Task task1;
|
||||
public @Nullable Task task2;
|
||||
public @Nullable StagedSplitBounds mStagedSplitBounds;
|
||||
|
||||
public GroupTask(@NonNull Task t1, @Nullable Task t2,
|
||||
@Nullable StagedSplitBounds stagedSplitBounds) {
|
||||
task1 = t1;
|
||||
task2 = t2;
|
||||
mStagedSplitBounds = stagedSplitBounds;
|
||||
}
|
||||
|
||||
public GroupTask(@NonNull GroupTask group) {
|
||||
task1 = new Task(group.task1);
|
||||
task2 = group.task2 != null
|
||||
? new Task(group.task2)
|
||||
: null;
|
||||
mStagedSplitBounds = group.mStagedSplitBounds;
|
||||
}
|
||||
|
||||
public boolean containsTask(int taskId) {
|
||||
return task1.key.id == taskId || (task2 != null && task2.key.id == taskId);
|
||||
}
|
||||
|
||||
public boolean hasMultipleTasks() {
|
||||
return task2 != null;
|
||||
}
|
||||
}
|
||||
@@ -149,7 +149,6 @@ public class LauncherSplitScreenListener extends ISplitScreenListener.Stub {
|
||||
return;
|
||||
}
|
||||
|
||||
SystemUiProxy.INSTANCE.getNoCreate().exitSplitScreen(-1);
|
||||
mPersistentGroupedIds = EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITIO
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_UNDEFINED;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.StagePosition;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.StagedSplitBounds;
|
||||
import static com.android.quickstep.util.RecentsOrientedState.postDisplayRotation;
|
||||
import static com.android.quickstep.util.RecentsOrientedState.preDisplayRotation;
|
||||
import static com.android.systemui.shared.system.WindowManagerWrapper.WINDOWING_MODE_FULLSCREEN;
|
||||
@@ -41,6 +40,7 @@ import androidx.annotation.NonNull;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.StagedSplitBounds;
|
||||
import com.android.launcher3.util.TraceHelper;
|
||||
import com.android.quickstep.AnimatedFloat;
|
||||
import com.android.quickstep.BaseActivityInterface;
|
||||
|
||||
@@ -14,6 +14,7 @@ import androidx.annotation.Nullable;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.util.RunnableList;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.StagedSplitBounds;
|
||||
import com.android.launcher3.util.TransformingTouchDelegate;
|
||||
import com.android.quickstep.RecentsModel;
|
||||
|
||||
@@ -137,8 +137,8 @@ import com.android.launcher3.util.IntSet;
|
||||
import com.android.launcher3.util.MultiValueAlpha;
|
||||
import com.android.launcher3.util.ResourceBasedOverride.Overrides;
|
||||
import com.android.launcher3.util.RunnableList;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.StagePosition;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.StagedSplitBounds;
|
||||
import com.android.launcher3.util.Themes;
|
||||
import com.android.launcher3.util.TranslateEdgeEffect;
|
||||
import com.android.launcher3.util.ViewPool;
|
||||
@@ -157,7 +157,6 @@ import com.android.quickstep.TaskOverlayFactory;
|
||||
import com.android.quickstep.TaskThumbnailCache;
|
||||
import com.android.quickstep.TaskViewUtils;
|
||||
import com.android.quickstep.ViewUtils;
|
||||
import com.android.quickstep.util.LauncherSplitScreenListener;
|
||||
import com.android.quickstep.util.LayoutUtils;
|
||||
import com.android.quickstep.util.RecentsOrientedState;
|
||||
import com.android.quickstep.util.SplitScreenBounds;
|
||||
@@ -167,7 +166,7 @@ import com.android.quickstep.util.TaskViewSimulator;
|
||||
import com.android.quickstep.util.TransformParams;
|
||||
import com.android.quickstep.util.VibratorWrapper;
|
||||
import com.android.systemui.plugins.ResourceProvider;
|
||||
import com.android.systemui.shared.recents.model.GroupTask;
|
||||
import com.android.quickstep.util.GroupTask;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
import com.android.systemui.shared.recents.model.Task.TaskKey;
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
@@ -599,7 +598,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
*/
|
||||
private TaskView mSplitHiddenTaskView;
|
||||
private TaskView mSecondSplitHiddenTaskView;
|
||||
private SplitConfigurationOptions.StagedSplitBounds mSplitBoundsConfig;
|
||||
private StagedSplitBounds mSplitBoundsConfig;
|
||||
private final Toast mSplitToast = Toast.makeText(getContext(),
|
||||
R.string.toast_split_select_app, Toast.LENGTH_SHORT);
|
||||
private final Toast mSplitUnsupportedToast = Toast.makeText(getContext(),
|
||||
@@ -665,9 +664,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
mClearAllButton.setOnClickListener(this::dismissAllTasks);
|
||||
mTaskViewPool = new ViewPool<>(context, this, R.layout.task, 20 /* max size */,
|
||||
10 /* initial size */);
|
||||
// There's only one pair of grouped tasks we can envision at the moment
|
||||
mGroupedTaskViewPool = new ViewPool<>(context, this,
|
||||
R.layout.task_grouped, 2 /* max size */, 1 /* initial size */);
|
||||
R.layout.task_grouped, 20 /* max size */, 10 /* initial size */);
|
||||
|
||||
mIsRtl = mOrientationHandler.getRecentsRtlSetting(getResources());
|
||||
setLayoutDirection(mIsRtl ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR);
|
||||
@@ -1071,6 +1069,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
}
|
||||
|
||||
public TaskView getTaskViewByTaskId(int taskId) {
|
||||
if (taskId == -1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (int i = 0; i < getTaskViewCount(); i++) {
|
||||
TaskView taskView = getTaskViewAt(i);
|
||||
int[] taskIds = taskView.getTaskIds();
|
||||
@@ -1323,72 +1325,34 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
TaskView ignoreResetTaskView =
|
||||
mIgnoreResetTaskId == -1 ? null : getTaskViewByTaskId(mIgnoreResetTaskId);
|
||||
|
||||
int[] splitTaskIds =
|
||||
LauncherSplitScreenListener.INSTANCE.getNoCreate().getPersistentSplitIds();
|
||||
int requiredGroupTaskViews = splitTaskIds.length / 2;
|
||||
|
||||
// TODO(b/202740477): Update once grouped tasks are returned
|
||||
// Subtract half the number of split tasks and not total number because we've already
|
||||
// added a GroupedTaskView when swipe up gesture happens.
|
||||
// This will need to change if we start showing GroupedTaskViews during swipe up from home
|
||||
int requiredTaskViewCount = taskGroups.size() - requiredGroupTaskViews;
|
||||
|
||||
if (getTaskViewCount() != requiredTaskViewCount) {
|
||||
if (indexOfChild(mClearAllButton) != -1) {
|
||||
removeView(mClearAllButton);
|
||||
}
|
||||
|
||||
for (int i = getTaskViewCount(); i < requiredTaskViewCount; i++) {
|
||||
addView(getTaskViewFromPool(false));
|
||||
}
|
||||
while (getTaskViewCount() > requiredTaskViewCount) {
|
||||
removeView(getChildAt(getChildCount() - 1));
|
||||
}
|
||||
int groupedTaskViewCount = getGroupedTaskViewCount();
|
||||
while (requiredGroupTaskViews > groupedTaskViewCount) {
|
||||
// Add to front of list
|
||||
addView(getTaskViewFromPool(true), 0);
|
||||
requiredGroupTaskViews--;
|
||||
}
|
||||
if (requiredTaskViewCount > 0) {
|
||||
addView(mClearAllButton);
|
||||
}
|
||||
}
|
||||
|
||||
// Save running task ID if it exists before rebinding all taskViews, otherwise the task from
|
||||
// the runningTaskView currently bound could get assigned to another TaskView
|
||||
// TODO set these type to array and check all taskIDs? Maybe we can get away w/ only one
|
||||
int runningTaskId = getTaskIdsForTaskViewId(mRunningTaskViewId)[0];
|
||||
int focusedTaskId = getTaskIdsForTaskViewId(mFocusedTaskViewId)[0];
|
||||
Log.d(TASK_VIEW_ID_CRASH, "runningTaskId beforeBind: " + runningTaskId
|
||||
+ " runningTaskViewId: " + mRunningTaskViewId
|
||||
+ " forTaskView: " + getTaskViewFromTaskViewId(mRunningTaskViewId));
|
||||
|
||||
for (int taskViewIndex = requiredTaskViewCount - 1, taskDataIndex = taskGroups.size() - 1;
|
||||
taskViewIndex >= 0;
|
||||
taskViewIndex--, taskDataIndex--) {
|
||||
final int pageIndex = requiredTaskViewCount - taskViewIndex - 1;
|
||||
// TODO(b/202740477): Temporary assumption, to be updated once groups are actually used
|
||||
final Task task = taskGroups.get(taskDataIndex).task1;
|
||||
final TaskView taskView = (TaskView) getChildAt(pageIndex);
|
||||
if (taskView instanceof GroupedTaskView) {
|
||||
Task leftTop;
|
||||
Task rightBottom;
|
||||
if (task.key.id == splitTaskIds[0]) {
|
||||
leftTop = task;
|
||||
taskDataIndex--;
|
||||
rightBottom = taskGroups.get(taskDataIndex).task1;
|
||||
} else {
|
||||
rightBottom = task;
|
||||
taskDataIndex--;
|
||||
leftTop = taskGroups.get(taskDataIndex).task1;
|
||||
}
|
||||
((GroupedTaskView) taskView).bind(leftTop, rightBottom, mOrientationState,
|
||||
mSplitBoundsConfig);
|
||||
// Removing views sets the currentPage to 0, so we save this and restore it after
|
||||
// the new set of views are added
|
||||
int previousPage = mCurrentPage;
|
||||
removeAllViews();
|
||||
|
||||
// Add views as children based on whether it's grouped or single task
|
||||
for (int i = taskGroups.size() - 1; i >= 0; i--) {
|
||||
GroupTask groupTask = taskGroups.get(i);
|
||||
boolean hasMultipleTasks = groupTask.hasMultipleTasks();
|
||||
TaskView taskView = getTaskViewFromPool(hasMultipleTasks);
|
||||
addView(taskView);
|
||||
|
||||
if (hasMultipleTasks) {
|
||||
((GroupedTaskView) taskView).bind(groupTask.task1, groupTask.task2,
|
||||
mOrientationState, groupTask.mStagedSplitBounds);
|
||||
} else {
|
||||
taskView.bind(task, mOrientationState);
|
||||
taskView.bind(groupTask.task1, mOrientationState);
|
||||
}
|
||||
}
|
||||
if (!taskGroups.isEmpty()) {
|
||||
addView(mClearAllButton);
|
||||
}
|
||||
setCurrentPage(previousPage);
|
||||
|
||||
// Keep same previous focused task
|
||||
TaskView newFocusedTaskView = getTaskViewByTaskId(focusedTaskId);
|
||||
@@ -1406,21 +1370,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
// Update mRunningTaskViewId to be the new TaskView that was assigned by binding
|
||||
// the full list of tasks to taskViews
|
||||
newRunningTaskView = getTaskViewByTaskId(runningTaskId);
|
||||
if (newRunningTaskView == null) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = requiredTaskViewCount - 1; i >= 0; i--) {
|
||||
final int pageIndex = requiredTaskViewCount - i - 1;
|
||||
final TaskView taskView = (TaskView) getChildAt(pageIndex);
|
||||
int taskViewId = taskView.getTaskViewId();
|
||||
sb.append(" taskViewId: " + taskViewId
|
||||
+ " taskId: " + getTaskIdsForTaskViewId(taskViewId)[0]
|
||||
+ " for taskView: " + taskView + "\n");
|
||||
}
|
||||
Log.d(TASK_VIEW_ID_CRASH, "taskViewCount: " + getTaskViewCount()
|
||||
+ " " + sb.toString());
|
||||
mRunningTaskViewId = -1;
|
||||
} else {
|
||||
if (newRunningTaskView != null) {
|
||||
mRunningTaskViewId = newRunningTaskView.getTaskViewId();
|
||||
} else {
|
||||
mRunningTaskViewId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -690,13 +690,8 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
TestProtocol.SEQUENCE_MAIN, "startActivityFromRecentsAsync", mTask);
|
||||
ActivityOptionsWrapper opts = mActivity.getActivityLaunchOptions(this, null);
|
||||
opts.options.setLaunchDisplayId(getRootViewDisplayId());
|
||||
boolean isOldTaskSplit = LauncherSplitScreenListener.INSTANCE.getNoCreate()
|
||||
.getPersistentSplitIds().length > 0;
|
||||
if (ActivityManagerWrapper.getInstance()
|
||||
.startActivityFromRecents(mTask.key, opts.options)) {
|
||||
if (isOldTaskSplit) {
|
||||
SystemUiProxy.INSTANCE.getNoCreate().exitSplitScreen(mTask.key.id);
|
||||
}
|
||||
RecentsView recentsView = getRecentsView();
|
||||
if (ENABLE_QUICKSTEP_LIVE_TILE.get() && recentsView.getRunningTaskViewId() != -1) {
|
||||
recentsView.onTaskLaunchedInLiveTileMode();
|
||||
|
||||
@@ -30,9 +30,7 @@ import android.app.ActivityManager;
|
||||
import androidx.test.filters.SmallTest;
|
||||
|
||||
import com.android.launcher3.util.LooperExecutor;
|
||||
import com.android.systemui.shared.recents.model.GroupTask;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
import com.android.quickstep.util.GroupTask;
|
||||
import com.android.systemui.shared.system.KeyguardManagerCompat;
|
||||
import com.android.wm.shell.util.GroupedRecentTaskInfo;
|
||||
|
||||
@@ -73,7 +71,7 @@ public class RecentTasksListTest {
|
||||
@Test
|
||||
public void loadTasksInBackground_onlyKeys_noValidTaskDescription() {
|
||||
GroupedRecentTaskInfo recentTaskInfos = new GroupedRecentTaskInfo(
|
||||
new ActivityManager.RecentTaskInfo(), new ActivityManager.RecentTaskInfo());
|
||||
new ActivityManager.RecentTaskInfo(), new ActivityManager.RecentTaskInfo(), null);
|
||||
when(mockSystemUiProxy.getRecentTasks(anyInt(), anyInt()))
|
||||
.thenReturn(new ArrayList<>(Collections.singletonList(recentTaskInfos)));
|
||||
|
||||
@@ -93,7 +91,7 @@ public class RecentTasksListTest {
|
||||
ActivityManager.RecentTaskInfo task2 = new ActivityManager.RecentTaskInfo();
|
||||
task2.taskDescription = new ActivityManager.TaskDescription();
|
||||
GroupedRecentTaskInfo recentTaskInfos = new GroupedRecentTaskInfo(
|
||||
task1, task2);
|
||||
task1, task2, null);
|
||||
when(mockSystemUiProxy.getRecentTasks(anyInt(), anyInt()))
|
||||
.thenReturn(new ArrayList<>(Collections.singletonList(recentTaskInfos)));
|
||||
|
||||
|
||||
@@ -390,7 +390,7 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
||||
@Override
|
||||
public void measureGroupedTaskViewThumbnailBounds(View primarySnapshot, View secondarySnapshot,
|
||||
int parentWidth, int parentHeight,
|
||||
SplitConfigurationOptions.StagedSplitBounds splitBoundsConfig, DeviceProfile dp) {
|
||||
StagedSplitBounds splitBoundsConfig, DeviceProfile dp) {
|
||||
int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx;
|
||||
int totalThumbnailHeight = parentHeight - spaceAboveSnapshot;
|
||||
int dividerBar = splitBoundsConfig.visualDividerBounds.width();
|
||||
@@ -435,15 +435,18 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
||||
(FrameLayout.LayoutParams) primaryIconView.getLayoutParams();
|
||||
FrameLayout.LayoutParams secondaryIconParams =
|
||||
new FrameLayout.LayoutParams(primaryIconParams);
|
||||
int dividerBar = (splitConfig.appsStackedVertically ?
|
||||
splitConfig.visualDividerBounds.height() :
|
||||
splitConfig.visualDividerBounds.width());
|
||||
|
||||
int primaryHeight = primarySnapshotBounds.height();
|
||||
int secondaryHeight = secondarySnapshotBounds.height();
|
||||
primaryIconParams.gravity = (isRtl ? START : END) | TOP;
|
||||
primaryIconView.setTranslationY((primaryHeight + taskIconHeight) / 2f );
|
||||
primaryIconView.setTranslationY(primaryHeight - primaryIconView.getHeight() / 2f);
|
||||
primaryIconView.setTranslationX(0);
|
||||
|
||||
secondaryIconParams.gravity = (isRtl ? START : END) | TOP;
|
||||
secondaryIconView.setTranslationY(primaryHeight
|
||||
+ ((secondaryHeight + taskIconHeight) / 2f));
|
||||
secondaryIconView.setTranslationY(primaryHeight + taskIconHeight + dividerBar);
|
||||
secondaryIconView.setTranslationX(0);
|
||||
primaryIconView.setLayoutParams(primaryIconParams);
|
||||
secondaryIconView.setLayoutParams(secondaryIconParams);
|
||||
}
|
||||
|
||||
@@ -141,13 +141,12 @@ public interface PagedOrientationHandler {
|
||||
* @param desiredStagePosition Which stage position (topLeft/rightBottom) we want to resize
|
||||
* outRect for
|
||||
*/
|
||||
void setSplitTaskSwipeRect(DeviceProfile dp, Rect outRect,
|
||||
StagedSplitBounds splitInfo,
|
||||
void setSplitTaskSwipeRect(DeviceProfile dp, Rect outRect, StagedSplitBounds splitInfo,
|
||||
@SplitConfigurationOptions.StagePosition int desiredStagePosition);
|
||||
|
||||
void measureGroupedTaskViewThumbnailBounds(View primarySnapshot, View secondarySnapshot,
|
||||
int parentWidth, int parentHeight,
|
||||
SplitConfigurationOptions.StagedSplitBounds splitBoundsConfig, DeviceProfile dp);
|
||||
StagedSplitBounds splitBoundsConfig, DeviceProfile dp);
|
||||
|
||||
// Overview TaskMenuView methods
|
||||
void setIconAndSnapshotParams(View iconView, int taskIconMargin, int taskIconHeight,
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.launcher3.touch;
|
||||
|
||||
import static android.view.Gravity.BOTTOM;
|
||||
import static android.view.Gravity.CENTER_HORIZONTAL;
|
||||
import static android.view.Gravity.START;
|
||||
import static android.view.Gravity.TOP;
|
||||
@@ -477,7 +476,7 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
@Override
|
||||
public void measureGroupedTaskViewThumbnailBounds(View primarySnapshot, View secondarySnapshot,
|
||||
int parentWidth, int parentHeight,
|
||||
SplitConfigurationOptions.StagedSplitBounds splitBoundsConfig, DeviceProfile dp) {
|
||||
StagedSplitBounds splitBoundsConfig, DeviceProfile dp) {
|
||||
int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx;
|
||||
int totalThumbnailHeight = parentHeight - spaceAboveSnapshot;
|
||||
int dividerBar = (splitBoundsConfig.appsStackedVertically ?
|
||||
@@ -535,23 +534,27 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
(FrameLayout.LayoutParams) primaryIconView.getLayoutParams();
|
||||
FrameLayout.LayoutParams secondaryIconParams =
|
||||
new FrameLayout.LayoutParams(primaryIconParams);
|
||||
int dividerBar = (splitConfig.appsStackedVertically ?
|
||||
splitConfig.visualDividerBounds.height() :
|
||||
splitConfig.visualDividerBounds.width());
|
||||
|
||||
int primaryWidth = primarySnapshotBounds.width();
|
||||
if (deviceProfile.isLandscape) {
|
||||
int primaryWidth = primarySnapshotBounds.width();
|
||||
int secondaryWidth = secondarySnapshotBounds.width();
|
||||
primaryIconParams.gravity = TOP | START;
|
||||
primaryIconView.setTranslationX((primaryWidth - taskIconHeight) / 2f );
|
||||
primaryIconView.setTranslationX(primaryWidth - primaryIconView.getWidth());
|
||||
primaryIconView.setTranslationY(0);
|
||||
|
||||
secondaryIconParams.gravity = TOP | START;
|
||||
secondaryIconView.setTranslationX(primaryWidth
|
||||
+ ((secondaryWidth - taskIconHeight) / 2f));
|
||||
} else {
|
||||
primaryIconView.setTranslationX(0);
|
||||
secondaryIconView.setTranslationX(0);
|
||||
primaryIconView.setTranslationY(0);
|
||||
secondaryIconView.setTranslationX(primaryWidth + dividerBar);
|
||||
secondaryIconView.setTranslationY(0);
|
||||
} else {
|
||||
primaryIconParams.gravity = TOP | CENTER_HORIZONTAL;
|
||||
primaryIconView.setTranslationX(-(primaryIconView.getWidth()) / 2f);
|
||||
primaryIconView.setTranslationY(0);
|
||||
|
||||
secondaryIconParams.gravity = TOP | CENTER_HORIZONTAL;
|
||||
secondaryIconView.setTranslationX(secondaryIconView.getWidth() / 2f);
|
||||
secondaryIconView.setTranslationY(0);
|
||||
secondaryIconParams.gravity = BOTTOM | CENTER_HORIZONTAL;
|
||||
secondaryIconParams.bottomMargin = -(secondaryIconParams.topMargin + taskIconHeight);
|
||||
}
|
||||
primaryIconView.setLayoutParams(primaryIconParams);
|
||||
secondaryIconView.setLayoutParams(secondaryIconParams);
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.launcher3.touch;
|
||||
import static android.view.Gravity.CENTER_VERTICAL;
|
||||
import static android.view.Gravity.END;
|
||||
import static android.view.Gravity.START;
|
||||
import static android.view.Gravity.TOP;
|
||||
|
||||
import static com.android.launcher3.touch.SingleAxisSwipeDetector.HORIZONTAL;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
@@ -36,7 +37,9 @@ import android.widget.LinearLayout;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.StagedSplitBounds;
|
||||
import com.android.launcher3.views.BaseDragLayer;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -127,6 +130,23 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler {
|
||||
iconParams.topMargin = snapshotParams.topMargin / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSplitIconParams(View primaryIconView, View secondaryIconView,
|
||||
int taskIconHeight, Rect primarySnapshotBounds, Rect secondarySnapshotBounds,
|
||||
boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig) {
|
||||
super.setSplitIconParams(primaryIconView, secondaryIconView, taskIconHeight,
|
||||
primarySnapshotBounds, secondarySnapshotBounds, isRtl, deviceProfile, splitConfig);
|
||||
FrameLayout.LayoutParams primaryIconParams =
|
||||
(FrameLayout.LayoutParams) primaryIconView.getLayoutParams();
|
||||
FrameLayout.LayoutParams secondaryIconParams =
|
||||
(FrameLayout.LayoutParams) secondaryIconView.getLayoutParams();
|
||||
|
||||
primaryIconParams.gravity = (isRtl ? END : START) | TOP;
|
||||
secondaryIconParams.gravity = (isRtl ? END : START) | TOP;
|
||||
primaryIconView.setLayoutParams(primaryIconParams);
|
||||
secondaryIconView.setLayoutParams(secondaryIconParams);
|
||||
}
|
||||
|
||||
/* ---------- The following are only used by TaskViewTouchHandler. ---------- */
|
||||
|
||||
@Override
|
||||
|
||||
@@ -85,6 +85,12 @@ public final class SplitConfigurationOptions {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* NOTE: Engineers complained about too little ambiguity in the last survey, so there is a class
|
||||
* with the same name/functionality in wm.shell.util (which launcher3 cannot be built against)
|
||||
*
|
||||
* If you make changes here, consider making the same changes there
|
||||
*/
|
||||
public static class StagedSplitBounds {
|
||||
public final Rect leftTopBounds;
|
||||
public final Rect rightBottomBounds;
|
||||
@@ -100,10 +106,15 @@ public final class SplitConfigurationOptions {
|
||||
* the bounds were originally in
|
||||
*/
|
||||
public final boolean appsStackedVertically;
|
||||
public final int leftTopTaskId;
|
||||
public final int rightBottomTaskId;
|
||||
|
||||
public StagedSplitBounds(Rect leftTopBounds, Rect rightBottomBounds) {
|
||||
public StagedSplitBounds(Rect leftTopBounds, Rect rightBottomBounds, int leftTopTaskId,
|
||||
int rightBottomTaskId) {
|
||||
this.leftTopBounds = leftTopBounds;
|
||||
this.rightBottomBounds = rightBottomBounds;
|
||||
this.leftTopTaskId = leftTopTaskId;
|
||||
this.rightBottomTaskId = rightBottomTaskId;
|
||||
|
||||
if (rightBottomBounds.top > leftTopBounds.top) {
|
||||
// vertical apps, horizontal divider
|
||||
|
||||
Reference in New Issue
Block a user