diff --git a/Opaque/src/main/java/com/undatech/opaque/util/LogcatReader.java b/Opaque/src/main/java/com/undatech/opaque/util/LogcatReader.java index 821d66362..6d6ee0449 100644 --- a/Opaque/src/main/java/com/undatech/opaque/util/LogcatReader.java +++ b/Opaque/src/main/java/com/undatech/opaque/util/LogcatReader.java @@ -1,5 +1,7 @@ package com.undatech.opaque.util; +import com.iiordanov.bVNC.Constants; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @@ -22,20 +24,26 @@ public LogcatReader() { logcatCommand.add(Integer.toString(id)); } - public String getMyLogcat() { - String logCatOutput = ""; - String line = ""; + public String getMyLogcat(int lines) { + ArrayList logCatLines = new ArrayList<>(Constants.LOGCAT_MAX_LINES); + StringBuilder logCatOutput = new StringBuilder(Constants.LOGCAT_MAX_LINES); + String line; try { Process p = new ProcessBuilder().command(logcatCommand).start(); BufferedReader buffReader = new BufferedReader(new InputStreamReader(p.getInputStream())); while ((line = buffReader.readLine()) != null) { - logCatOutput = logCatOutput + line + "\n"; + logCatLines.add(line + "\n"); } } catch (IOException e) { - android.util.Log.e (TAG, "Error obtaining output from logcat"); + android.util.Log.e(TAG, "Error obtaining output from logcat"); e.printStackTrace(); } - return logCatOutput; + + for (int i = Math.max(logCatLines.size() - Constants.LOGCAT_MAX_LINES, 0); i < logCatLines.size(); i++) { + logCatOutput.append(logCatLines.get(i)); + } + + return logCatOutput.toString(); } } diff --git a/bVNC/AndroidManifest.xml.aRDP b/bVNC/AndroidManifest.xml.aRDP index e46efc6ba..e1f101a15 100644 --- a/bVNC/AndroidManifest.xml.aRDP +++ b/bVNC/AndroidManifest.xml.aRDP @@ -2,7 +2,7 @@ + android:versionCode="114035" android:versionName="v4.0.3"> diff --git a/bVNC/AndroidManifest.xml.aSPICE b/bVNC/AndroidManifest.xml.aSPICE index 8fe80ee6e..5d19109e7 100644 --- a/bVNC/AndroidManifest.xml.aSPICE +++ b/bVNC/AndroidManifest.xml.aSPICE @@ -2,7 +2,7 @@ + android:versionCode="114035" android:versionName="v4.0.3"> diff --git a/bVNC/AndroidManifest.xml.bVNC b/bVNC/AndroidManifest.xml.bVNC index 26b0bf670..b4aef4e63 100644 --- a/bVNC/AndroidManifest.xml.bVNC +++ b/bVNC/AndroidManifest.xml.bVNC @@ -2,7 +2,7 @@ + android:versionCode="114035" android:versionName="v4.0.3"> + android:versionCode="114035" android:versionName="v4.0.3"> diff --git a/bVNC/AndroidManifest.xml.freeaSPICE b/bVNC/AndroidManifest.xml.freeaSPICE index 3dbe98b0d..2b0dfd424 100644 --- a/bVNC/AndroidManifest.xml.freeaSPICE +++ b/bVNC/AndroidManifest.xml.freeaSPICE @@ -2,7 +2,7 @@ + android:versionCode="114035" android:versionName="v4.0.3"> diff --git a/bVNC/AndroidManifest.xml.freebVNC b/bVNC/AndroidManifest.xml.freebVNC index 73367d669..d140f83d9 100644 --- a/bVNC/AndroidManifest.xml.freebVNC +++ b/bVNC/AndroidManifest.xml.freebVNC @@ -2,7 +2,7 @@ + android:versionCode="114035" android:versionName="v4.0.3"> diff --git a/bVNC/CHANGELOG-aRDP b/bVNC/CHANGELOG-aRDP index 48e0d41ad..a4dcc1d00 100644 --- a/bVNC/CHANGELOG-aRDP +++ b/bVNC/CHANGELOG-aRDP @@ -1,6 +1,7 @@ v4.0.3 - Fix for SD card redirection - Updated FreeRDP +- Updated OpenSSL - Updated sshlib v4.0.2 - Fixes for widget names diff --git a/bVNC/CHANGELOG-aSPICE b/bVNC/CHANGELOG-aSPICE index 04a47bc16..41e547ee8 100644 --- a/bVNC/CHANGELOG-aSPICE +++ b/bVNC/CHANGELOG-aSPICE @@ -1,5 +1,6 @@ v4.0.3 - Updated spice library +- Updated gnutls - Updated sshlib v4.0.2 - Fixes for widget names diff --git a/bVNC/src2/main/java/com/iiordanov/bVNC/Constants.java b/bVNC/src2/main/java/com/iiordanov/bVNC/Constants.java index 63d447fc6..2beba0e07 100644 --- a/bVNC/src2/main/java/com/iiordanov/bVNC/Constants.java +++ b/bVNC/src2/main/java/com/iiordanov/bVNC/Constants.java @@ -37,6 +37,7 @@ public class Constants { public static final int SOCKET_CONN_TIMEOUT = 30 * 1000; //30 sec public static final int DEFAULT_SSH_PORT = 22; + public static final int LOGCAT_MAX_LINES = 500; public static volatile int DEFAULT_PROTOCOL_PORT = 5900; public static final int DEFAULT_VNC_PORT = 5900; public static final int DEFAULT_RDP_PORT = 3389; diff --git a/bVNC/src2/main/java/com/iiordanov/bVNC/MainConfiguration.java b/bVNC/src2/main/java/com/iiordanov/bVNC/MainConfiguration.java index 3aab7bd44..ea0e1e393 100644 --- a/bVNC/src2/main/java/com/iiordanov/bVNC/MainConfiguration.java +++ b/bVNC/src2/main/java/com/iiordanov/bVNC/MainConfiguration.java @@ -136,7 +136,7 @@ public void onClick(View v) { public void onClick(View v) { LogcatReader logcatReader = new LogcatReader(); ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); - cm.setText(logcatReader.getMyLogcat()); + cm.setText(logcatReader.getMyLogcat(Constants.LOGCAT_MAX_LINES)); Toast.makeText(getBaseContext(), getResources().getString(R.string.log_copied), Toast.LENGTH_LONG).show(); }