summaryrefslogtreecommitdiffstats
path: root/src/net/hoopajoo/android/SoftKeys/Globals.java
diff options
context:
space:
mode:
authorSteve Slaven <bpk@hoopajoo.net>2011-01-10 20:21:09 (GMT)
committerSteve Slaven <bpk@hoopajoo.net>2011-01-10 20:21:09 (GMT)
commit30facff015d37b1b71a0bb80f64718d376c1c1c9 (patch)
tree9bd1a123b3f36296023b568cda871be7e67023f1 /src/net/hoopajoo/android/SoftKeys/Globals.java
parent4998d9ed31ba276cb64d9bfa9046d1ef147d5898 (diff)
downloadSoftKeys-30facff015d37b1b71a0bb80f64718d376c1c1c9.zip
SoftKeys-30facff015d37b1b71a0bb80f64718d376c1c1c9.tar.gz
SoftKeys-30facff015d37b1b71a0bb80f64718d376c1c1c9.tar.bz2
changed back to just sending keypress not keydown/up since there is a
keyrepeat issue. Here we can now detect longpress so we should modify the response based on that. Also init the shell early
Diffstat (limited to 'src/net/hoopajoo/android/SoftKeys/Globals.java')
-rw-r--r--src/net/hoopajoo/android/SoftKeys/Globals.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/net/hoopajoo/android/SoftKeys/Globals.java b/src/net/hoopajoo/android/SoftKeys/Globals.java
index 607e9a3..d715e30 100644
--- a/src/net/hoopajoo/android/SoftKeys/Globals.java
+++ b/src/net/hoopajoo/android/SoftKeys/Globals.java
@@ -53,7 +53,7 @@ public class Globals extends Application {
// set up env and run the context
String wd = getFilesDir().getAbsolutePath();
File jar = new File( wd + "/RemoteContext.jar" );
- if( ! jar.exists() ) {
+ if( true ) {
AssetManager m = getResources().getAssets();
InputStream in = m.open( "input/RemoteContext.jar" );
FileOutputStream out = new FileOutputStream( jar );
@@ -78,7 +78,6 @@ public class Globals extends Application {
}else{
mRootContext = new RootContext( "su", wd );
}
-
}
return( mRootContext );
@@ -142,12 +141,11 @@ 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 {
//Log.d( "SoftKeys.RootContext", "Running command: '" + cmd + "'" );
- o.write( (cmd + "\n" ).getBytes( "ASCII" ) );
+ o.write( (cmd + "\n" ).getBytes( "ASCII" ) );
}
// slightly renamed since we're not running system("cmd") anymore but
@@ -180,6 +178,14 @@ public class Globals extends Application {
}
android_id = Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID);
+
+ // init the shell
+ try{
+ getRootContext();
+ }catch( Exception e ) {
+ Toast.makeText( this, "Failed to initialize root context", Toast.LENGTH_LONG );
+ }
+
restartService();
}
@@ -242,4 +248,9 @@ public class Globals extends Application {
}
return( defaultLauncher );
}
+
+ public void quit() {
+ this.stopService( new Intent( this, SoftKeysService.class ) );
+ System.exit( 0 );
+ }
}