简体   繁体   English

在通话期间禁用接近传感器

[英]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 创建一个广播接收器,当电话状态变为OFFHOOK时调用服务

  • The service acquires a full wakelock and releases it only when phone state is IDLE. 该服务获得一个完整的唤醒锁,只有在手机状态为IDLE时才会释放它。

But still, proximity sensor turns the display off. 但是,接近传感器会关闭显示屏。 I used the isHeld() method to make sure that the lock is acquired. 我使用isHeld()方法来确保获取锁。 I used PowerManager's isScreenOn() method and it returned true even when the screen was off during the call. 我使用了PowerManager的isScreenOn()方法,即使在通话期间屏幕关闭时它也返回true。 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 我正在使用Nexus 5 Android版本4.4.4

Can anyone suggest an idea to override the proximity sensor behaviour? 任何人都可以建议超越接近传感器的行为吗? A root-required option is also fine. 根要求的选项也没关系。

Thanks! 谢谢!

I found my solution here . 我在这里找到了解决方案。 Basically use an app called Proximity Screen Off Lite and set it as below: 基本上使用名为Proximity Screen Off Lite的应用程序并将其设置如下:

  1. Screen On/Off Modes Check "Cover and hold to turn on Screen" Timeout: 1 second Check "Disable Accidentla Lock" Timeout: 4 seconds 屏幕开/关模式检查“盖住并按住以打开屏幕”超时:1秒检查“禁用事故锁定”超时:4秒

  2. All settings Check "Disable in Lanscape" Check "Lock phone on screen ON" 所有设置选中“在Lanscape中禁用”选中“在屏幕上锁定手机”

  3. [Advanced] Configure Sensore Select sensor: Proximity sensor Value when sensor covered: 0 Value when sensor un-covered: 1 [高级]配置Sensore Select传感器:接近传感器覆盖传感器时的值:0传感器未被覆盖时的值:1

I also had problem with proximity sensor (I shattered screen in that region on my Nexus 6, Android Marshmallow) and none of proposed solutions / third party apps worked when I tried to disable proximity sensor. 我也遇到了接近传感器的问题(我在Nexus 6,Android Marshmallow上的那个区域破碎了屏幕),当我试图禁用接近传感器时,没有提议的解决方案/第三方应用程序工作。 What worked for me was to calibrate the sensor using Proximity Sensor Reset/Repair . 对我有用的是使用接近传感器重置/修复校准传感器。 You have to follow the instruction in app (cover sensor and uncover it) and then restart your phone. 您必须按照应用程序中的说明(盖住传感器并将其揭开),然后重新启动手机。 Although my sensor is no longer behind the glass, it still showed slightly different results when covered / uncovered and recalibration did the job. 虽然我的传感器不再位于玻璃后面,但在覆盖/未覆盖时仍会显示略微不同的结果,并且重新校准完成了工作。

What I tried and didn't work? 我尝试过什么都没用? Proximity Screen Off Lite, Macrodroid and KinScreen. Proximity Screen Off Lite,Macrodroid和KinScreen。

What would've I tried had it still not worked? 如果它还没有奏效,我会尝试什么? [XPOSED] Sensor Disabler , but it requires you to be rooted and have Xposed Framework, so I'm really glad I've found the easier way. [XPOSED]传感器禁用器 ,但它需要你扎根并拥有Xposed框架,所以我很高兴我找到了更简单的方法。

I have been researching this for a while, tested and wrote apps. 我一直在研究这个,测试和编写应用程序。

If you have no option in Settings → Phone → Use proximity sensor , then the only choice, seem to be to disable or modify its settings in rooted devices. 如果您在Settings → Phone → Use proximity sensor没有选项,那么唯一的选择似乎是在根设备中禁用或修改其设置。

Also consider, that if you plug the headset, the screen will remain on :D 还要考虑一下,如果您插入耳机,屏幕将保持打开状态:D

