Search code examples
androidtelephonytelephonymanagerproximitysensorandroid-dialer

Disable Proximity Sensor during call


I dropped my phone and looks like my proximity sensor no longer works reliably. It returns Near all the time. The problem is, the display turns off during call and I wont be able to use the number pad to enter pin or conference another call, or even disconnect the call. I found the Power button disconnect option in Accessibility settings and uses that now.

I tried to create an app that tries to obtain a full wakelock when a call is received hoping that it will keep the display on.

  • Created a broadcast receiver that invokes a service when the phone state changes to OFFHOOK

  • The service acquires a full wakelock and releases it only when phone state is IDLE.

But still, proximity sensor turns the display off. I used the isHeld() method to make sure that the lock is acquired. I used PowerManager's isScreenOn() method and it returned true even when the screen was off during the call. I tried to obtain the wakelocks every two second in a loop for testing, still the display won't come up.

I'm using a Nexus 5 Android version 4.4.4

Can anyone suggest an idea to override the proximity sensor behaviour? A root-required option is also fine.

Thanks!


Solution

  • Proximity Sensor Dial

    *#*#7378423#*#*
    

    1) Service Tests - (If present)

    2) Proximity Switch

    3) Test on sensor (Next to logo(top) of mobile)

    4) Yes if works, then u can keep on and proximity switch forever which gives beep all the time and consumes lot of battery

    OR

    4) No it doesn't work - Then simply clean the mobile screen or screen guard and clear the blocked screen from sensor. It works charm.

    Technically, Its not any software solution, but hardware solution will work.