am 3307fdcc: Merge "Added the new keyword tap for the scripted monkey." into gingerbread
Merge commit '3307fdcce1f322ed72cc3d3a8d9da87aae856531' into gingerbread-plus-aosp * commit '3307fdcce1f322ed72cc3d3a8d9da87aae856531': Added the new keyword tap for the scripted monkey.
This commit is contained in:
@@ -104,6 +104,8 @@ public class MonkeySourceScript implements MonkeyEventSource {
|
|||||||
|
|
||||||
private static final String EVENT_KEYWORD_RUNCMD = "RunCmd";
|
private static final String EVENT_KEYWORD_RUNCMD = "RunCmd";
|
||||||
|
|
||||||
|
private static final String EVENT_KEYWORD_TAP = "Tap";
|
||||||
|
|
||||||
// a line at the end of the header
|
// a line at the end of the header
|
||||||
private static final String STARTING_DATA_LINE = "start data >>";
|
private static final String STARTING_DATA_LINE = "start data >>";
|
||||||
|
|
||||||
@@ -253,7 +255,6 @@ public class MonkeySourceScript implements MonkeyEventSource {
|
|||||||
float yPrecision = Float.parseFloat(args[9]);
|
float yPrecision = Float.parseFloat(args[9]);
|
||||||
int device = Integer.parseInt(args[10]);
|
int device = Integer.parseInt(args[10]);
|
||||||
int edgeFlags = Integer.parseInt(args[11]);
|
int edgeFlags = Integer.parseInt(args[11]);
|
||||||
|
|
||||||
int type = MonkeyEvent.EVENT_TYPE_TRACKBALL;
|
int type = MonkeyEvent.EVENT_TYPE_TRACKBALL;
|
||||||
if (s.indexOf("Pointer") > 0) {
|
if (s.indexOf("Pointer") > 0) {
|
||||||
type = MonkeyEvent.EVENT_TYPE_POINTER;
|
type = MonkeyEvent.EVENT_TYPE_POINTER;
|
||||||
@@ -266,6 +267,40 @@ public class MonkeySourceScript implements MonkeyEventSource {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle tap event
|
||||||
|
if ((s.indexOf(EVENT_KEYWORD_TAP) >= 0) && args.length == 2) {
|
||||||
|
try {
|
||||||
|
float x = Float.parseFloat(args[0]);
|
||||||
|
float y = Float.parseFloat(args[1]);
|
||||||
|
|
||||||
|
// Set the default parameters
|
||||||
|
long downTime = SystemClock.uptimeMillis();
|
||||||
|
float pressure = 1;
|
||||||
|
float xPrecision = 1;
|
||||||
|
float yPrecision = 1;
|
||||||
|
int edgeFlags = 0;
|
||||||
|
float size = 5;
|
||||||
|
int device = 0;
|
||||||
|
int metaState = 0;
|
||||||
|
int type = MonkeyEvent.EVENT_TYPE_POINTER;
|
||||||
|
|
||||||
|
MonkeyMotionEvent e1 =
|
||||||
|
new MonkeyMotionEvent(type, downTime, downTime, KeyEvent.ACTION_DOWN, x,
|
||||||
|
y, pressure, size, metaState, xPrecision, yPrecision, device,
|
||||||
|
edgeFlags);
|
||||||
|
MonkeyMotionEvent e2 =
|
||||||
|
new MonkeyMotionEvent(type, downTime, downTime, KeyEvent.ACTION_UP, x,
|
||||||
|
y, pressure, size, metaState, xPrecision, yPrecision, device,
|
||||||
|
edgeFlags);
|
||||||
|
mQ.addLast(e1);
|
||||||
|
mQ.addLast(e2);
|
||||||
|
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
System.err.println("// " + e.toString());
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Handle flip events
|
// Handle flip events
|
||||||
if (s.indexOf(EVENT_KEYWORD_FLIP) >= 0 && args.length == 1) {
|
if (s.indexOf(EVENT_KEYWORD_FLIP) >= 0 && args.length == 1) {
|
||||||
boolean keyboardOpen = Boolean.parseBoolean(args[0]);
|
boolean keyboardOpen = Boolean.parseBoolean(args[0]);
|
||||||
|
|||||||
Reference in New Issue
Block a user