diff options
author | Casey Burkhardt <caseyburkhardt@google.com> | 2015-02-19 01:06:51 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-02-19 01:06:51 +0000 |
commit | 4a0e02377ca89d6e606662dc4b96ca87bcb53055 (patch) | |
tree | e75abd773a39e8b23332ac08724352bb410d3a47 | |
parent | b456104d9f8ff0dba77f80f7e5e23753d58716a2 (diff) | |
parent | bdbd4736351231aac4da720ff7326ea2791e0b00 (diff) | |
download | frameworks_base-4a0e02377ca89d6e606662dc4b96ca87bcb53055.zip frameworks_base-4a0e02377ca89d6e606662dc4b96ca87bcb53055.tar.gz frameworks_base-4a0e02377ca89d6e606662dc4b96ca87bcb53055.tar.bz2 |
am bdbd4736: Merge "Refinements to magnification for improved wearable support." into lmp-mr1-modular-dev
* commit 'bdbd4736351231aac4da720ff7326ea2791e0b00':
Refinements to magnification for improved wearable support.
-rw-r--r-- | core/res/res/values-watch/config.xml | 8 | ||||
-rwxr-xr-x | core/res/res/values/config.xml | 8 | ||||
-rwxr-xr-x | core/res/res/values/symbols.xml | 3 | ||||
-rw-r--r-- | services/accessibility/java/com/android/server/accessibility/ScreenMagnifier.java | 21 |
4 files changed, 33 insertions, 7 deletions
diff --git a/core/res/res/values-watch/config.xml b/core/res/res/values-watch/config.xml index 307a1ea..745aa73 100644 --- a/core/res/res/values-watch/config.xml +++ b/core/res/res/values-watch/config.xml @@ -43,4 +43,12 @@ <!-- Flags enabling default window features. See Window.java --> <bool name="config_defaultWindowFeatureOptionsPanel">false</bool> <bool name="config_defaultWindowFeatureContextMenu">false</bool> + + <!-- Time adjustment, in milliseconds, applied to the default double tap threshold + used for gesture detection by the screen magnifier. --> + <integer name="config_screen_magnification_multi_tap_adjustment">25</integer> + + <!-- Scale factor threshold used by the screen magnifier to determine when to switch from + panning to scaling the magnification viewport. --> + <item name="config_screen_magnification_scaling_threshold" format="float" type="dimen">0.1</item> </resources> diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index fdd2169..945b505 100755 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -2052,4 +2052,12 @@ <!-- Whether to start in touch mode --> <bool name="config_defaultInTouchMode">true</bool> + + <!-- Time adjustment, in milliseconds, applied to the default double tap threshold + used for gesture detection by the screen magnifier. --> + <integer name="config_screen_magnification_multi_tap_adjustment">-50</integer> + + <!-- Scale factor threshold used by the screen magnifier to determine when to switch from + panning to scaling the magnification viewport. --> + <item name="config_screen_magnification_scaling_threshold" format="float" type="dimen">0.3</item> </resources> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index eec989e..84ebe74 100755 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2147,4 +2147,7 @@ <java-symbol type="bool" name="config_use_sim_language_file" /> <java-symbol type="bool" name="config_LTE_eri_for_network_name" /> <java-symbol type="bool" name="config_defaultInTouchMode" /> + + <java-symbol type="integer" name="config_screen_magnification_multi_tap_adjustment" /> + <java-symbol type="dimen" name="config_screen_magnification_scaling_threshold" /> </resources> diff --git a/services/accessibility/java/com/android/server/accessibility/ScreenMagnifier.java b/services/accessibility/java/com/android/server/accessibility/ScreenMagnifier.java index c8b080e..b4613d6 100644 --- a/services/accessibility/java/com/android/server/accessibility/ScreenMagnifier.java +++ b/services/accessibility/java/com/android/server/accessibility/ScreenMagnifier.java @@ -34,6 +34,7 @@ import android.provider.Settings; import android.text.TextUtils; import android.util.Property; import android.util.Slog; +import android.util.TypedValue; import android.view.GestureDetector; import android.view.GestureDetector.SimpleOnGestureListener; import android.view.MagnificationSpec; @@ -110,7 +111,6 @@ public final class ScreenMagnifier implements WindowManagerInternal.Magnificatio private static final int STATE_MAGNIFIED_INTERACTION = 4; private static final float DEFAULT_MAGNIFICATION_SCALE = 2.0f; - private static final int MULTI_TAP_TIME_SLOP_ADJUSTMENT = 50; private static final int MESSAGE_ON_MAGNIFIED_BOUNDS_CHANGED = 1; private static final int MESSAGE_ON_RECTANGLE_ON_SCREEN_REQUESTED = 2; @@ -135,9 +135,8 @@ public final class ScreenMagnifier implements WindowManagerInternal.Magnificatio private final AccessibilityManagerService mAms; - private final int mTapTimeSlop = ViewConfiguration.getTapTimeout(); - private final int mMultiTapTimeSlop = - ViewConfiguration.getDoubleTapTimeout() - MULTI_TAP_TIME_SLOP_ADJUSTMENT; + private final int mTapTimeSlop = ViewConfiguration.getJumpTapTimeout(); + private final int mMultiTapTimeSlop; private final int mTapDistanceSlop; private final int mMultiTapDistanceSlop; @@ -192,6 +191,9 @@ public final class ScreenMagnifier implements WindowManagerInternal.Magnificatio mWindowManager = LocalServices.getService(WindowManagerInternal.class); mAms = service; + mMultiTapTimeSlop = ViewConfiguration.getDoubleTapTimeout() + + mContext.getResources().getInteger( + com.android.internal.R.integer.config_screen_magnification_multi_tap_adjustment); mLongAnimationDuration = context.getResources().getInteger( com.android.internal.R.integer.config_longAnimTime); mTapDistanceSlop = ViewConfiguration.get(context).getScaledTouchSlop(); @@ -481,15 +483,20 @@ public final class ScreenMagnifier implements WindowManagerInternal.Magnificatio private static final float MIN_SCALE = 1.3f; private static final float MAX_SCALE = 5.0f; - private static final float SCALING_THRESHOLD = 0.3f; - private final ScaleGestureDetector mScaleGestureDetector; private final GestureDetector mGestureDetector; + private final float mScalingThreshold; + private float mInitialScaleFactor = -1; private boolean mScaling; public MagnifiedContentInteractonStateHandler(Context context) { + final TypedValue scaleValue = new TypedValue(); + context.getResources().getValue( + com.android.internal.R.dimen.config_screen_magnification_scaling_threshold, + scaleValue, false); + mScalingThreshold = scaleValue.getFloat(); mScaleGestureDetector = new ScaleGestureDetector(context, this); mScaleGestureDetector.setQuickScaleEnabled(false); mGestureDetector = new GestureDetector(context, this); @@ -537,7 +544,7 @@ public final class ScreenMagnifier implements WindowManagerInternal.Magnificatio mInitialScaleFactor = detector.getScaleFactor(); } else { final float deltaScale = detector.getScaleFactor() - mInitialScaleFactor; - if (Math.abs(deltaScale) > SCALING_THRESHOLD) { + if (Math.abs(deltaScale) > mScalingThreshold) { mScaling = true; return true; } |