Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 26c4fbb2 authored by wangqi's avatar wangqi Committed by Eric Erfanian
Browse files

Fix bug that proximity sensor is turned on too early.

This is caused by setting call state to OUTGOING after it's created but before
it's connecting, which incorrectly switches state as NO_CALL -> OUTGOING ->
PENDING_OUTGOING -> OUTGOING.
The fix is giving it PENDING_OUTGOING state if an outgoing call is initialized
but still not yet getting update from telecom to CONNECTING (in which case the
call will be IDLE state).

Bug: 62965119
Test: manual
PiperOrigin-RevId: 161594187
Change-Id: I02c8b4dcb0bfd5101bc69f48bb99c66d4831b72e
parent 4e707bb5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -852,7 +852,7 @@ public class InCallPresenter implements CallList.Listener {

    if (newState == InCallState.NO_CALLS) {
      if (mBoundAndWaitingForOutgoingCall) {
        return InCallState.OUTGOING;
        return InCallState.PENDING_OUTGOING;
      }
    }

@@ -870,7 +870,7 @@ public class InCallPresenter implements CallList.Listener {
    mBoundAndWaitingForOutgoingCall = isBound;
    mThemeColorManager.setPendingPhoneAccountHandle(handle);
    if (isBound && mInCallState == InCallState.NO_CALLS) {
      mInCallState = InCallState.OUTGOING;
      mInCallState = InCallState.PENDING_OUTGOING;
    }
  }

+4 −1
Original line number Diff line number Diff line
@@ -102,7 +102,10 @@ public class ProximitySensor
    // 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;
    boolean isOffhook =
        InCallState.PENDING_OUTGOING == newState
            || InCallState.OUTGOING == newState
            || hasOngoingCall;

    DialerCall activeCall = callList.getActiveCall();
    boolean isVideoCall = activeCall != null && activeCall.isVideoCall();