mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-27 08:01:50 +01:00
Fixed connectivity issues, improved logging
This commit is contained in:
@@ -21,7 +21,6 @@ package eu.faircode.email;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
@@ -38,9 +37,13 @@ import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import javax.mail.Address;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
|
||||
public class Helper {
|
||||
static final String TAG = BuildConfig.APPLICATION_ID;
|
||||
static final String TAG = "fairemail";
|
||||
|
||||
static int resolveColor(Context context, int attr) {
|
||||
int[] attrs = new int[]{attr};
|
||||
@@ -102,37 +105,20 @@ public class Helper {
|
||||
return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);
|
||||
}
|
||||
|
||||
static StringBuilder getDebugInfo() {
|
||||
static StringBuilder getLogcat() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
// Get version info
|
||||
sb.append(String.format("%s: %s/%d\r\n", BuildConfig.APPLICATION_ID, BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE));
|
||||
sb.append(String.format("Android: %s (SDK %d)\r\n", Build.VERSION.RELEASE, Build.VERSION.SDK_INT));
|
||||
sb.append("\r\n");
|
||||
|
||||
// Get device info
|
||||
sb.append(String.format("Brand: %s\r\n", Build.BRAND));
|
||||
sb.append(String.format("Manufacturer: %s\r\n", Build.MANUFACTURER));
|
||||
sb.append(String.format("Model: %s\r\n", Build.MODEL));
|
||||
sb.append(String.format("Product: %s\r\n", Build.PRODUCT));
|
||||
sb.append(String.format("Device: %s\r\n", Build.DEVICE));
|
||||
sb.append(String.format("Host: %s\r\n", Build.HOST));
|
||||
sb.append(String.format("Display: %s\r\n", Build.DISPLAY));
|
||||
sb.append(String.format("Id: %s\r\n", Build.ID));
|
||||
sb.append("\r\n");
|
||||
|
||||
// Get logcat
|
||||
Process proc = null;
|
||||
BufferedReader br = null;
|
||||
try {
|
||||
String[] cmd = new String[]{"logcat", "-d", "-v", "threadtime"};
|
||||
String[] cmd = new String[]{"logcat", "-d", "-v", "threadtime", TAG + ":I"};
|
||||
proc = Runtime.getRuntime().exec(cmd);
|
||||
br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
|
||||
String line;
|
||||
while ((line = br.readLine()) != null)
|
||||
sb.append(line).append("\r\n");
|
||||
} catch (IOException ex) {
|
||||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
} finally {
|
||||
if (br != null)
|
||||
try {
|
||||
@@ -143,10 +129,14 @@ public class Helper {
|
||||
try {
|
||||
proc.destroy();
|
||||
} catch (Throwable ex) {
|
||||
Log.w(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
}
|
||||
}
|
||||
|
||||
return sb;
|
||||
}
|
||||
|
||||
static Address myAddress() throws UnsupportedEncodingException {
|
||||
return new InternetAddress("marcel+fairemail@faircode.eu", "FairCode");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user