summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorblunden <blunden2@gmail.com>2018-04-24 22:19:30 +0200
committerBruno Martins <bgcngm@gmail.com>2018-09-06 15:56:49 +0200
commit4f712986f9406fd7b2bf55e01d502425dc7d3229 (patch)
treed0b14c4bc6562f22147437908eac6de07abfbf72
parent36f4b8a1743304be22bb08976d4bb9b1a9fd76c9 (diff)
downloadandroid_packages_apps_Dialer-4f712986f9406fd7b2bf55e01d502425dc7d3229.tar.gz
android_packages_apps_Dialer-4f712986f9406fd7b2bf55e01d502425dc7d3229.tar.bz2
android_packages_apps_Dialer-4f712986f9406fd7b2bf55e01d502425dc7d3229.zip
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
-rw-r--r--java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java7
-rw-r--r--java/com/android/incallui/res/values/lineage_config.xml20
2 files changed, 27 insertions, 0 deletions
diff --git a/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java b/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java
index 50f6ae695..adfb4ae8e 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.DialerCall.State;
import com.android.incallui.call.DialerCallListener;
+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
@@ -60,6 +62,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)) {
diff --git a/java/com/android/incallui/res/values/lineage_config.xml b/java/com/android/incallui/res/values/lineage_config.xml
new file mode 100644
index 000000000..e9a958de5
--- /dev/null
+++ b/java/com/android/incallui/res/values/lineage_config.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2018 The LineageOS Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <!-- Whether to check that the proximity is unblocked before showing the incoming call UI. -->
+ <bool name="config_answer_proximity_sensor_enabled">true</bool>
+</resources>