Ensure we will always use Context#getSystemService extension function provided by core-ktx

This commit is contained in:
Benoit Marty 2020-08-11 12:42:32 +02:00
parent b18a8744b2
commit 7b017e4328
3 changed files with 5 additions and 2 deletions

View file

@ -169,3 +169,6 @@ enum class===76
### Do not import temporary legacy classes ### Do not import temporary legacy classes
import im.vector.matrix.android.internal.legacy.riot===3 import im.vector.matrix.android.internal.legacy.riot===3
import org.matrix.androidsdk.crypto.data===2 import org.matrix.androidsdk.crypto.data===2
### Use `Context#getSystemService` extension function provided by `core-ktx`
getSystemService\(Context

View file

@ -172,7 +172,7 @@ class CallService : VectorService(), WiredHeadsetStateReceiver.HeadsetEventListe
// turn the screen on for 3 seconds // turn the screen on for 3 seconds
// if (Matrix.getInstance(VectorApp.getInstance())!!.pushManager.isScreenTurnedOn) { // if (Matrix.getInstance(VectorApp.getInstance())!!.pushManager.isScreenTurnedOn) {
// try { // try {
// val pm = getSystemService(Context.POWER_SERVICE) as PowerManager // val pm = getSystemService<PowerManager>()!!
// val wl = pm.newWakeLock( // val wl = pm.newWakeLock(
// WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON or PowerManager.ACQUIRE_CAUSES_WAKEUP, // WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON or PowerManager.ACQUIRE_CAUSES_WAKEUP,
// CallService::class.java.simpleName) // CallService::class.java.simpleName)

View file

@ -442,7 +442,7 @@ class NotificationDrawerManager @Inject constructor(private val context: Context
/* /*
TODO TODO
if (Matrix.getInstance(VectorApp.getInstance())!!.pushManager.isScreenTurnedOn) { if (Matrix.getInstance(VectorApp.getInstance())!!.pushManager.isScreenTurnedOn) {
val pm = VectorApp.getInstance().getSystemService(Context.POWER_SERVICE) as PowerManager val pm = VectorApp.getInstance().getSystemService<PowerManager>()!!
val wl = pm.newWakeLock(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON or PowerManager.ACQUIRE_CAUSES_WAKEUP, val wl = pm.newWakeLock(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON or PowerManager.ACQUIRE_CAUSES_WAKEUP,
NotificationDrawerManager::class.java.name) NotificationDrawerManager::class.java.name)
wl.acquire(3000) wl.acquire(3000)