summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordankoman <dankoman30@gmail.com>2015-02-05 16:52:00 +0100
committerGerrit Code Review <gerrit@cyanogenmod.org>2015-02-11 23:38:15 +0000
commit012e415ff186ac49ba622d98bc991ffac14bbc5d (patch)
tree30905dbb4dedb10c2b359ad1851a10ffbc44e00c
parent85d03809879978c95f605300e162aa94ab2c57ca (diff)
downloadpackages_apps_InCallUI-012e415ff186ac49ba622d98bc991ffac14bbc5d.tar.gz
packages_apps_InCallUI-012e415ff186ac49ba622d98bc991ffac14bbc5d.tar.bz2
packages_apps_InCallUI-012e415ff186ac49ba622d98bc991ffac14bbc5d.zip
[2/2] InCallUI: let InCallUI handle proximity sensor for incoming calls
fixes "while 'prevent accidental wake-up' is on, proximity sensor doesn't control screen state on incoming call. must manually turn on screen to see who's calling." Change-Id: I91729adc9d49f30d9340e91259638687ca6ab50a
-rw-r--r--src/com/android/incallui/ProximitySensor.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/com/android/incallui/ProximitySensor.java b/src/com/android/incallui/ProximitySensor.java
index f32bee9d..6acdf914 100644
--- a/src/com/android/incallui/ProximitySensor.java
+++ b/src/com/android/incallui/ProximitySensor.java
@@ -47,6 +47,7 @@ public class ProximitySensor implements AccelerometerListener.OrientationListene
private final AccelerometerListener mAccelerometerListener;
private int mOrientation = AccelerometerListener.ORIENTATION_UNKNOWN;
private boolean mUiShowing = false;
+ private boolean mHasIncomingCall = false;
private boolean mIsPhoneOffhook = false;
private boolean mDialpadVisible;
private Context mContext;
@@ -90,6 +91,7 @@ public class ProximitySensor implements AccelerometerListener.OrientationListene
// can also put the in-call screen in the INCALL state.
boolean hasOngoingCall = InCallState.INCALL == newState && callList.hasLiveCall();
boolean isOffhook = (InCallState.OUTGOING == newState) || hasOngoingCall;
+ mHasIncomingCall = (InCallState.INCOMING == newState);
if (isOffhook != mIsPhoneOffhook) {
mIsPhoneOffhook = isOffhook;
@@ -99,6 +101,10 @@ public class ProximitySensor implements AccelerometerListener.OrientationListene
updateProximitySensorMode();
}
+
+ if (mHasIncomingCall) {
+ updateProximitySensorMode();
+ }
}
@Override
@@ -213,15 +219,15 @@ public class ProximitySensor implements AccelerometerListener.OrientationListene
.add("aud", AudioState.audioRouteToString(audioMode))
.toString());
- if (mIsPhoneOffhook && !screenOnImmediately) {
+ if ((mIsPhoneOffhook || mHasIncomingCall) && !screenOnImmediately) {
Log.d(this, "Turning on proximity sensor");
// Phone is in use! Arrange for the screen to turn off
// automatically when the sensor detects a close object.
TelecomAdapter.getInstance().turnOnProximitySensor();
} else {
Log.d(this, "Turning off proximity sensor");
- // Phone is either idle, or ringing. We don't want any special proximity sensor
- // behavior in either case.
+ // Phone is idle. We don't want any special proximity sensor
+ // behavior in this case.
TelecomAdapter.getInstance().turnOffProximitySensor(screenOnImmediately);
}
}