java/com/android/incallui/ProximitySensor.java
/** Called to keep track of the overall UI state. */
Called to keep track of the overall UI state.
Called to keep track of the overall UI state .
@Override
  public void onStateChange(InCallState oldState, InCallState newState, CallList callList) {
    boolean hasOngoingCall = InCallState.INCALL == newState && callList.hasLiveCall();
    boolean isOffhook = (InCallState.OUTGOING == newState) || hasOngoingCall;
    mHasIncomingCall = (InCallState.INCOMING == newState);
    mIsPhoneOutgoing = (InCallState.OUTGOING == newState);
    DialerCall activeCall = callList.getActiveCall();
    boolean isVideoCall = activeCall != null && activeCall.isVideoCall();
    if (isOffhook != mIsPhoneOffhook || mIsVideoCall != isVideoCall) {
      mIsPhoneOffhook = isOffhook;
      mIsVideoCall = isVideoCall;
      mOrientation = AccelerometerListener.ORIENTATION_UNKNOWN;
      mAccelerometerListener.enable(mIsPhoneOffhook);
      updateProxSpeaker();
      updateProximitySensorMode();
    }
    if (hasOngoingCall && InCallState.OUTGOING == oldState) {
      setProxSpeaker(mIsProxSensorFar);
    }
    if (mHasIncomingCall) {
      updateProximitySensorMode();
    }
  }
@ Override public void onStateChange ( InCallState oldState , InCallState newState , CallList callList ) { boolean hasOngoingCall = InCallState . INCALL == newState && callList . hasLiveCall ( ) ; boolean isOffhook = ( InCallState . OUTGOING == newState ) || hasOngoingCall ; mHasIncomingCall = ( InCallState . INCOMING == newState ) ; mIsPhoneOutgoing = ( InCallState . OUTGOING == newState ) ; DialerCall activeCall = callList . getActiveCall ( ) ; boolean isVideoCall = activeCall != null && activeCall . isVideoCall ( ) ; if ( isOffhook != mIsPhoneOffhook || mIsVideoCall != isVideoCall ) { mIsPhoneOffhook = isOffhook ; mIsVideoCall = isVideoCall ; mOrientation = AccelerometerListener . ORIENTATION_UNKNOWN ; mAccelerometerListener . enable ( mIsPhoneOffhook ) ; updateProxSpeaker ( ) ; updateProximitySensorMode ( ) ; } if ( hasOngoingCall && InCallState . OUTGOING == oldState ) { setProxSpeaker ( mIsProxSensorFar ) ; } if ( mHasIncomingCall ) { updateProximitySensorMode ( ) ; } }
Called to keep track of the overall UI state.
Called to keep track of the overall UI state .
// We ignore incoming state because we do not want to enable proximity // sensor during incoming call screen. We check hasLiveCall() because a disconnected call // can also put the in-call screen in the INCALL state.