mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 04:35:57 +00:00
Refactoring
This commit is contained in:
parent
a79a38ddec
commit
e146723948
1 changed files with 8 additions and 7 deletions
|
@ -422,13 +422,14 @@ public class Helper {
|
|||
}
|
||||
|
||||
static Boolean isIgnoringOptimizations(Context context) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||
if (pm == null)
|
||||
return null;
|
||||
return pm.isIgnoringBatteryOptimizations(BuildConfig.APPLICATION_ID);
|
||||
}
|
||||
return null;
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
|
||||
return null;
|
||||
|
||||
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||
if (pm == null)
|
||||
return null;
|
||||
|
||||
return pm.isIgnoringBatteryOptimizations(BuildConfig.APPLICATION_ID);
|
||||
}
|
||||
|
||||
static Integer getBatteryLevel(Context context) {
|
||||
|
|
Loading…
Reference in a new issue