From 379300bf027120befc7c1def01758cc83edeb59b Mon Sep 17 00:00:00 2001 From: kosyak Date: Sun, 26 May 2024 19:07:19 +0200 Subject: [PATCH] get rid of outdated kernel version calculation code --- .../conversations/ui/SendLogActivity.java | 52 ++----------------- src/main/res/values/strings_logs_reporter.xml | 2 +- 2 files changed, 5 insertions(+), 49 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/SendLogActivity.java b/src/main/java/eu/siacs/conversations/ui/SendLogActivity.java index 98cb6df5b..7be1deeb3 100644 --- a/src/main/java/eu/siacs/conversations/ui/SendLogActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/SendLogActivity.java @@ -63,6 +63,7 @@ import java.util.regex.Pattern; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; +import eu.siacs.conversations.persistance.FileBackend; import eu.siacs.conversations.services.BarcodeProvider; public class SendLogActivity extends ActionBarActivity { @@ -150,7 +151,7 @@ public class SendLogActivity extends ActionBarActivity { mSendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.message_subject)); mSendIntent.setType("text/plain"); - mAdditonalInfo = getString(R.string.device_info_fmt, getVersionNumber(this), Build.MODEL, Build.VERSION.RELEASE, getFormattedKernelVersion(), Build.DISPLAY); + mAdditonalInfo = getString(R.string.device_info_fmt, getVersionNumber(this), Build.MODEL, Build.VERSION.RELEASE, android.os.Build.VERSION.SDK_INT, Build.DISPLAY); mFormat = "time"; } @@ -269,6 +270,7 @@ public class SendLogActivity extends ActionBarActivity { log.insert(0, mAdditonalInfo); } + android.util.Log.e("35fd", log.toString()); writer.write(log.toString()); } catch (IOException e){ @@ -281,7 +283,7 @@ public class SendLogActivity extends ActionBarActivity { @Override protected void onPostExecute(File logFile){ if (null != logFile){ - Uri uri = FileProvider.getUriForFile(SendLogActivity.this, getPackageName() + ".files", logFile); + Uri uri = FileBackend.getUriForFile(SendLogActivity.this, logFile); new ShareCompat .IntentBuilder(SendLogActivity.this) @@ -377,50 +379,4 @@ public class SendLogActivity extends ActionBarActivity { return version; } - - private String getFormattedKernelVersion() - { - String procVersionStr; - - try { - BufferedReader reader = new BufferedReader(new FileReader("/proc/version"), 256); - try { - procVersionStr = reader.readLine(); - } finally { - reader.close(); - } - - final String PROC_VERSION_REGEX = - "\\w+\\s+" + /* ignore: Linux */ - "\\w+\\s+" + /* ignore: version */ - "([^\\s]+)\\s+" + /* group 1: 2.6.22-omap1 */ - "\\(([^\\s@]+(?:@[^\\s.]+)?)[^)]*\\)\\s+" + /* group 2: (xxxxxx@xxxxx.constant) */ - "\\([^)]+\\)\\s+" + /* ignore: (gcc ..) */ - "([^\\s]+)\\s+" + /* group 3: #26 */ - "(?:PREEMPT\\s+)?" + /* ignore: PREEMPT (optional) */ - "(.+)"; /* group 4: date */ - - Pattern p = Pattern.compile(PROC_VERSION_REGEX); - Matcher m = p.matcher(procVersionStr); - - if (!m.matches()) { - Log.e(TAG, "Regex did not match on /proc/version: " + procVersionStr); - return "Unavailable"; - } else if (m.groupCount() < 4) { - Log.e(TAG, "Regex match on /proc/version only returned " + m.groupCount() - + " groups"); - return "Unavailable"; - } else { - return (new StringBuilder(m.group(1)).append("\n").append( - m.group(2)).append(" ").append(m.group(3)).append("\n") - .append(m.group(4))).toString(); - } - } catch (IOException e) { - Log.e(TAG, - "IO Exception when getting kernel version for Device Info screen", - e); - - return "Unavailable"; - } - } } \ No newline at end of file diff --git a/src/main/res/values/strings_logs_reporter.xml b/src/main/res/values/strings_logs_reporter.xml index b60f785a4..3757a0503 100644 --- a/src/main/res/values/strings_logs_reporter.xml +++ b/src/main/res/values/strings_logs_reporter.xml @@ -12,7 +12,7 @@ You also will have an opportunity to see and modify the data being sent." Log Collector version: %1$s\n Device model: %2$s\n Firmware version: %3$s\n -Kernel version: %4$s\n +Firmware version code: %4$d\n Build number: %5$s\n \ No newline at end of file