Battery optimizations: check smartwatch

pull/214/head
M66B 1 year ago
parent 0e71655c27
commit 870cf7fb7e

@ -187,6 +187,7 @@ public class Helper {
private static Boolean hasWebView = null; private static Boolean hasWebView = null;
private static Boolean hasPlayStore = null; private static Boolean hasPlayStore = null;
private static Boolean hasValidFingerprint = null; private static Boolean hasValidFingerprint = null;
private static Boolean isSmartwatch = null;
static final float LOW_LIGHT = 0.6f; static final float LOW_LIGHT = 0.6f;
@ -611,7 +612,7 @@ public class Helper {
static Boolean isIgnoringOptimizations(Context context) { static Boolean isIgnoringOptimizations(Context context) {
try { try {
if (isArc()) if (isArc() || isWatch(context))
return true; return true;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
@ -1563,6 +1564,25 @@ public class Helper {
return (Build.DEVICE != null) && Build.DEVICE.matches(".+_cheets|cheets_.+"); return (Build.DEVICE != null) && Build.DEVICE.matches(".+_cheets|cheets_.+");
} }
static boolean isWatch(Context context) {
if (isSmartwatch == null)
isSmartwatch = _isWatch(context);
return isSmartwatch;
}
private static boolean _isWatch(Context context) {
try {
UiModeManager uimm = Helper.getSystemService(context, UiModeManager.class);
if (uimm == null)
return false;
int uiModeType = uimm.getCurrentModeType();
return (uiModeType == Configuration.UI_MODE_TYPE_WATCH);
} catch (Throwable ex) {
Log.e(ex);
return false;
}
}
static boolean isStaminaEnabled(Context context) { static boolean isStaminaEnabled(Context context) {
// https://dontkillmyapp.com/sony // https://dontkillmyapp.com/sony
if (!isSony()) if (!isSony())

Loading…
Cancel
Save