diff options
author | jdduke@chromium.org <jdduke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-02 19:36:03 +0000 |
---|---|---|
committer | jdduke@chromium.org <jdduke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-02 19:36:03 +0000 |
commit | 425b339b93e5db00c82013b012999bdb9eb402f0 (patch) | |
tree | 16d0bb49c87a30ed40f55a740f8ec5b532a275e1 /ui/android | |
parent | 35fbb121e9152bd66bf71f8262eebf76f52e56cc (diff) | |
download | chromium_src-425b339b93e5db00c82013b012999bdb9eb402f0.zip chromium_src-425b339b93e5db00c82013b012999bdb9eb402f0.tar.gz chromium_src-425b339b93e5db00c82013b012999bdb9eb402f0.tar.bz2 |
Provide max gesture bounds and option to ignore touch size during pinch
Certain devices produce garbage |MotionEvent.getTouchMajor()| values, either
unreasonably small or unreasonable large, with extreme variance between touches.
This can cause a number of problems with the current gesture detection pipeline.
Add a maximum gesture bounds size as a sanity fallback for tap disambiguation.
Also disable by default the use of touch size when calculating the pinch scale
factor. Its use does not seem to add any measurable benefit, but can produce
severe scale artifacts on devices with unpredictable touch sizes. This
phenomenon appears to be more common on devices originally targetted for ICS.
BUG=376618
Review URL: https://codereview.chromium.org/340343013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281078 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/android')
-rw-r--r-- | ui/android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ui/android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java b/ui/android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java index e8fc5b9..8f47717 100644 --- a/ui/android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java +++ b/ui/android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java @@ -8,6 +8,7 @@ import android.content.ComponentCallbacks; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; +import android.os.Build; import android.util.TypedValue; import android.view.ViewConfiguration; @@ -136,6 +137,14 @@ public class ViewConfigurationHelper { } @CalledByNative + private static boolean shouldUseTouchMajorInScalingSpan() { + // Android's ScaleGestureDetector started using touch major values in + // JBMR1. Many devices from versions prior report wildly inconsistent + // touch sizes, so disable touch major use in such scenarios. + return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1; + } + + @CalledByNative private static ViewConfigurationHelper createWithListener(Context context) { ViewConfigurationHelper viewConfigurationHelper = new ViewConfigurationHelper(context); viewConfigurationHelper.registerListener(); |