mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-03 10:16:45 +00:00
Added UI mode type to debug info
This commit is contained in:
parent
65b495e9f0
commit
1be2e31a0d
2 changed files with 34 additions and 0 deletions
|
@ -26,6 +26,7 @@ import android.Manifest;
|
|||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.KeyguardManager;
|
||||
import android.app.UiModeManager;
|
||||
import android.app.usage.UsageStatsManager;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ComponentName;
|
||||
|
@ -1041,6 +1042,37 @@ public class Helper {
|
|||
return (Build.VERSION.SDK_INT > Build.VERSION_CODES.R && false);
|
||||
}
|
||||
|
||||
static String getUiModeType(Context context) {
|
||||
try {
|
||||
UiModeManager uimm =
|
||||
(UiModeManager) context.getSystemService(Context.UI_MODE_SERVICE);
|
||||
int uiModeType = uimm.getCurrentModeType();
|
||||
switch (uiModeType) {
|
||||
case Configuration.UI_MODE_TYPE_UNDEFINED:
|
||||
return "undefined";
|
||||
case Configuration.UI_MODE_TYPE_NORMAL:
|
||||
return "normal";
|
||||
case Configuration.UI_MODE_TYPE_DESK:
|
||||
return "desk";
|
||||
case Configuration.UI_MODE_TYPE_CAR:
|
||||
return "car";
|
||||
case Configuration.UI_MODE_TYPE_TELEVISION:
|
||||
return "television";
|
||||
case Configuration.UI_MODE_TYPE_APPLIANCE:
|
||||
return "applicance";
|
||||
case Configuration.UI_MODE_TYPE_WATCH:
|
||||
return "watch";
|
||||
case Configuration.UI_MODE_TYPE_VR_HEADSET:
|
||||
return "vr headset";
|
||||
default:
|
||||
return Integer.toString(uiModeType);
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.w(ex);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static void reportNoViewer(Context context, Uri uri) {
|
||||
reportNoViewer(context, new Intent().setData(uri));
|
||||
}
|
||||
|
|
|
@ -1761,6 +1761,8 @@ public class Log {
|
|||
.append(" night=").append(Helper.isNight(context))
|
||||
.append("\r\n");
|
||||
|
||||
sb.append(String.format("UI type: %s\r\n", Helper.getUiModeType(context)));
|
||||
|
||||
sb.append("ExactAlarms")
|
||||
.append(" can=")
|
||||
.append(AlarmManagerCompatEx.canScheduleExactAlarms(context))
|
||||
|
|
Loading…
Reference in a new issue