mirror of https://github.com/M66B/FairEmail.git
Get MIUI version
This commit is contained in:
parent
74eff71cae
commit
0034267565
|
@ -148,6 +148,7 @@ import java.io.InputStream;
|
|||
import java.io.OutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
|
@ -1582,6 +1583,18 @@ public class Helper {
|
|||
return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S);
|
||||
}
|
||||
|
||||
static String getMIUIVersion() {
|
||||
try {
|
||||
Class<?> c = Class.forName("android.os.SystemProperties");
|
||||
Method get = c.getMethod("get", String.class);
|
||||
String miui = (String) get.invoke(c, "ro.miui.ui.version.code");
|
||||
return (TextUtils.isEmpty(miui) ? null : miui);
|
||||
} catch (Throwable ex) {
|
||||
Log.w(ex);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static String getUiModeType(Context context) {
|
||||
try {
|
||||
UiModeManager uimm = Helper.getSystemService(context, UiModeManager.class);
|
||||
|
|
|
@ -2004,6 +2004,9 @@ public class Log {
|
|||
sb.append(String.format("Android: %s (SDK device=%d target=%d)\r\n",
|
||||
Build.VERSION.RELEASE, Build.VERSION.SDK_INT, Helper.getTargetSdk(context)));
|
||||
|
||||
String miui = Helper.getMIUIVersion();
|
||||
sb.append(String.format("MIUI: %s\r\n", miui == null ? "-" : miui));
|
||||
|
||||
boolean reporting = prefs.getBoolean("crash_reports", false);
|
||||
if (reporting || BuildConfig.TEST_RELEASE) {
|
||||
String uuid = prefs.getString("uuid", null);
|
||||
|
|
Loading…
Reference in New Issue