mirror of
https://github.com/moparisthebest/SSLDroid
synced 2024-11-23 09:22:16 -05:00
Log view prototype (untested)
Signed-off-by: Balint Kovacs <blint@blint.hu>
This commit is contained in:
parent
5e276bf69c
commit
662d62d7bd
@ -2,6 +2,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="hu.blint.ssldroid" android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<uses-permission android:name="android.permission.READ_LOGS"></uses-permission>
|
||||
<application android:label="@string/app_name" android:icon="@drawable/icon">
|
||||
<activity android:name="SSLDroidGui" android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
|
7
res/layout/read_logs.xml
Normal file
7
res/layout/read_logs.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/reading_logs" android:id="@+id/logTextView"></TextView>
|
||||
</LinearLayout>
|
@ -4,4 +4,5 @@
|
||||
<item android:enabled="true" android:title="@string/add_tunnel" android:id="@+id/addtunnel" android:icon="@android:drawable/ic_menu_add"></item>
|
||||
|
||||
<item android:enabled="true" android:id="@+id/startservice" android:title="@string/start_service" android:icon="@android:drawable/ic_menu_manage"></item><item android:title="@string/stop_service" android:enabled="true" android:id="@+id/stopservice" android:icon="@android:drawable/ic_menu_close_clear_cancel"></item>
|
||||
<item android:title="@string/menu_readlogs" android:id="@+id/readlogs" android:icon="@android:drawable/ic_menu_agenda" android:enabled="true"></item>
|
||||
</menu>
|
||||
|
@ -16,4 +16,6 @@
|
||||
<string name="menu_delete">Delete tunnel</string>
|
||||
<string name="pkcsfile_pick">Pick a PKCS12 file from SD card</string>
|
||||
<string name="alert_sdcard_absent">No SD card present, please insert one to continue</string>
|
||||
<string name="menu_readlogs">Read logs</string>
|
||||
<string name="reading_logs">Reading log messages...</string>
|
||||
</resources>
|
||||
|
@ -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);
|
||||
}
|
||||
|
32
src/hu/blint/ssldroid/SSLDroidReadLogs.java
Normal file
32
src/hu/blint/ssldroid/SSLDroidReadLogs.java
Normal file
@ -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) {
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user