am 7e3d6785: Fixes bug of the number of injected monkey events.

Merge commit '7e3d678570d9e9849a249476275fec0a4bb1be1e' into eclair-plus-aosp

* commit '7e3d678570d9e9849a249476275fec0a4bb1be1e':
  Fixes bug of the number of injected monkey events.
This commit is contained in:
Ying Wang
2010-01-08 18:42:58 -08:00
committed by Android Git Automerger

View File

@@ -717,7 +717,6 @@ public class Monkey {
*/ */
private int runMonkeyCycles() { private int runMonkeyCycles() {
int i = 0; int i = 0;
int lastKey = 0;
boolean systemCrashed = false; boolean systemCrashed = false;
@@ -753,7 +752,7 @@ public class Monkey {
continue; continue;
} }
if ((mVerbose > 0) && (i % 100) == 0 && i != 0 && lastKey == 0) { if ((mVerbose > 0) && (i % 100) == 0 && i != 0) {
System.out.println(" // Sending event #" + i); System.out.println(" // Sending event #" + i);
} }
@@ -774,16 +773,21 @@ public class Monkey {
} }
} else if (injectCode == MonkeyEvent.INJECT_ERROR_REMOTE_EXCEPTION) { } else if (injectCode == MonkeyEvent.INJECT_ERROR_REMOTE_EXCEPTION) {
systemCrashed = true; systemCrashed = true;
System.err.println("** Error: RemoteException while injecting event.");
} else if (injectCode == MonkeyEvent.INJECT_ERROR_SECURITY_EXCEPTION) { } else if (injectCode == MonkeyEvent.INJECT_ERROR_SECURITY_EXCEPTION) {
systemCrashed = !mIgnoreSecurityExceptions; systemCrashed = !mIgnoreSecurityExceptions;
if (systemCrashed) {
System.err.println("** Error: SecurityException while injecting event.");
}
} }
} else { } else {
// Event Source has signaled that we have no more events to process // Event Source has signaled that we have no more events to process
System.err.println("** Error: Event source exhausted.");
break; break;
} }
} }
// If we got this far, we succeeded! System.out.println("Events injected: " + i);
return mCount; return i;
} }
/** /**