Initial commit of new split screen work.

TODO:
* Extract out common elements in TaskShortcutFactory.MultiWindowFactory
for commonalities between new and old way of
invoking split screen
* Integrate with WM APIs (b/182002789)
* Write tests for SplitSelectStateController

Bug: 181704764

Change-Id: Ice35adb4ea82897f5e2433dc9b93a549f3d511b5
This commit is contained in:
Vinit Nayak committed 2021-03-15 15:42:32 -07:00
1 parent 510fc67c55
commit d987a828e8
34 files changed
+997 -26

No files matched your search

@@ -28,6 +28,7 @@ import static android.view.Surface.ROTATION_90;
import static android.widget.Toast.LENGTH_SHORT;
import static com.android.launcher3.QuickstepTransitionManager.RECENTS_LAUNCH_DURATION;
import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT;
import static com.android.launcher3.Utilities.comp;
import static com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor;
import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL;
@@ -84,6 +85,7 @@ import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.util.ActivityOptionsWrapper;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.RunnableList;
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
import com.android.launcher3.util.TransformingTouchDelegate;
import com.android.launcher3.util.ViewPool.Reusable;
import com.android.quickstep.RecentsModel;
@@ -345,7 +347,12 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
});
anim.start();
} else {
launchTaskAnimated();
if (mActivity.isInState(OVERVIEW_SPLIT_SELECT)) {
// User tapped to select second split screen app
getRecentsView().confirmSplitSelect(this);
} else {
launchTaskAnimated();
}
}
mActivity.getStatsLogManager().logger().withItemInfo(getItemInfo())
.log(LAUNCHER_TASK_LAUNCH_TAP);
@@ -591,6 +598,11 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
}
private boolean showTaskMenu() {
if (getRecentsView().mActivity.isInState(OVERVIEW_SPLIT_SELECT)) {
// Don't show menu when selecting second split screen app
return true;
}
if (!getRecentsView().isClearAllHidden()) {
getRecentsView().snapToPage(getRecentsView().indexOfChild(this));
} else {
@@ -619,6 +631,10 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
}
}
public int getThumbnailTopMargin() {
return (int) getResources().getDimension(R.dimen.task_thumbnail_top_margin);
}
public void setOrientationState(RecentsOrientedState orientationState) {
PagedOrientationHandler orientationHandler = orientationState.getOrientationHandler();
boolean isRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
@@ -998,12 +1014,12 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
return Utilities.mapRange(progress, 0, endTranslation);
}
public FloatProperty<TaskView> getFillDismissGapTranslationProperty() {
public FloatProperty<TaskView> getPrimaryDismissTranslationProperty() {
return getPagedOrientationHandler().getPrimaryValue(
DISMISS_TRANSLATION_X, DISMISS_TRANSLATION_Y);
}
public FloatProperty<TaskView> getDismissTaskTranslationProperty() {
public FloatProperty<TaskView> getSecondaryDissmissTranslationProperty() {
return getPagedOrientationHandler().getSecondaryValue(
DISMISS_TRANSLATION_X, DISMISS_TRANSLATION_Y);
}
@@ -1081,7 +1097,8 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
getContext().getText(R.string.accessibility_close)));
final Context context = getContext();
for (SystemShortcut s : TaskOverlayFactory.getEnabledShortcuts(this)) {
for (SystemShortcut s : TaskOverlayFactory.getEnabledShortcuts(this,
mActivity.getDeviceProfile())) {
info.addAction(s.createAccessibilityAction(context));
}
@@ -1113,7 +1130,8 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
return true;
}
for (SystemShortcut s : TaskOverlayFactory.getEnabledShortcuts(this)) {
for (SystemShortcut s : TaskOverlayFactory.getEnabledShortcuts(this,
mActivity.getDeviceProfile())) {
if (s.hasHandlerForAction(action)) {
s.onClick(this);
return true;
@@ -1274,6 +1292,12 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
mSnapshotView.setOverlayEnabled(overlayEnabled);
}
public void initiateSplitSelect(SplitPositionOption splitPositionOption) {
RecentsView rv = getRecentsView();
getMenuView().close(false);
rv.initiateSplitSelect(this, splitPositionOption);
}
/**
* We update and subsequently draw these in {@link #setFullscreenProgress(float)}.
*/