Skip to content

Commit

Permalink
Revert "[2/2] InCallUI: let InCallUI handle proximity sensor for inco…
Browse files Browse the repository at this point in the history
…ming calls"

This reverts commit 012e415.

Change-Id: Ib12d7a0f1185ffa9e32d1283466b653d9d3c69d7
  • Loading branch information
Danesh authored and Gerrit Code Review committed Jun 22, 2015
1 parent 04cce3b commit 7948c5a
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/com/android/incallui/ProximitySensor.java
Expand Up @@ -47,7 +47,6 @@ 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;
Expand Down Expand Up @@ -91,7 +90,6 @@ public void onStateChange(InCallState oldState, InCallState newState, CallList c
// 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;
Expand All @@ -101,10 +99,6 @@ public void onStateChange(InCallState oldState, InCallState newState, CallList c

updateProximitySensorMode();
}

if (mHasIncomingCall) {
updateProximitySensorMode();
}
}

@Override
Expand Down Expand Up @@ -219,15 +213,15 @@ private synchronized void updateProximitySensorMode() {
.add("aud", AudioState.audioRouteToString(audioMode))
.toString());

if ((mIsPhoneOffhook || mHasIncomingCall) && !screenOnImmediately) {
if (mIsPhoneOffhook && !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 idle. We don't want any special proximity sensor
// behavior in this case.
// Phone is either idle, or ringing. We don't want any special proximity sensor
// behavior in either case.
TelecomAdapter.getInstance().turnOffProximitySensor(screenOnImmediately);
}
}
Expand Down

0 comments on commit 7948c5a

Please sign in to comment.