Make it possible to disable proximity sensor during calls

There are phones out there with broken proximity sensors that always
report near, which causes every dialer app to turn off the screen
unconditionally during calls. As an owner of such a phone, this has been
driving me crazy.

This commit adds a new setting to disable the proximity sensor. By
default, this is turned off, preserving the current behaviour.
This commit is contained in:
Quantum
2021-09-22 18:25:47 -04:00
parent 8113972a19
commit f02f0b2e99
26 changed files with 59 additions and 1 deletions

View File

@ -342,7 +342,7 @@ class CallActivity : SimpleActivity() {
}
private fun initProximitySensor() {
if (proximityWakeLock == null || proximityWakeLock?.isHeld == false) {
if (!config.disableProximitySensor && (proximityWakeLock == null || proximityWakeLock?.isHeld == false)) {
val powerManager = getSystemService(Context.POWER_SERVICE) as PowerManager
proximityWakeLock = powerManager.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, "com.simplemobiletools.dialer.pro:wake_lock")
proximityWakeLock!!.acquire(10 * MINUTE_SECONDS * 1000L)