Added auto car mode

This commit is contained in:
M66B
2021-10-01 19:55:31 +02:00
parent 12479b7603
commit b96e9d8a89
4 changed files with 31 additions and 0 deletions

View File

@@ -25,6 +25,7 @@ import android.app.Dialog;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.UiModeManager;
import android.app.usage.UsageStatsManager;
import android.content.ContentResolver;
import android.content.Context;
@@ -1761,6 +1762,17 @@ public class Log {
.append(" night=").append(Helper.isNight(context))
.append("\r\n");
int mode;
try {
UiModeManager uimm =
(UiModeManager) context.getSystemService(Context.UI_MODE_SERVICE);
mode = uimm.getCurrentModeType();
} catch (Throwable ex) {
mode = -1;
Log.w(ex);
}
sb.append(String.format("In car=%b mode=%d\r\n", Helper.inCar(context), mode));
sb.append("ExactAlarms")
.append(" can=")
.append(AlarmManagerCompatEx.canScheduleExactAlarms(context))