diff options
author | blunden <blunden2@gmail.com> | 2018-04-24 22:19:30 +0200 |
---|---|---|
committer | Michael Bestas <mkbestas@lineageos.org> | 2020-12-12 01:23:35 +0200 |
commit | bfe4feab452d934a862b4bf5e19472c6369b3558 (patch) | |
tree | 1129ad2eacd45127044c5ba1b5f55b4e6c67d47d /java/com/android/incallui/answerproximitysensor | |
parent | f7d515057b9754c9d5e75f781bb88078867b8425 (diff) |
Control dialer's incoming call proximity sensor check via an overlay
This feature can't be used on devices with proximity sensors that don't
work when the screen is off, e.g. sensors using ultrasound technology.
The result in those cases is a black screen with just the status bar
showing, instead of the normal incoming call UI.
Make it possible to opt-out via an overlay.
Change-Id: Ic3848d09e1ed80e5409cbecbaca2517db16ed0b8
Diffstat (limited to 'java/com/android/incallui/answerproximitysensor')
-rw-r--r-- | java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java b/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java index 8aeb05fea..dbb8df9d5 100644 --- a/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java +++ b/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java @@ -27,6 +27,8 @@ import com.android.incallui.call.DialerCall; import com.android.incallui.call.DialerCallListener; import com.android.incallui.call.state.DialerCallState; +import com.android.incallui.R; + /** * This class prevents users from accidentally answering calls by keeping the screen off until the * proximity sensor is unblocked. If the screen is already on or if this is a call waiting call then @@ -61,6 +63,11 @@ public class AnswerProximitySensor return false; } + if (!context.getResources().getBoolean(R.bool.config_answer_proximity_sensor_enabled)) { + LogUtil.i("AnswerProximitySensor.shouldUse", "disabled by overlay"); + return false; + } + if (!context .getSystemService(PowerManager.class) .isWakeLockLevelSupported(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK)) { |