get rid of outdated kernel version calculation code

This commit is contained in:
kosyak 2024-05-26 19:07:19 +02:00
parent 00606061ce
commit 379300bf02
2 changed files with 5 additions and 49 deletions

View file

@ -63,6 +63,7 @@ import java.util.regex.Pattern;
import eu.siacs.conversations.Config; import eu.siacs.conversations.Config;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
import eu.siacs.conversations.persistance.FileBackend;
import eu.siacs.conversations.services.BarcodeProvider; import eu.siacs.conversations.services.BarcodeProvider;
public class SendLogActivity extends ActionBarActivity { 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.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.message_subject));
mSendIntent.setType("text/plain"); 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"; mFormat = "time";
} }
@ -269,6 +270,7 @@ public class SendLogActivity extends ActionBarActivity {
log.insert(0, mAdditonalInfo); log.insert(0, mAdditonalInfo);
} }
android.util.Log.e("35fd", log.toString());
writer.write(log.toString()); writer.write(log.toString());
} }
catch (IOException e){ catch (IOException e){
@ -281,7 +283,7 @@ public class SendLogActivity extends ActionBarActivity {
@Override @Override
protected void onPostExecute(File logFile){ protected void onPostExecute(File logFile){
if (null != logFile){ if (null != logFile){
Uri uri = FileProvider.getUriForFile(SendLogActivity.this, getPackageName() + ".files", logFile); Uri uri = FileBackend.getUriForFile(SendLogActivity.this, logFile);
new ShareCompat new ShareCompat
.IntentBuilder(SendLogActivity.this) .IntentBuilder(SendLogActivity.this)
@ -377,50 +379,4 @@ public class SendLogActivity extends ActionBarActivity {
return version; 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";
}
}
} }

View file

@ -12,7 +12,7 @@ You also will have an opportunity to see and modify the data being sent."
Log Collector version: %1$s\n Log Collector version: %1$s\n
Device model: %2$s\n Device model: %2$s\n
Firmware version: %3$s\n Firmware version: %3$s\n
Kernel version: %4$s\n Firmware version code: %4$d\n
Build number: %5$s\n Build number: %5$s\n
</string> </string>
</resources> </resources>