diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 9b11f93..3dd3142 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -2,6 +2,7 @@ + diff --git a/res/layout/read_logs.xml b/res/layout/read_logs.xml new file mode 100644 index 0000000..e389973 --- /dev/null +++ b/res/layout/read_logs.xml @@ -0,0 +1,7 @@ + + + + diff --git a/res/menu/main.xml b/res/menu/main.xml index cfc1a96..198fd78 100644 --- a/res/menu/main.xml +++ b/res/menu/main.xml @@ -4,4 +4,5 @@ + diff --git a/res/values/strings.xml b/res/values/strings.xml index 4b24d7b..1441c73 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -16,4 +16,6 @@ Delete tunnel Pick a PKCS12 file from SD card No SD card present, please insert one to continue + Read logs + Reading log messages... diff --git a/src/hu/blint/ssldroid/SSLDroidGui.java b/src/hu/blint/ssldroid/SSLDroidGui.java index 17ed0bb..849d506 100644 --- a/src/hu/blint/ssldroid/SSLDroidGui.java +++ b/src/hu/blint/ssldroid/SSLDroidGui.java @@ -58,6 +58,9 @@ public class SSLDroidGui extends ListActivity { Log.d("SSLDroid", "Starting service"); startService(new Intent(this, SSLDroid.class)); return true; + case R.id.readlogs: + startService(new Intent(this, SSLDroid.class)); + return true; } return super.onMenuItemSelected(featureId, item); } diff --git a/src/hu/blint/ssldroid/SSLDroidReadLogs.java b/src/hu/blint/ssldroid/SSLDroidReadLogs.java new file mode 100644 index 0000000..32d1fc1 --- /dev/null +++ b/src/hu/blint/ssldroid/SSLDroidReadLogs.java @@ -0,0 +1,32 @@ +package hu.blint.ssldroid; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + +import android.app.Activity; +import android.os.Bundle; +import android.widget.TextView; + +public class SSLDroidReadLogs extends Activity{ + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.read_logs); + try { + Process process = Runtime.getRuntime().exec("logcat -d"); + BufferedReader bufferedReader = new BufferedReader( + new InputStreamReader(process.getInputStream())); + + StringBuilder log=new StringBuilder(); + String line; + while ((line = bufferedReader.readLine()) != null) { + log.append(line); + } + TextView tv = (TextView)findViewById(R.id.logTextView); + tv.setText(log.toString()); + } catch (IOException e) { + } + } +}