Use alternative way to fix split select page snapping issue

- Reverted to before ag/16095449 where reset() is called after state transition completed
- Call pageBeginTransition in dismiss animation to make sure onPageEndTransition is triggered to clear mCurrentPageScrollDiff properly
- Fixed a condition in resetFromSplitSelectionState ot use DeviceProfile.overviewShowAsGrid, as when state is in transition, showAsGrid() would be false

Fix: 207744890
Test: manual
Change-Id: I5a812a7ee26df2f953f7fed0155880620d2c4e66
This commit is contained in:
Alex Chau 2021-11-25 16:31:23 +00:00
parent da014976cd
commit b3a9386556
3 changed files with 11 additions and 10 deletions

View File

@ -37,12 +37,12 @@ import com.android.launcher3.statemanager.StateManager.StateListener;
import com.android.quickstep.FallbackActivityInterface;
import com.android.quickstep.GestureState;
import com.android.quickstep.RecentsActivity;
import com.android.quickstep.util.GroupTask;
import com.android.quickstep.util.SplitSelectStateController;
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.quickstep.util.GroupTask;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.Task.TaskKey;
@ -206,10 +206,6 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity, RecentsSta
@Override
public void onStateTransitionStart(RecentsState toState) {
if (toState == HOME) {
// Clean-up logic that occurs when recents is no longer in use/visible.
reset();
}
setOverviewStateEnabled(true);
setOverviewGridEnabled(toState.displayOverviewTasksAsGrid(mActivity.getDeviceProfile()));
setOverviewFullscreenEnabled(toState.isFullScreen());
@ -218,6 +214,10 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity, RecentsSta
@Override
public void onStateTransitionComplete(RecentsState finalState) {
if (finalState == HOME) {
// Clean-up logic that occurs when recents is no longer in use/visible.
reset();
}
boolean isOverlayEnabled = finalState == DEFAULT || finalState == MODAL_TASK;
setOverlayEnabled(isOverlayEnabled);
setFreezeViewVisibility(false);

View File

@ -92,10 +92,6 @@ public class LauncherRecentsView extends RecentsView<BaseQuickstepLauncher, Laun
@Override
public void onStateTransitionStart(LauncherState toState) {
if (toState == NORMAL || toState == SPRING_LOADED) {
// Clean-up logic that occurs when recents is no longer in use/visible.
reset();
}
setOverviewStateEnabled(toState.overviewUi);
setOverviewGridEnabled(toState.displayOverviewTasksAsGrid(mActivity.getDeviceProfile()));
setOverviewFullscreenEnabled(toState.getOverviewFullscreenProgress() == 1);
@ -104,6 +100,10 @@ public class LauncherRecentsView extends RecentsView<BaseQuickstepLauncher, Laun
@Override
public void onStateTransitionComplete(LauncherState finalState) {
if (finalState == NORMAL || finalState == SPRING_LOADED) {
// Clean-up logic that occurs when recents is no longer in use/visible.
reset();
}
boolean isOverlayEnabled = finalState == OVERVIEW || finalState == OVERVIEW_MODAL_TASK;
setOverlayEnabled(isOverlayEnabled);
setFreezeViewVisibility(false);

View File

@ -3185,6 +3185,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
}
}
}
pageBeginTransition();
setCurrentPage(pageToSnapTo);
// Update various scroll-dependent UI.
dispatchScrollChanged();
@ -4024,7 +4025,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
/** TODO(b/181707736) More gracefully handle exiting split selection state */
private void resetFromSplitSelectionState() {
if (!showAsGrid()) {
if (!mActivity.getDeviceProfile().overviewShowAsGrid) {
int pageToSnapTo = mCurrentPage;
if (mSplitHiddenTaskViewIndex <= pageToSnapTo) {
pageToSnapTo += 1;