summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authordominikg@chromium.org <dominikg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-04 18:08:22 +0000
committerdominikg@chromium.org <dominikg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-04 18:08:22 +0000
commit783087b9bbaebb64e670484982a722dcf0b92163 (patch)
tree20c5c1d82349c4935f6261310c532d8a79cbcefd /content
parentff41e625781f4511a45df7c307e2c79f358836ac (diff)
downloadchromium_src-783087b9bbaebb64e670484982a722dcf0b92163.zip
chromium_src-783087b9bbaebb64e670484982a722dcf0b92163.tar.gz
chromium_src-783087b9bbaebb64e670484982a722dcf0b92163.tar.bz2
Android: Fix calculation of event time for synthetic touch gestures.
On JB+ we use a TimeListener listening to vsync to send out touch events. The time of the touch event was computed by adding the time elapsed since the listener was created to the time when we first touched down a pointer, |mDownTime|. Instead of using |mDownTime| (which is uninitialized the first time round), we record the time when the gesture was started and use that to calculate the event time. BUG=312731 Review URL: https://codereview.chromium.org/51103011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232732 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/public/android/java/src/org/chromium/content/browser/GenericTouchGesture.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/content/public/android/java/src/org/chromium/content/browser/GenericTouchGesture.java b/content/public/android/java/src/org/chromium/content/browser/GenericTouchGesture.java
index daa6cc3..c381da6 100644
--- a/content/public/android/java/src/org/chromium/content/browser/GenericTouchGesture.java
+++ b/content/public/android/java/src/org/chromium/content/browser/GenericTouchGesture.java
@@ -32,6 +32,7 @@ public class GenericTouchGesture {
private int mNativePtr;
private long mDownTime;
+ private long mStartTime;
private final byte STATE_INITIAL = 0;
private final byte STATE_MOVING = 1;
@@ -174,6 +175,7 @@ public class GenericTouchGesture {
void start(int nativePtr) {
assert mNativePtr == 0;
mNativePtr = nativePtr;
+ mStartTime = SystemClock.uptimeMillis();
Runnable runnable = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) ?
createJBRunnable() : createPreJBRunnable();
@@ -183,7 +185,7 @@ public class GenericTouchGesture {
boolean sendEvent(long time) {
switch (state) {
case STATE_INITIAL: {
- mDownTime = SystemClock.uptimeMillis();
+ mDownTime = time;
// Touch the first pointer down. This initiates the gesture.
MotionEvent event = MotionEvent.obtain(mDownTime, time,
@@ -266,7 +268,7 @@ public class GenericTouchGesture {
@Override
public void onTimeUpdate(TimeAnimator animation, long totalTime,
long deltaTime) {
- if (!sendEvent(mDownTime + totalTime)) {
+ if (!sendEvent(mStartTime + totalTime)) {
mTimeAnimator.end();
}
}