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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -278,32 +278,6 @@ public class MagnificationControllerTest {
|
||||
|
||||
verify(mWindowMagnificationManager).setScale(eq(TEST_DISPLAY), eq(newScale));
|
||||
verify(mWindowMagnificationManager).persistScale(eq(TEST_DISPLAY));
|
||||
verify(mMagnificationController).onMagnificationScaleChanged(eq(TEST_DISPLAY),
|
||||
eq(MODE_WINDOW));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onMagnificationScaleChanged_capabilitiesAllMode_showMagnificationButton()
|
||||
throws RemoteException {
|
||||
mMagnificationController.setMagnificationCapabilities(
|
||||
Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_ALL);
|
||||
|
||||
mMagnificationController.onMagnificationScaleChanged(TEST_DISPLAY, MODE_WINDOW);
|
||||
|
||||
verify(mWindowMagnificationManager).showMagnificationButton(eq(TEST_DISPLAY),
|
||||
eq(MODE_WINDOW));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onMagnificationScaleChanged_capabilitiesNotAllMode_notShowMagnificationButton()
|
||||
throws RemoteException {
|
||||
mMagnificationController.setMagnificationCapabilities(
|
||||
Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN);
|
||||
|
||||
mMagnificationController.onMagnificationScaleChanged(TEST_DISPLAY, MODE_WINDOW);
|
||||
|
||||
verify(mWindowMagnificationManager, never()).showMagnificationButton(eq(TEST_DISPLAY),
|
||||
eq(MODE_WINDOW));
|
||||
}
|
||||
|
||||
private void setMagnificationEnabled(int mode) throws RemoteException {
|
||||
|
||||
Reference in New Issue
Block a user