Add split support for 3P launcher

* Copied logic mostly from
Base/RecentsViewStateController
* There's one KI crash specific to 3P
(b/209694087)
* Swipe to home animation is TODO, but
then again it also seems incorrect for
full-screen app. 3P has many cosmetic issues
throughout.

Bug: 195607777
Test: Tested w/ Nova launcher with grid
and non-grid, able to invoke split screen with
same animations as 1P launcher

Change-Id: I35a1bc92a51caccac4214289e614000cd47bb503
This commit is contained in:
Vinit Nayak committed 2021-12-09 12:52:04 -08:00
1 parent 5b2bbe7e20
commit 2a93bc5b30
9 files changed
+66 -35

No files matched your search

@@ -24,14 +24,22 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TR
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE;
import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW;
import static com.android.quickstep.fallback.RecentsState.OVERVIEW_SPLIT_SELECT;
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_HORIZONTAL_OFFSET;
import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS;
import static com.android.quickstep.views.RecentsView.RECENTS_GRID_PROGRESS;
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;
import static com.android.quickstep.views.RecentsView.TASK_MODALNESS;
import static com.android.quickstep.views.RecentsView.TASK_PRIMARY_SPLIT_TRANSLATION;
import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_SPLIT_TRANSLATION;
import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION;
import static com.android.quickstep.views.TaskView.FLAG_UPDATE_ALL;
import android.util.FloatProperty;
import android.util.Pair;
import androidx.annotation.NonNull;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.anim.PropertySetter;
import com.android.launcher3.statemanager.StateManager.StateHandler;
@@ -100,5 +108,31 @@ public class FallbackRecentsStateController implements StateHandler<RecentsState
setter.setViewBackgroundColor(mActivity.getScrimView(), state.getScrimColor(mActivity),
config.getInterpolator(ANIM_SCRIM_FADE, LINEAR));
RecentsState currentState = mActivity.getStateManager().getState();
if (isSplitSelectionState(state) && !isSplitSelectionState(currentState)) {
setter.add(mRecentsView.createSplitSelectInitAnimation().buildAnim());
}
Pair<FloatProperty, FloatProperty> taskViewsFloat =
mRecentsView.getPagedOrientationHandler().getSplitSelectTaskOffset(
TASK_PRIMARY_SPLIT_TRANSLATION, TASK_SECONDARY_SPLIT_TRANSLATION,
mActivity.getDeviceProfile());
setter.setFloat(mRecentsView, taskViewsFloat.second, 0, LINEAR);
if (isSplitSelectionState(state)) {
mRecentsView.applySplitPrimaryScrollOffset();
setter.setFloat(mRecentsView, taskViewsFloat.first,
mRecentsView.getSplitSelectTranslation(), LINEAR);
} else {
mRecentsView.resetSplitPrimaryScrollOffset();
setter.setFloat(mRecentsView, taskViewsFloat.first, 0, LINEAR);
}
}
/**
* @return true if {@param toState} is {@link RecentsState#OVERVIEW_SPLIT_SELECT}
*/
private boolean isSplitSelectionState(@NonNull RecentsState toState) {
return toState == OVERVIEW_SPLIT_SELECT;
}
}