diff options
| author | Guang Zhu <guangzhu@google.com> | 2012-05-01 12:35:29 -0700 |
|---|---|---|
| committer | Guang Zhu <guangzhu@google.com> | 2012-05-01 13:57:57 -0700 |
| commit | 8749a298c0a94df8fc511bdd08fef4a59d0fadf7 (patch) | |
| tree | 8e4c5b6c87b30179b13d2d899f9c7ec613815286 /cmds | |
| parent | 909ec2e1ae92618d5fd351cc23ee55f5693ab532 (diff) | |
| download | android_development-8749a298c0a94df8fc511bdd08fef4a59d0fadf7.tar.gz android_development-8749a298c0a94df8fc511bdd08fef4a59d0fadf7.tar.bz2 android_development-8749a298c0a94df8fc511bdd08fef4a59d0fadf7.zip | |
fix how monkey adjust timestamps for motion events
Currently for motion events, monkey forces current system uptime
onto both down time and event time. This breaks ACTION_MOVE
events because the down time of it is supposed to be the time
when finger is down.
the new logic is:
* check down time, if it's invalid (<0), fill in uptime
* always update event time with a fresh uptime
Bug: 6424997
Change-Id: I0b445815a5015d48c08bebc921c572164874449d
Diffstat (limited to 'cmds')
| -rw-r--r-- | cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java index d65440b97..055ef22b5 100644 --- a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java +++ b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java @@ -29,7 +29,6 @@ import java.io.IOException; import java.io.InputStreamReader; import java.util.NoSuchElementException; import java.util.Random; -import android.util.Log; /** * monkey event queue. It takes a script to produce events sample script format: @@ -748,6 +747,7 @@ public class MonkeySourceScript implements MonkeyEventSource { * * @return True if the file exists and the header is valid, false otherwise. */ + @Override public boolean validate() { boolean validHeader; try { @@ -763,6 +763,7 @@ public class MonkeySourceScript implements MonkeyEventSource { return validHeader; } + @Override public void setVerbose(int verbose) { mVerbose = verbose; } @@ -812,11 +813,10 @@ public class MonkeySourceScript implements MonkeyEventSource { private void adjustMotionEventTime(MonkeyMotionEvent e) { long updatedDownTime = 0; - if (e.getEventTime() < 0) { - return; - } updatedDownTime = SystemClock.uptimeMillis(); - e.setDownTime(updatedDownTime); + if (e.getDownTime() < 0) { + e.setDownTime(updatedDownTime); + } e.setEventTime(updatedDownTime); } @@ -830,6 +830,7 @@ public class MonkeySourceScript implements MonkeyEventSource { * @return The first event in the event queue or null if the end of the file * is reached or if an error is encountered reading the file. */ + @Override public MonkeyEvent getNextEvent() { long recordedEventTime = -1; MonkeyEvent ev; |
