Monkey updates for new keyboard features.

Add the new volume mute key as a system key.
Use virtual keyboard during injection.
Also fixed a deprecation warning for using an old Intent API.

Bug: 2912307
Bug: 3221301
Change-Id: I056844509112727aa3541223f090cc500c55fc41
This commit is contained in:
Jeff Brown
2010-11-02 15:53:10 -07:00
parent 47d6d8e1e2
commit f083bd43a0
3 changed files with 4 additions and 5 deletions

View File

@@ -22,7 +22,6 @@ import android.content.Intent;
import android.os.Bundle;
import android.os.RemoteException;
import android.view.IWindowManager;
import android.util.Log;
/**
* monkey activity event
@@ -57,7 +56,7 @@ public class MonkeyActivityEvent extends MonkeyEvent {
public int injectEvent(IWindowManager iwm, IActivityManager iam, int verbose) {
Intent intent = getEvent();
if (verbose > 0) {
System.out.println(":Switch: " + intent.toURI());
System.out.println(":Switch: " + intent.toUri(0));
}
if (mAlarmTime != 0){
@@ -75,7 +74,7 @@ public class MonkeyActivityEvent extends MonkeyEvent {
} catch (SecurityException e) {
if (verbose > 0) {
System.out.println("** Permissions error starting activity "
+ intent.toURI());
+ intent.toUri(0));
}
return MonkeyEvent.INJECT_ERROR_SECURITY_EXCEPTION;
}

View File

@@ -294,7 +294,7 @@ public class MonkeySourceNetwork implements MonkeyEventSource {
// Convert the string to an array of KeyEvent's for
// the built in keymap.
KeyCharacterMap keyCharacterMap = KeyCharacterMap.
load(KeyCharacterMap.BUILT_IN_KEYBOARD);
load(KeyCharacterMap.VIRTUAL_KEYBOARD);
KeyEvent[] events = keyCharacterMap.getEvents(chars);
// enqueue all the events we just got.

View File

@@ -48,7 +48,7 @@ public class MonkeySourceRandom implements MonkeyEventSource {
private static final int[] SYS_KEYS = {
KeyEvent.KEYCODE_HOME, KeyEvent.KEYCODE_BACK,
KeyEvent.KEYCODE_CALL, KeyEvent.KEYCODE_ENDCALL,
KeyEvent.KEYCODE_VOLUME_UP, KeyEvent.KEYCODE_VOLUME_DOWN,
KeyEvent.KEYCODE_VOLUME_UP, KeyEvent.KEYCODE_VOLUME_DOWN, KeyEvent.KEYCODE_VOLUME_MUTE,
KeyEvent.KEYCODE_MUTE,
};
/** If a physical key exists? */