From c80366e5fd75d95dfcac43162ea9a2526fa4f900 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 13 Nov 2015 12:34:56 +0100 Subject: [PATCH 1/2] Destroy logcat process to prevent fbinfer warning --- app/src/main/java/eu/faircode/netguard/Util.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/netguard/Util.java b/app/src/main/java/eu/faircode/netguard/Util.java index 30613cf9..414d4ae0 100644 --- a/app/src/main/java/eu/faircode/netguard/Util.java +++ b/app/src/main/java/eu/faircode/netguard/Util.java @@ -214,10 +214,11 @@ public class Util { private static StringBuilder getLogcat(String tag) { String pid = Integer.toString(android.os.Process.myPid()); StringBuilder builder = new StringBuilder(); + Process process = null; BufferedReader br = null; try { String[] command = new String[]{"logcat", "-d", "-v", "threadtime"}; - Process process = Runtime.getRuntime().exec(command); + process = Runtime.getRuntime().exec(command); br = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; while ((line = br.readLine()) != null) @@ -233,6 +234,8 @@ public class Util { br.close(); } catch (IOException ignored) { } + if (process != null) + process.destroy(); } return builder; } From 906cb469d5ed3b0f92ab174af92e2d01d39ad4a5 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 13 Nov 2015 12:38:02 +0100 Subject: [PATCH 2/2] Allow logcat in debug builds --- .../eu/faircode/netguard/ActivityMain.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/eu/faircode/netguard/ActivityMain.java b/app/src/main/java/eu/faircode/netguard/ActivityMain.java index dfd9982d..576d862d 100644 --- a/app/src/main/java/eu/faircode/netguard/ActivityMain.java +++ b/app/src/main/java/eu/faircode/netguard/ActivityMain.java @@ -546,18 +546,17 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences tvLicense.setMovementMethod(LinkMovementMethod.getInstance()); // Handle logcat - if (Util.hasValidFingerprint(TAG, this)) - view.setOnClickListener(new View.OnClickListener() { - private short tap = 0; + view.setOnClickListener(new View.OnClickListener() { + private short tap = 0; - @Override - public void onClick(View view) { - if (++tap == 7) { - tap = 0; - Util.sendLogcat(TAG, ActivityMain.this); - } + @Override + public void onClick(View view) { + if (++tap == 7) { + tap = 0; + Util.sendLogcat(TAG, ActivityMain.this); } - }); + } + }); // Handle rate btnRate.setVisibility(getIntentRate(this).resolveActivity(getPackageManager()) == null ? View.GONE : View.VISIBLE);