Loading services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java +5 −10 Original line number Diff line number Diff line Loading @@ -930,16 +930,11 @@ public class AccessibilityInputFilter extends InputFilter implements EventStream final MagnificationGestureHandler handler = mMagnificationGestureHandler.get(displayId); if (handler != null) { if (Flags.onlyResetMagnificationIfNeededWhenDestroyHandler()) { // With the given enabledFeatures parameter if the magnification feature is still // enabled, which means after the disabling there is a recreating coming, so the // magnification reset is not needed. handler.onDestroy( /* resetMagnification= */ !isAnyMagnificationEnabled(featuresToBeEnabled)); } else { // The old behavior is always resetting the magnification when destroying handler handler.onDestroy(/* resetMagnification= */ true); } mMagnificationGestureHandler.remove(displayId); } Loading services/tests/servicestests/src/com/android/server/accessibility/AccessibilityInputFilterTest.java +1 −24 Original line number Diff line number Diff line Loading @@ -27,14 +27,13 @@ import static com.android.server.accessibility.AccessibilityInputFilter.FLAG_FEA import static com.android.server.accessibility.AccessibilityInputFilter.FLAG_FEATURE_MAGNIFICATION_SINGLE_FINGER_TRIPLE_TAP; import static com.android.server.accessibility.AccessibilityInputFilter.FLAG_FEATURE_TOUCH_EXPLORATION; import static com.android.server.accessibility.AccessibilityInputFilter.FLAG_FEATURE_TRIGGERED_SCREEN_MAGNIFIER; import static com.android.server.accessibility.Flags.FLAG_ONLY_RESET_MAGNIFICATION_IF_NEEDED_WHEN_DESTROY_HANDLER; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.ArgumentMatchers.notNull; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; Loading @@ -51,7 +50,6 @@ import android.hardware.input.InputManager; import android.hardware.input.InputManagerGlobal; import android.os.Looper; import android.os.SystemClock; import android.platform.test.annotations.RequiresFlagsDisabled; import android.platform.test.annotations.RequiresFlagsEnabled; import android.platform.test.flag.junit.CheckFlagsRule; import android.platform.test.flag.junit.DeviceFlagsValueProvider; Loading Loading @@ -410,26 +408,6 @@ public class AccessibilityInputFilterTest { } @Test @RequiresFlagsDisabled(FLAG_ONLY_RESET_MAGNIFICATION_IF_NEEDED_WHEN_DESTROY_HANDLER) public void testEnabledFeaturesChanged_magFeatureKeepsEnabled_flagOff_resetMagnification() { prepareLooper(); doReturn(Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN) .when(mAms).getMagnificationMode(DEFAULT_DISPLAY); // Create FullScreenMagnificationGestureHandler mA11yInputFilter.setUserAndEnabledFeatures(0, mFeatures); MagnificationGestureHandler handler = mock(MagnificationGestureHandler.class); mMagnificationGestureHandler.put(DEFAULT_DISPLAY, handler); // Any feature changes causes the AccessibilityInputFilter to destroy the gesture handler // and recreate new one. The destroying of gesture handler causes the magnification reset mA11yInputFilter.setUserAndEnabledFeatures(0, mFeatures | FLAG_FEATURE_MAGNIFICATION_SINGLE_FINGER_TRIPLE_TAP); verify(handler).onDestroy(/* resetMagnification= */ eq(true)); } @Test @RequiresFlagsEnabled(FLAG_ONLY_RESET_MAGNIFICATION_IF_NEEDED_WHEN_DESTROY_HANDLER) public void testEnabledFeaturesChanged_magFeatureKeepsEnabled_flagOn_doNotResetMagnification() { prepareLooper(); doReturn(Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN) Loading @@ -449,7 +427,6 @@ public class AccessibilityInputFilterTest { } @Test @RequiresFlagsEnabled(FLAG_ONLY_RESET_MAGNIFICATION_IF_NEEDED_WHEN_DESTROY_HANDLER) public void testDisablingMagFeatures_magFeatureWasEnabled_flagOn_resetMagnification() { prepareLooper(); doReturn(Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN) Loading Loading
services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java +5 −10 Original line number Diff line number Diff line Loading @@ -930,16 +930,11 @@ public class AccessibilityInputFilter extends InputFilter implements EventStream final MagnificationGestureHandler handler = mMagnificationGestureHandler.get(displayId); if (handler != null) { if (Flags.onlyResetMagnificationIfNeededWhenDestroyHandler()) { // With the given enabledFeatures parameter if the magnification feature is still // enabled, which means after the disabling there is a recreating coming, so the // magnification reset is not needed. handler.onDestroy( /* resetMagnification= */ !isAnyMagnificationEnabled(featuresToBeEnabled)); } else { // The old behavior is always resetting the magnification when destroying handler handler.onDestroy(/* resetMagnification= */ true); } mMagnificationGestureHandler.remove(displayId); } Loading
services/tests/servicestests/src/com/android/server/accessibility/AccessibilityInputFilterTest.java +1 −24 Original line number Diff line number Diff line Loading @@ -27,14 +27,13 @@ import static com.android.server.accessibility.AccessibilityInputFilter.FLAG_FEA import static com.android.server.accessibility.AccessibilityInputFilter.FLAG_FEATURE_MAGNIFICATION_SINGLE_FINGER_TRIPLE_TAP; import static com.android.server.accessibility.AccessibilityInputFilter.FLAG_FEATURE_TOUCH_EXPLORATION; import static com.android.server.accessibility.AccessibilityInputFilter.FLAG_FEATURE_TRIGGERED_SCREEN_MAGNIFIER; import static com.android.server.accessibility.Flags.FLAG_ONLY_RESET_MAGNIFICATION_IF_NEEDED_WHEN_DESTROY_HANDLER; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.ArgumentMatchers.notNull; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; Loading @@ -51,7 +50,6 @@ import android.hardware.input.InputManager; import android.hardware.input.InputManagerGlobal; import android.os.Looper; import android.os.SystemClock; import android.platform.test.annotations.RequiresFlagsDisabled; import android.platform.test.annotations.RequiresFlagsEnabled; import android.platform.test.flag.junit.CheckFlagsRule; import android.platform.test.flag.junit.DeviceFlagsValueProvider; Loading Loading @@ -410,26 +408,6 @@ public class AccessibilityInputFilterTest { } @Test @RequiresFlagsDisabled(FLAG_ONLY_RESET_MAGNIFICATION_IF_NEEDED_WHEN_DESTROY_HANDLER) public void testEnabledFeaturesChanged_magFeatureKeepsEnabled_flagOff_resetMagnification() { prepareLooper(); doReturn(Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN) .when(mAms).getMagnificationMode(DEFAULT_DISPLAY); // Create FullScreenMagnificationGestureHandler mA11yInputFilter.setUserAndEnabledFeatures(0, mFeatures); MagnificationGestureHandler handler = mock(MagnificationGestureHandler.class); mMagnificationGestureHandler.put(DEFAULT_DISPLAY, handler); // Any feature changes causes the AccessibilityInputFilter to destroy the gesture handler // and recreate new one. The destroying of gesture handler causes the magnification reset mA11yInputFilter.setUserAndEnabledFeatures(0, mFeatures | FLAG_FEATURE_MAGNIFICATION_SINGLE_FINGER_TRIPLE_TAP); verify(handler).onDestroy(/* resetMagnification= */ eq(true)); } @Test @RequiresFlagsEnabled(FLAG_ONLY_RESET_MAGNIFICATION_IF_NEEDED_WHEN_DESTROY_HANDLER) public void testEnabledFeaturesChanged_magFeatureKeepsEnabled_flagOn_doNotResetMagnification() { prepareLooper(); doReturn(Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN) Loading @@ -449,7 +427,6 @@ public class AccessibilityInputFilterTest { } @Test @RequiresFlagsEnabled(FLAG_ONLY_RESET_MAGNIFICATION_IF_NEEDED_WHEN_DESTROY_HANDLER) public void testDisablingMagFeatures_magFeatureWasEnabled_flagOn_resetMagnification() { prepareLooper(); doReturn(Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN) Loading