GrapheneOS / os-issue-tracker

Issue tracker for GrapheneOS Android Open Source Project hardening work. Standalone projects like Auditor, AttestationServer and hardened_malloc have their own dedicated trackers.
https://grapheneos.org/
355 stars 20 forks source link

Toggle to disable proximity sensor for selected apps #1695

Closed popogomo closed 1 year ago

popogomo commented 1 year ago

When using any messenger, for example, Signal, the proximity sensor turns on when listening to voice messages or using video chat in picture-in-picture mode.

As a result its impossible to navigate the phone during picture-in-picture calls or when listening to voice messages on the background as proximity sensor kicks in and turns off the screen every time it detects finger nearby (the sensor area is quite big in Pixel 7).

Revoking Sensor permissions from messengers doesn't help.

Is it possible to implement a dedicated toggle/permissions to disable proximity sensor for a specific app to fix the issue?

secretmango commented 1 year ago

Check if the permission "sensors" solves it. Under App settings, permissions, three dots top right menu, shows advanced view.

popogomo commented 1 year ago

Check if the permission "sensors" solves it. Under App settings, permissions, three dots top right menu, shows advanced view.

Thats the first thing I tried - no luck. My understanding is that "Sensor" toggle is responsible for gyroscope and other similar sensors, not proximity one. The only way to turn off proximity sensor is going to Developer menu - Quick settings tile - sensors and then it will add a tile to disable sensors. However, this is not a solution as this tile disables ALL sensors which means that, for example, bluetooth devices are not recognized by calling app.

We really need a dedicated option to specifically disable proximity sensor.

secretmango commented 1 year ago

Hm, Signal is not open source. Make sure to file an issue report at their Github repo. You can look at "simple dialer" which has a "turn off proximity sensor" integrated.

But yeah we are on Grapheneos, so no root, no XPosed modules, we have to trust in the apps to change that. You could try to build Signals apk from source and change that permission, or modify the apk from their website. You just always have to patch it when an update arrives.

esntngv commented 1 year ago

I use Signal intensively and I was also very annoyed by the problem that every time I came near the proximity sensor, the speaker switches and the display goes off.

I removed access to "Sensors" in the app settings and now Signal no longer registers when I get close to the proximity sensor, nothing happens.

esntngv commented 1 year ago

@popogomo I use a Pixel7Pro

esntngv commented 1 year ago

@popogomo I just switched it back and forth again and my description is 100% reproducible.

popogomo commented 1 year ago

Hm, Signal is not open source. Make sure to file an issue report at their Github repo. You can look at "simple dialer" which has a "turn off proximity sensor" integrated.

But yeah we are on Grapheneos, so no root, no XPosed modules, we have to trust in the apps to change that. You could try to build Signals apk from source and change that permission, or modify the apk from their website. You just always have to patch it when an update arrives.

Its not Signal issue. It happens with every messenger app - Whatsapp, Viber, Signal, Telegram, Session - I mentioned this in description. The proximity sensor triggers in when on calls or playing voice messages which makes it extremely hard to navigate when doing picture in picture calls or something else whilst listening to voice messages as the screen keeps turning off.

The Dialer app you are referring to only disables proximity sensor when using Dialer app, it has no effect on messengers.

It is possible to root GrapheneOS but it will make more harm then good, we should not root the phone for security reasons.

Hence the request is to add a dedicated toggle to disable proximity sensor so that we can apply it per app.

esntngv commented 1 year ago

@popogomo For me, the sensor also stops responding in Telegram and Whatsapp as soon as I deactivate "Sensors", it definitely can't be a general problem. I was therefore, as I said, also very annoyed until I changed it.

popogomo commented 1 year ago

@popogomo For me, the sensor also stops responding in Telegram and Whatsapp as soon as I deactivate "Sensors", it definitely can't be a general problem. I was therefore, as I said, also very annoyed until I changed it.

Disabling sensors doesn't do anything for me (sensors do not include proximity sensor). The only way to disable ALL sensors is from Developers menu but disabling ALL sensors causes issues witb Bluetooth connections, etc so not a feasable option.

thestinger commented 1 year ago

Sensors does include proximity sensor. Apps handling screen rotation, etc. aren't reading the sensor data themselves but rather using OS features handling it for them.

popogomo commented 1 year ago

Sensors does include proximity sensor. Apps handling screen rotation, etc. aren't reading the sensor data themselves but rather using OS features handling it for them.

Thanks for this.

Do you think its feasible/possible to add a proximity sensor toggle (even if it will disable proximity sensor system-wide) for situations like this? This whole proximity sensor thing makes it nearly impossible to use the phone whilst on picture-in-picture call or listening to voice messages.

JSchimmelpfennig commented 1 year ago

If I revoke the sensor access for the Signal app, the proximity sensor doesn't work anymore. I'm using a Pixel 6a. This is good for playing voice messages loud of when I'm on a phone call over Signal with my bluetooth headset, but for calls over the phone (not the loudspeaker) it would be good, if the sensor could be used.

But funny enough, when I play voice messages via WhatsApp after disabling the sensor access for WhatsApp, the proximity sensor is still active.

secretmango commented 1 year ago

@JSchimmelpfennig then you should ask Signal about that. Its not graphenes task to fix that behavior and change permissions depending on headphone connection state. Permissions are for security and not comfort, apps themselves can detect that state and change their behavior, for example VLCs awesome plug-and-play / disconnect-and-stop feature.

