Respect battery optimization setting when auto-updating
* Don't enable auto-install for updates if battery optimization permission is not granted during onboarding. * Drop showing warning in toolbar, show it instead if they want auto-install * Don't check for the same during downloads. Failing is better instead. Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -177,7 +177,9 @@ fun Context.accentColor(): Int {
|
||||
}
|
||||
|
||||
fun Context.isIgnoringBatteryOptimizations(): Boolean {
|
||||
if (!isMAndAbove()) return true
|
||||
return !(getSystemService(Context.POWER_SERVICE) as PowerManager)
|
||||
.isIgnoringBatteryOptimizations(packageName)
|
||||
return if (isMAndAbove()) {
|
||||
(getSystemService(Context.POWER_SERVICE) as PowerManager).isIgnoringBatteryOptimizations(packageName)
|
||||
} else {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user