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

Commit fe1579e2 authored by mincheli's avatar mincheli
Browse files

Not need to show magnification switch UI when magnification scale is changed

In the new design, we show the magnification switch UI when the touch
interaction starts, ends or cancels.
We don't need to notify showing the switch UI when the scale is changed
because the new design includes the case for scale changes.
So we can remove the implementation of onMagnificationScaleChanged.

Bug: 172631612
Test: atest FullScreenMagnificationGestureHandlerTest MagnificationControllerTest
Change-Id: I245b611d8a6a50aeff008257cbb87dfed8fd8962
parent a72217f7
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -395,7 +395,6 @@ public class FullScreenMagnificationGestureHandler extends MagnificationGestureH
            if (DEBUG_PANNING_SCALING) Slog.i(mLogTag, "Scaled content to: " + scale + "x");
            mFullScreenMagnificationController.setScale(mDisplayId, scale, pivotX, pivotY, false,
                    AccessibilityManagerService.MAGNIFICATION_GESTURE_HANDLER_ID);
            mListener.onMagnificationScaleChanged(mDisplayId, getMode());
            return /* handled: */ true;
        }

+0 −10
Original line number Diff line number Diff line
@@ -84,16 +84,6 @@ public class MagnificationController implements WindowMagnificationManager.Callb
    public void onPerformScaleAction(int displayId, float scale) {
        getWindowMagnificationMgr().setScale(displayId, scale);
        getWindowMagnificationMgr().persistScale(displayId);
        onMagnificationScaleChanged(displayId,
                Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_WINDOW);
    }

    @Override
    public void onMagnificationScaleChanged(int displayId, int mode) {
        if (mMagnificationCapabilities != Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_ALL) {
            return;
        }
        getWindowMagnificationMgr().showMagnificationButton(displayId, mode);
    }

    /**
+1 −7
Original line number Diff line number Diff line
@@ -61,13 +61,7 @@ public abstract class MagnificationGestureHandler extends BaseEventStreamTransfo

    /** Interface for listening to the magnification scaling gesture. */
    public interface ScaleChangedListener {
        /**
         * Called when the magnification scale is changed by users.
         *
         * @param displayId The logical display id
         * @param mode      The magnification mode
         */
        void onMagnificationScaleChanged(int displayId, int mode);

    }

    protected final ScaleChangedListener mListener;
+0 −1
Original line number Diff line number Diff line
@@ -115,7 +115,6 @@ public class WindowMagnificationGestureHandler extends MagnificationGestureHandl
                            @Override
                            public void setScale(int displayId, float scale) {
                                mWindowMagnificationMgr.setScale(displayId, scale);
                                mListener.onMagnificationScaleChanged(displayId, getMode());
                            }

                            @Override
+0 −3
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ import android.content.Context;
import android.graphics.PointF;
import android.os.Handler;
import android.os.Message;
import android.provider.Settings;
import android.util.DebugUtils;
import android.view.InputDevice;
import android.view.MotionEvent;
@@ -554,8 +553,6 @@ public class FullScreenMagnificationGestureHandlerTest {
                check(mMgh.mCurrentState == mMgh.mPanningScalingState,
                        state);
                check(mMgh.mPanningScalingState.mScaling, state);
                verify(mMockScaleChangedListener).onMagnificationScaleChanged(DISPLAY_0,
                        Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN);
            } break;
            default: throw new IllegalArgumentException("Illegal state: " + state);
        }
Loading