mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 20:06:51 +03:00
Ensure we will always use Context#getSystemService
extension function provided by core-ktx
This commit is contained in:
parent
b18a8744b2
commit
7b017e4328
3 changed files with 5 additions and 2 deletions
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue