Debug info: MIUI autostart

This commit is contained in:
M66B 2023-08-29 21:08:41 +02:00
parent 0034267565
commit 20e5acdc95
2 changed files with 16 additions and 1 deletions

View File

@ -1595,6 +1595,19 @@ public class Helper {
}
}
static Boolean getMIUIAutostart(Context context) {
try {
Class<?> c = Class.forName("android.miui.AppOpsUtils");
Method m = c.getDeclaredMethod("getApplicationAutoStart", Context.class, String.class);
m.setAccessible(true);
Integer result = (Integer) m.invoke(null, context, context.getPackageName());
return (result != null && result.equals(0));
} catch (Throwable ex) {
Log.w(ex);
return null;
}
}
static String getUiModeType(Context context) {
try {
UiModeManager uimm = Helper.getSystemService(context, UiModeManager.class);

View File

@ -2005,7 +2005,9 @@ public class Log {
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 autostart = (miui != null && Helper.getMIUIAutostart(context));
sb.append(String.format("MIUI: %s autostart=%b\r\n",
miui == null ? "-" : miui, autostart));
boolean reporting = prefs.getBoolean("crash_reports", false);
if (reporting || BuildConfig.TEST_RELEASE) {