diff options
author | Steve Slaven <bpk@hoopajoo.net> | 2011-01-10 18:44:49 (GMT) |
---|---|---|
committer | Steve Slaven <bpk@hoopajoo.net> | 2011-01-10 18:44:49 (GMT) |
commit | 4998d9ed31ba276cb64d9bfa9046d1ef147d5898 (patch) | |
tree | 91c363dcc824e309343d0b6ae4010fe089fd0836 | |
parent | 1b44b66b0aca6142aa85d19861473925b4db029e (diff) | |
download | SoftKeys-4998d9ed31ba276cb64d9bfa9046d1ef147d5898.zip SoftKeys-4998d9ed31ba276cb64d9bfa9046d1ef147d5898.tar.gz SoftKeys-4998d9ed31ba276cb64d9bfa9046d1ef147d5898.tar.bz2 |
Add keydown/up methods
-rw-r--r-- | src/net/hoopajoo/android/SoftKeys/Globals.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/net/hoopajoo/android/SoftKeys/Globals.java b/src/net/hoopajoo/android/SoftKeys/Globals.java index 6607ff4..607e9a3 100644 --- a/src/net/hoopajoo/android/SoftKeys/Globals.java +++ b/src/net/hoopajoo/android/SoftKeys/Globals.java @@ -104,6 +104,32 @@ public class Globals extends Application { return 0; } + public int sendKeyDown( int keyid ) { + try { + Globals.RootContext cmd = getRootContext(); + cmd.runCommand( "keycodedown " + keyid ); + }catch( Exception e ) { + Log.e( LOG, "Error: " + e.getMessage() ); + Toast.makeText( this, "Unable to execute as root", Toast.LENGTH_LONG ).show(); + return 1; + } + + return 0; + } + + public int sendKeyUp( int keyid ) { + try { + Globals.RootContext cmd = getRootContext(); + cmd.runCommand( "keycodeup " + keyid ); + }catch( Exception e ) { + Log.e( LOG, "Error: " + e.getMessage() ); + Toast.makeText( this, "Unable to execute as root", Toast.LENGTH_LONG ).show(); + return 1; + } + + return 0; + } + public class RootContext { Process p; OutputStream o; @@ -116,6 +142,7 @@ public class Globals extends Application { // spawn our context system( "export CLASSPATH=" + workingDir + "/RemoteContext.jar" ); system( "exec app_process " + workingDir + " net.hoopajoo.android.RemoteContext" ); + runCommand( "" ); } private void system( String cmd ) throws Exception { |