JSchimmelpfennig commented 1 year ago

Thank you for answering my question! I didn't know that am I'm going to forward that to the signal developers.

popogomo commented 1 year ago

As proximity is not controlled by Sensors permissions, each app can activate it whenever it wants to and we cannot disable it. This makes it very hard to listen to voice messages or talk and browse the phone as proximity sensor keeps kicking in and turns off the screen every minute. It will be great if we could have a dedicated permission or toggle to disable proximity sensor per app.

thestinger commented 1 year ago

Not able to reproduce any issues. Suggest reinstalling the app and disabling Sensors.

popogomo commented 1 year ago

I can record a footage demonstrating the issue if this helps?

meganjordan commented 5 months ago

This issue is still active so I would like to add:

Proximity sensor is useful specifically in non speakerphone non bluetooth phone calls. In no other situation is it useful. Yet, popular apps employ it in plenty of other situations. For many people, that means the majority of their interactions with proximity sensor based screen blackening are an inconvenience rather than an aid. Since so many apps have this bug/feature, an OS-side fix could be really useful for a lot of people, as it would fix this issue for potentially hundreds of apps at once.

For those of us who are willing to put up with the slight inconvenience of a lack of a proximity based display in those situations (maybe because I'm someone who never takes non speakerphone calls) it could be useful to literally just have a "disable proximity sensor" switch in the settings app. Even if such a switch disabled the proximity sensor for typical phone calls, the pros outweigh the cons for many people

As mentioned in previous comments, the Sensors permission for these apps does not impact this behavior, as the app receives proximity sensor data from the OS rather than by directly interfacing with the sensor. In Developer Options, one can disable the OS from interacting with any sensors whatsoever. This setting does actually address the problem. However it provides too many downsides, as it disables all sensors at once rather than allowing you to choose which sensors to disable. What people want is the ability to only disable the proximity sensor.

The current implementation means that in order to fix a bug that makes it impossible to tap the search bar on a web browser while on a speakerphone call, I must enable a setting which disallows me from using my microphone. You can understand how a lack of a microphone is an inconsiderable tradeoff for a proximity sensor issue that primarily affects voice calls.

All people are saying is this:

Feature request: Add a toggle in Developer Options which solely enables or disables the proximity sensor on the device on an OS-wide level.

thestinger commented 5 months ago

Proximity sensor is useful specifically in non speakerphone non bluetooth phone calls. In no other situation is it useful. Yet, popular apps employ it in plenty of other situations. For many people, that means the majority of their interactions with proximity sensor based screen blackening are an inconvenience rather than an aid. Since so many apps have this bug/feature, an OS-side fix could be really useful for a lot of people, as it would fix this issue for potentially hundreds of apps at once.

You should file issue reports with those app developers if they're doing something wrong.

As mentioned in previous comments, the Sensors permission for these apps does not impact this behavior, as the app receives proximity sensor data from the OS rather than by directly interfacing with the sensor. In Developer Options, one can disable the OS from interacting with any sensors whatsoever. This setting does actually address the problem. However it provides too many downsides, as it disables all sensors at once rather than allowing you to choose which sensors to disable. What people want is the ability to only disable the proximity sensor.

It does change this if apps are using the proximity sensor. Give an example where it doesn't work.

The current implementation means that in order to fix a bug that makes it impossible to tap the search bar on a web browser while on a speakerphone call, I must enable a setting which disallows me from using my microphone. You can understand how a lack of a microphone is an inconsiderable tradeoff for a prozimity sensor issue that primarily affects voice calls.

The included Dialer app doesn't use the proximity sensor to turn off the screen in speaker mode and it also doesn't apply to when you're using other apps.

thestinger commented 5 months ago

Feature request: Add a toggle in Developer Options which solely enables or disables the proximity sensor on the device on an OS-wide level.

We won't be adding new developer options and we recommend against having developer options enabled for production usage.

meganjordan commented 5 months ago

As mentioned in previous comments, the Sensors permission for these apps does not impact this behavior, as the app receives proximity sensor data from the OS rather than by directly interfacing with the sensor. In Developer Options, one can disable the OS from interacting with any sensors whatsoever. This setting does actually address the problem. However it provides too many downsides, as it disables all sensors at once rather than allowing you to choose which sensors to disable. What people want is the ability to only disable the proximity sensor.

It does change this if apps are using the proximity sensor. Give an example where it doesn't work.

open a signal call. connect bluetooth headphones to it. disable sensors on signal. attempt to hover finger near top of screen in signal app without screen turning black. it doesnt work.

edit: for some reason screen recording impacts the behavior. I suspect native screen recording disables the proximity sensor in order to not disturb the screen during the recording. a capture card might work instead to capture this issue.

meganjordan commented 5 months ago

Feature request: Add a toggle in Developer Options which solely enables or disables the proximity sensor on the device on an OS-wide level.

We won't be adding new developer options and we recommend against having developer options enabled for production usage.

It doesn't even have to be implemented as a Developer Option. That was my example because that was where the other working sensor toggle is. But early Android versions used to have this exact toggle in general settings under a subheading "Call settings". It doesn't seem unreasonable to do similar here if Dev Options is really the uncrossable line in this case.

secretmango commented 5 months ago

@meganjordan yes, this is really confusing and true.

Detecting if the phone has no cover may also be helpful for apps to track the behaviors of people.

Example: spam SMS messages when a person is right about to go to sleep.