Added UI mode to debug info

This commit is contained in:
M66B 2021-06-05 08:47:26 +02:00
parent 050c2b7ecf
commit 2ac4e0fa0f
2 changed files with 19 additions and 1 deletions

View File

@ -1014,7 +1014,7 @@ public class Helper {
static boolean isNight(Context context) {
// https://developer.android.com/guide/topics/ui/look-and-feel/darktheme#configuration_changes
int uiMode = context.getResources().getConfiguration().uiMode;
Log.i("UI mode=" + Integer.toHexString(uiMode));
Log.i("UI mode=0x" + Integer.toHexString(uiMode));
return ((uiMode & Configuration.UI_MODE_NIGHT_YES) != 0);
}

View File

@ -24,6 +24,7 @@ import android.app.ApplicationExitInfo;
import android.app.Dialog;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.UiModeManager;
import android.app.usage.UsageStatsManager;
import android.content.Context;
import android.content.DialogInterface;
@ -1684,6 +1685,23 @@ public class Log {
size.x / density, size.y / density,
context.getResources().getConfiguration().isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_NORMAL)));
int uiMode = context.getResources().getConfiguration().uiMode;
sb.append(String.format("UI mode: 0x"))
.append(Integer.toHexString(uiMode))
.append(" night")
.append(" no=").append((uiMode & Configuration.UI_MODE_NIGHT_NO) != 0)
.append(" yes=").append((uiMode & Configuration.UI_MODE_NIGHT_YES) != 0)
.append("\r\n");
UiModeManager uim = (UiModeManager) context.getSystemService(Context.UI_MODE_SERVICE);
int nightMode = uim.getNightMode();
sb.append(String.format("Night mode: 0x"))
.append(Integer.toHexString(nightMode))
.append(" no=").append((nightMode & UiModeManager.MODE_NIGHT_NO) != 0)
.append(" yes=").append((nightMode & UiModeManager.MODE_NIGHT_YES) != 0)
.append(" custom=").append((nightMode & UiModeManager.MODE_NIGHT_CUSTOM) != 0)
.append("\r\n");
try {
int maxKeySize = javax.crypto.Cipher.getMaxAllowedKeyLength("AES");
sb.append(context.getString(R.string.title_advanced_aes_key_size, maxKeySize)).append("\r\n");