[req] Disable Proximity Sensor

Search This thread

redball

New member
Jul 11, 2010
4
0
I've been trying to pour through the API and find a way I can access and disable the proximity sensor with some code, but have been unsuccessful.

Does anyone know of a way, rooted or unrooted, that I can disable the proximity sensor completely?

I searched the forums and the only ways I found seem applicable to WinMo based phones.

Heck, I'll pay for a way to do it, I hate the proximity sensor that much.

Even if someone knows of a way I could disconnect it by opening my phone, I might even spring for that - but obviously a software approach would be much more appreciated...

Thanks!
 

redball

New member
Jul 11, 2010
4
0
Why do you hate it, if I may ask?

It is unreliable, and I know it isn't just my phone because a number of people I know also have an HTC Incredible and it seems to behave just as erratically on theirs.

Based on the code I read through for Phone.apk or whatever, it seems like it is supposed to disable the proximity sensor when you're using bluetooth, just like when using the speakerphone - but it doesn't. I can't figure out why, and I noticed another thread floating around with users having the same issue.

I want to be able to use my phone while on a call and not have to worry about a shift in overhead light or something passing over the sensor and flipping the screen off while I'm trying to use it.

I would much prefer the ability to disable it entirely, and have full control of the screen off/on using the power button.

There was one app on the app store recommended in my searches that let's you lock the screen on and only go off based on orientation or something, but it doesn't seem to work for the HTC Incredible :(
 

drawde

Senior Member
Apr 23, 2007
238
2
Try screebl? Should keep your phone on based on orientation, I think even during a call? Not sure though.

Sent from my ADR6300 using XDA App
 

JTCGiants56

Senior Member
Jun 13, 2010
102
7
I'm right there with you on this. I really hate being on a call and having the screen turn off and have to shake the phone around to be able to end the call.
 

redball

New member
Jul 11, 2010
4
0
I'm right there with you on this. I really hate being on a call and having the screen turn off and have to shake the phone around to be able to end the call.

That's the worst! It's like it gets doubly worse just when I want to be able to hang up.

If it helps anyone...I found these links. (If you google for "mProximityWakeLock", and follow the first Stack Overflow link, it also has two links in it to PhoneApp.java and InCallScreen.java)

I tried making an app that just kept calling release(), but it ended up just creating force closes.
 

jazzgott

Senior Member
Apr 27, 2011
109
17
Cornwall
Xiaomi Mi 3
Lenovo Zuk Z1
I know this is not really about droid, but what proximity sensor also does is scale down CPU speed (even despite using setcpu) making Skype completely useless without a headset.

When you initialize a call - everything is cool.
If you hold your phone on your hand and use loudspeeker - it's cool.

As soon as you put it to close to your face/ear - not cool anymore. To the point where it's absolutely impossible...

Cheers!
 

ihtfp69

Senior Member
Feb 22, 2009
1,875
809
It does check for a headset plugged in, bluetooth audio or the speakerphone enabled. For bluetooth, it gets a code from a getState method. It only prevents the screen from turning off if it equals a specific state. All you have to do is force it to always be true.

You can also put this in the build.prop to completely disable it.

Code:
gsm.proximity.enable=false
 
Last edited:
  • Like
Reactions: cporeaux

picotoslb

Member
Aug 15, 2008
7
0
How i do this?

It does check for a headset plugged in, bluetooth audio or the speakerphone enabled. For bluetooth, it gets a code from a getState method. It only prevents the screen from turning off if it equals a specific state. All you have to do is force it to always be true.

You can also put this in the build.prop to completely disable it.

Code:
gsm.proximity.enable=false

I m a nerd....how i do this ? where i write this code in my htc desire?

Thanks
 

picotoslb

Member
Aug 15, 2008
7
0
1. you need to be rooted (if your on this forum and running miui you already are rooted) and have ES File Explorer downloaded from market.

2. open es file explorer and press menu then settings scroll all the way to the bottom and go to root options & turn on root explorer & mount file system

3. go back to the view of your sd card now on the top left there is a image of sd card click that. look for a folder named system and click there

4. in system scroll to bottom and look for a file called build.prop long press on this file and click copy now click the house at top left and paste the build.prop to your sd card


5. now go back to the system folder click on build.prop and you will get a selection of apps to pick from depending on what you have installed. pick es note editor

6. now that you in your build.prop scroll down and WHERE i put "gsm.proximity.enable=false" ? i write this code where? in the end? Where?

Thanks
 

Micke L

New member
Aug 9, 2011
1
0
Quick fix

I had a similar problem with my phone (Samsung Galaxy S2) when I put it in a waterproof box. The display went black when someone was calling, and it didn't reappear unless I opened the box and thereby deactivated the proximity sensor reading.

My quick fix is to put a piece of black electrical insulating tape over the sensor. Since the sensor basically is a light sensitive receiver looking for tiny reflections from a coded light source, total blackness will be read as "no near object".

But of course, a nice API call would be more elegant:)
 

zhdenny

Member
Jun 17, 2010
10
0
Bump....seriously.....I've been looking everywhere for a way to disable proximity sensor. I wish Tasker had a simple Disable/Enable toggle on this sensor
 

tiny4579

Inactive Recognized Developer
Jan 15, 2011
9,327
5,060
Follow the post at the top of this page.

Make a backup of your rom just in case.

In summary, if you have root explorer then here's how I'd do it.
1. Navigate to /system.
2. Click the button at the top that says Mount R/W.
3. Open the file called build.prop.
4. At the bottom of the file add a line that says:
gsm.proximity.enable=false.
5. Hit menu, save and exit, reboot

It should work. If it doesn't you still should be ok. If unsure go ahead and restore your backup.
 
  • Like
Reactions: gandroz

oleg1981

Senior Member
Nov 20, 2009
234
7
Montreal
have the same problem but with incredible s. the screen goes down until on other end some body will not put the phone down! iv trued the false method. it did nothing.
 
Apr 6, 2013
10
2
Disabling Proximity Sensor works!

It does check for a headset plugged in, bluetooth audio or the speakerphone enabled. For bluetooth, it gets a code from a getState method. It only prevents the screen from turning off if it equals a specific state. All you have to do is force it to always be true.

You can also put this in the build.prop to completely disable it.

Code:
gsm.proximity.enable=false

For all those who are looking for a solution to a faulty proximity sensor and nothing else works, I can tell you that modifying the build.prop as described does work!
I simply can now press the button to turn the screen on or off while on call instead of relying on faulty sensor. Very pleased.

This was done using HTC WILDFIRE S a510a running HTC Sense GingerBread 2.3.3 which has been rooted with CWM root through CWM custom recovery installed after unlocking the bootloader at the HTCDEV site. The program used was called Rom Toolbox Lite and I used the "build.prop Editor" feature to safely make the modification to the file.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    It does check for a headset plugged in, bluetooth audio or the speakerphone enabled. For bluetooth, it gets a code from a getState method. It only prevents the screen from turning off if it equals a specific state. All you have to do is force it to always be true.

    You can also put this in the build.prop to completely disable it.

    Code:
    gsm.proximity.enable=false
    1
    Follow the post at the top of this page.

    Make a backup of your rom just in case.

    In summary, if you have root explorer then here's how I'd do it.
    1. Navigate to /system.
    2. Click the button at the top that says Mount R/W.
    3. Open the file called build.prop.
    4. At the bottom of the file add a line that says:
    gsm.proximity.enable=false.
    5. Hit menu, save and exit, reboot

    It should work. If it doesn't you still should be ok. If unsure go ahead and restore your backup.