try harder at waking the device screen on at incoming calls

This commit is contained in:
tibbi 2022-08-08 19:12:26 +02:00
parent 7003d21d9e
commit 7be52f9af8
1 changed files with 12 additions and 0 deletions

View File

@ -46,6 +46,7 @@ class CallActivity : SimpleActivity() {
private var isCallEnded = false
private var callContact: CallContact? = null
private var proximityWakeLock: PowerManager.WakeLock? = null
private var screenOnWakeLock: PowerManager.WakeLock? = null
private var callDuration = 0
private val callContactAvatarHelper by lazy { CallContactAvatarHelper(this) }
private val callDurationHandler = Handler(Looper.getMainLooper())
@ -85,6 +86,10 @@ class CallActivity : SimpleActivity() {
super.onDestroy()
CallManager.removeListener(callCallback)
disableProximitySensor()
if (screenOnWakeLock?.isHeld == true) {
screenOnWakeLock!!.release()
}
}
override fun onBackPressed() {
@ -609,6 +614,13 @@ class CallActivity : SimpleActivity() {
} else {
window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD)
}
try {
val powerManager = getSystemService(Context.POWER_SERVICE) as PowerManager
screenOnWakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "com.simplemobiletools.dialer.pro:full_wake_lock")
screenOnWakeLock!!.acquire(5 * 1000L)
} catch (e: Exception) {
}
}
private fun enableProximitySensor() {