Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 24852c54 authored by Roy Chou's avatar Roy Chou
Browse files

fix(magnification): FullScreenMagnificationGestureHandler state decision is ambiguous

In FullScreenMagnificationGestureHandler#DetectingState, when deciding the state transition for MOVE event, there exists some ambiguous logics. If mIsSinglePanningEnabled is true and the event causes overscroll, the handler state will first transit to DelegatingState then transit to PanningState right away, which is not expected. If the condition matches, the expected state should just be the DelegatingState. Threrefore we move the PanningState transition into else block so the transistions will not happen simultaneously.

NO_IFTTT=checked

Bug: 319537921
Flag: NA
Test: manually
      atest FullScreenMagnificationGestureHandlerTest
Change-Id: I0157ddd4117ff4048c3bc44e614cb73c7425dd3f
parent 05ef6674
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -1004,17 +1004,19 @@ public class FullScreenMagnificationGestureHandler extends MagnificationGestureH
                                    && overscrollState(event, mFirstPointerDownLocation)
                                    == OVERSCROLL_VERTICAL_EDGE) {
                                transitionToDelegatingStateAndClear();
                            } // TODO(b/319537921): should there be an else here?
                            } else {
                                //Primary pointer is swiping, so transit to PanningScalingState
                                transitToPanningScalingStateAndClear();
                            }
                        } else if (mIsSinglePanningEnabled
                                && isActivated()
                                && event.getPointerCount() == 1) {
                            if (overscrollState(event, mFirstPointerDownLocation)
                                    == OVERSCROLL_VERTICAL_EDGE) {
                                transitionToDelegatingStateAndClear();
                            } // TODO(b/319537921): should there be an else here?
                            } else {
                                transitToSinglePanningStateAndClear();
                            }
                        } else if (!mIsTwoFingerCountReached) {
                            // If it is a two-finger gesture, do not transition to the
                            // delegating state to ensure the reachability of
@@ -1257,17 +1259,19 @@ public class FullScreenMagnificationGestureHandler extends MagnificationGestureH
                                    && overscrollState(event, mFirstPointerDownLocation)
                                    == OVERSCROLL_VERTICAL_EDGE) {
                                transitionToDelegatingStateAndClear();
                            }
                            } else {
                                //Primary pointer is swiping, so transit to PanningScalingState
                                transitToPanningScalingStateAndClear();
                            }
                        } else if (mIsSinglePanningEnabled
                                && isActivated()
                                && event.getPointerCount() == 1) {
                            if (overscrollState(event, mFirstPointerDownLocation)
                                    == OVERSCROLL_VERTICAL_EDGE) {
                                transitionToDelegatingStateAndClear();
                            }
                            } else {
                                transitToSinglePanningStateAndClear();
                            }
                        } else {
                            transitionToDelegatingStateAndClear();
                        }