Minor cleanup of wakelocks, extension ID backup

This commit is contained in:
arkon
2020-05-07 09:14:52 -04:00
parent 03baa21185
commit b4c7992726
8 changed files with 32 additions and 30 deletions

View File

@@ -147,6 +147,15 @@ val Context.connectivityManager: ConnectivityManager
val Context.powerManager: PowerManager
get() = getSystemService(Context.POWER_SERVICE) as PowerManager
/**
* Convenience method to acquire a partial wake lock.
*/
fun Context.acquireWakeLock(tag: String): PowerManager.WakeLock {
val wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "$tag:WakeLock")
wakeLock.acquire()
return wakeLock
}
/**
* Function used to send a local broadcast asynchronous
*