Commit f333f830 authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Do not show battery optimization notification when battery optimization is already disabled

parent 44345f1e
Pipeline #7673 passed with stage
in 4 minutes and 26 seconds
......@@ -177,6 +177,7 @@ class DnsVpnService : VpnService(), Runnable, CoroutineScope {
!getPreferences().ignoreServiceKilled &&
getPreferences().vpnLaunchLastVersion == BuildConfig.VERSION_CODE
) { // The app didn't stop properly
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.M|| !(getSystemService(POWER_SERVICE) as PowerManager).isIgnoringBatteryOptimizations(packageName)) {
val ignoreIntent = Intent(this, DnsVpnService::class.java).putExtra(
"command",
Command.IGNORE_SERVICE_KILLED
......@@ -220,6 +221,7 @@ class DnsVpnService : VpnService(), Runnable, CoroutineScope {
)
}
}
}
getPreferences().vpnServiceState = VpnServiceState.STARTED
getPreferences().vpnLaunchLastVersion = BuildConfig.VERSION_CODE
LeakSentry.watchIfEnabled(this, "DnsVpnService")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment