summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSantos Cordon <santoscordon@google.com>2014-09-02 17:08:48 -0700
committerSantos Cordon <santoscordon@google.com>2014-09-03 10:46:53 -0700
commit42cbdd4a6a02d3c8cd292e8a83d24264764c5d79 (patch)
tree2de6d8c783bcdb5f32d84335aefd74582c75f263
parente0635a6b20c639f505fa356b15b2b7d82e86ebf2 (diff)
Do not request prox sensor ON without an ongoing call.
Bug: 17323179 Change-Id: I34afc5e42ba1d5b559626b7d52b41e96af95b4f9
-rw-r--r--InCallUI/src/com/android/incallui/CallList.java8
-rw-r--r--InCallUI/src/com/android/incallui/ProximitySensor.java7
2 files changed, 12 insertions, 3 deletions
diff --git a/InCallUI/src/com/android/incallui/CallList.java b/InCallUI/src/com/android/incallui/CallList.java
index 0908b56ad..7f76cd5dd 100644
--- a/InCallUI/src/com/android/incallui/CallList.java
+++ b/InCallUI/src/com/android/incallui/CallList.java
@@ -282,6 +282,14 @@ public class CallList implements InCallPhoneListener {
return result;
}
+ public boolean hasLiveCall() {
+ Call call = getFirstCall();
+ if (call == null) {
+ return false;
+ }
+ return call != getDisconnectingCall() && call != getDisconnectedCall();
+ }
+
/**
* Returns the first call found in the call map with the specified call modification state.
* @param state The session modification state to search for.
diff --git a/InCallUI/src/com/android/incallui/ProximitySensor.java b/InCallUI/src/com/android/incallui/ProximitySensor.java
index 02de4fd22..5bde190c1 100644
--- a/InCallUI/src/com/android/incallui/ProximitySensor.java
+++ b/InCallUI/src/com/android/incallui/ProximitySensor.java
@@ -81,9 +81,10 @@ public class ProximitySensor implements AccelerometerListener.OrientationListene
@Override
public void onStateChange(InCallState oldState, InCallState newState, CallList callList) {
// We ignore incoming state because we do not want to enable proximity
- // sensor during incoming call screen
- boolean isOffhook = (InCallState.INCALL == newState
- || InCallState.OUTGOING == newState);
+ // sensor during incoming call screen. We check hasLiveCall() because a disconnected call
+ // can also put the in-call screen in the INCALL state.
+ boolean hasOngoingCall = InCallState.INCALL == newState && callList.hasLiveCall();
+ boolean isOffhook = (InCallState.OUTGOING == newState) || hasOngoingCall;
if (isOffhook != mIsPhoneOffhook) {
mIsPhoneOffhook = isOffhook;