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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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? */
|
||||
|
||||
Reference in New Issue
Block a user