After trying a whole bunch of fixes including: 尝试了一大堆修复后,包括:

  • Phone app's menu option (my phone did not have a option to disable) 手机应用程序的菜单选项(我的手机没有禁用选项)
  • Proximity Screen Off Lite (did not work) Proximity Screen Off Lite(无效)
  • Xposed Framework with sensor disabler (works till phone is rebooted or app updates) 带有传感器禁用器的Xposed Framework(直到手机重启或应用更新为止)
  • Macrodroid macro (Macrodroid does not run on my phone for some reason) Macrodroid宏(由于某种原因,Macrodroid无法在我的手机上运行)
  • put some tin foil in front of it?(i don't know what i was thinking) 在它前面放了一些锡纸?(我不知道我在想什么)

Here is My fix: I figured you cannot break it more so I opened up my phone and removed the proximity sensor all together from the motherboard. 这是我的修复:我想你不能打破它,所以我打开手机,从主板上一起取下接近传感器。 The sensor tester app now shows " no_value " where it use to give " Distance: 0 " and my screen no longer goes black after dialing. 传感器测试仪应用程序现在显示“ no_value ”,用于表示“ 距离:0 ”,拨号后我的屏幕不再变黑。 Please note I can only confirm this working on a Samsung I8190 Galaxy S III mini with CM MOD 5.1.1. 请注意我只能在使用CM MOD 5.1.1的三星I8190 Galaxy S III mini上进行确认。 Here is a picture of the device i removed: 这是我删除的设备的图片: 接近传感器 I have removed it using a SMD solder station's heat gun at 400 degrees, some tweezers and flux.But a sharp hobby knife might work too. 我已经使用SMD焊台的400度热风枪,一些镊子和助焊剂将其移除。但是一把锋利的爱好刀也可能起作用。

Proximity Sensor Dial 接近传感器拨号

*#*#7378423#*#*

1) Service Tests - (If present) 1)服务测试 - (如果存在)

2) Proximity Switch 2)接近开关

3) Test on sensor (Next to logo(top) of mobile) 3)传感器测试(移动设备徽标(顶部)旁边)

4) Yes if works, then u can keep on and proximity switch forever which gives beep all the time and consumes lot of battery 4)是的,如果工作,那么你可以永远保持和接近开关,一直发出嘟嘟声并消耗大量电池

OR 要么

4) No it doesn't work - Then simply clean the mobile screen or screen guard and clear the blocked screen from sensor. 4)不行不通 - 然后只需清洁移动屏幕或屏幕防护罩,并清除传感器上被阻挡的屏幕。 It works charm. 它很有魅力。

Technically, Its not any software solution, but hardware solution will work. 从技术上讲,它不是任何软件解决方案,但硬件解决方案将起作用。

If you have LineageOS 7.1.2 (and have root), try this solution from XDA. 如果您有LineageOS 7.1.2(并具有root权限),请尝试使用XDA中的解决方案。


After having tried all the solutions proposed here, none of which worked for my Nexus 4 (mako), I found one on XDA that solves the problem with the Android dialer (but not with other apps). 在尝试了这里提出的所有解决方案之后,没有一个适用于我的Nexus 4(mako),我在XDA上发现了一个解决Android拨号器问题(但不能与其他应用程序一起使用)。 Basically I downloaded a recompiled version of the Dialer.apk file, which simply ignores the proximity sensor and behaves in the same way as the stock dialer app does. 基本上我下载了Dialer.apk文件的重新编译版本,它只是忽略了接近传感器,其行为方式与股票拨号器应用程序相同。

Rename /system/priv-app/Dialer/Dialer.apk to something, then place the downloaded file to that folder. 将/system/priv-app/Dialer/Dialer.apk重命名为某个内容,然后将下载的文件放到该文件夹​​中。 After reboot, I had to install the new dialer manually (simply by clicking on it). 重启后,我不得不手动安装新的拨号器(只需点击它)。 So now the original app is replaced, and the calls should be handled by this new one. 所以现在原来的应用程序被替换了,调用应该由这个新应用程序处理。

[Downside: the new way to answer a call is by pulling down the status bar and clicking 'Answer' (or 'Dismiss'), the usual slider is missing. [下行方式:接听电话的新方法是通过拉下状态栏并单击“接听”(或“关闭”),通常的滑块丢失。 Also, you'll need to repeat this every time your Android updates to a newer version.] 此外,每次Android更新到新版本时,您都需要重复此操作。

edit build.prop in folder /system if below line is exist change the value and if not exist add this line and save.(device must be rooted) 编辑文件夹/系统中的build.prop如果存在以下行,则更改该值,如果不存在则添加此行并保存。(设备必须root)

ro.lge.proximity.delay=25
mot.proximity.delay=25  

Unfortunately my proximity sensor doesn't work, too (always returns 0.0 cm). 不幸的是,我的接近传感器也不起作用(总是返回0.0厘米)。 I found the way, but not easy one: you need to root your phone, install XPOSED framework and Sensor Disabler ( https://play.google.com/store/apps/details?id=com.mrchandler.disableprox ). 我找到了方法,但并不容易:你需要root手机,安装XPOSED框架和Sensor Disabler( https://play.google.com/store/apps/details?id=com.mrchandler.disableprox )。 You can mock proximity sensor return value in the app. 您可以在应用程序中模拟接近传感器返回值。 (eg always return 2.0 cm). (例如总是返回2.0厘米)。 Then your display will be always on during the call. 然后,您的显示屏将在通话期间始终打开。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM