Check for Sony Stamina mode

This commit is contained in:
M66B
2021-09-12 18:15:00 +02:00
parent e39efc7759
commit c304f5cd11
4 changed files with 53 additions and 1 deletions

View File

@@ -985,6 +985,27 @@ public class Helper {
return "Blackview".equalsIgnoreCase(Build.MANUFACTURER);
}
static boolean isSony() {
return "sony".equalsIgnoreCase(Build.MANUFACTURER);
}
static boolean isStaminaEnabled(Context context) {
// https://dontkillmyapp.com/sony
if (BuildConfig.DEBUG)
return true;
if (!isSony())
return false;
try {
ContentResolver resolver = context.getContentResolver();
return (Settings.Secure.getInt(resolver, "somc.stamina_mode", 0) > 0);
} catch (Throwable ex) {
Log.e(ex);
return false;
}
}
static boolean isSurfaceDuo() {
return ("Microsoft".equalsIgnoreCase(Build.MANUFACTURER) && "Surface Duo".equals(Build.MODEL));
}
@@ -1003,6 +1024,7 @@ public class Helper {
// Vivo
isRealme() ||
isBlackview() ||
isSony() ||
BuildConfig.DEBUG);
}