diff options
author | Yu Shan Emily Lau <yslau@google.com> | 2010-12-09 18:26:10 -0800 |
---|---|---|
committer | Yu Shan Emily Lau <yslau@google.com> | 2010-12-09 18:36:39 -0800 |
commit | af2fc1a4e2d99c99243f54edaf3e4f7216daf0d2 (patch) | |
tree | 491cb2ffc60298e2a934c6868488db5b1a7f062b /cmds | |
parent | 7fcb1ad8e97f0fb6f91879664d2d254f9dfd2459 (diff) | |
download | android_development-af2fc1a4e2d99c99243f54edaf3e4f7216daf0d2.tar.gz android_development-af2fc1a4e2d99c99243f54edaf3e4f7216daf0d2.tar.bz2 android_development-af2fc1a4e2d99c99243f54edaf3e4f7216daf0d2.zip |
Adjusted the motionEvent time to the acutal time when then event is send out to the queue.
Change-Id: I722508829c79028a7345a4dea0517fc1117b8fa5
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java | 36 |
1 files changed, 7 insertions, 29 deletions
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java index 6defcb001..799b8af4b 100644 --- a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java +++ b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java @@ -597,41 +597,19 @@ public class MonkeySourceScript implements MonkeyEventSource { } /** - * Adjust motion downtime and eventtime according to both recorded values - * and current system time. + * Adjust motion downtime and eventtime according to current system time. * * @param e A KeyEvent */ private void adjustMotionEventTime(MonkeyMotionEvent e) { + long updatedDownTime = 0; + if (e.getEventTime() < 0) { return; - } - long thisDownTime = 0; - long thisEventTime = 0; - long expectedDelay = 0; - - if (mLastRecordedEventTime <= 0) { - // first time event - thisDownTime = SystemClock.uptimeMillis(); - thisEventTime = thisDownTime; - } else { - if (e.getDownTime() != mLastRecordedDownTimeMotion) { - thisDownTime = e.getDownTime(); - } else { - thisDownTime = mLastExportDownTimeMotion; - } - expectedDelay = (long) ((e.getEventTime() - mLastRecordedEventTime) * mSpeed); - thisEventTime = mLastExportEventTime + expectedDelay; - // add sleep to simulate everything in recording - needSleep(expectedDelay - SLEEP_COMPENSATE_DIFF); - } - - mLastRecordedDownTimeMotion = e.getDownTime(); - mLastRecordedEventTime = e.getEventTime(); - e.setDownTime(thisDownTime); - e.setEventTime(thisEventTime); - mLastExportDownTimeMotion = thisDownTime; - mLastExportEventTime = thisEventTime; + } + updatedDownTime = SystemClock.uptimeMillis(); + e.setDownTime(updatedDownTime); + e.setEventTime(updatedDownTime); } /** |