mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 16:49:40 +01:00
Ensure serial handling of calling events and improve busy UX.
This commit is contained in:
committed by
Cody Henthorne
parent
7b24e66ed3
commit
ed9acd25f9
@@ -10,10 +10,10 @@ public enum CallState {
|
||||
/** Idle, setting up objects */
|
||||
IDLE,
|
||||
|
||||
/** Dialing. Outgoing call is signaling the remote peer */
|
||||
/** Dialing. Outgoing call is signaling the remote peer */
|
||||
DIALING,
|
||||
|
||||
/** Answering. Incoming call is responding to remote peer */
|
||||
/** Answering. Incoming call is responding to remote peer */
|
||||
ANSWERING,
|
||||
|
||||
/** Remote ringing. Outgoing call, ICE negotiation is complete */
|
||||
@@ -25,10 +25,9 @@ public enum CallState {
|
||||
/** Connected. Incoming/Outgoing call, the call is connected */
|
||||
CONNECTED,
|
||||
|
||||
/** Terminated. Incoming/Outgoing call, the call is terminated */
|
||||
/** Terminated. Incoming/Outgoing call, the call is terminated */
|
||||
TERMINATED,
|
||||
|
||||
/** Busy. Outgoing call received a busy notification */
|
||||
/** Busy. Outgoing call received a busy notification */
|
||||
RECEIVED_BUSY;
|
||||
|
||||
}
|
||||
|
||||
@@ -40,6 +40,10 @@ public final class RemotePeer implements Remote, Parcelable
|
||||
return callId;
|
||||
}
|
||||
|
||||
public void setCallId(@NonNull CallId callId) {
|
||||
this.callId = callId;
|
||||
}
|
||||
|
||||
public @NonNull CallState getState() {
|
||||
return callState;
|
||||
}
|
||||
@@ -73,21 +77,19 @@ public final class RemotePeer implements Remote, Parcelable
|
||||
return remotePeer != null && this.callId.equals(remotePeer.callId);
|
||||
}
|
||||
|
||||
public void dialing(@NonNull CallId callId) {
|
||||
public void dialing() {
|
||||
if (callState != CallState.IDLE) {
|
||||
throw new IllegalStateException("Cannot transition to DIALING from state: " + callState);
|
||||
}
|
||||
|
||||
this.callId = callId;
|
||||
this.callState = CallState.DIALING;
|
||||
}
|
||||
|
||||
public void answering(@NonNull CallId callId) {
|
||||
public void answering() {
|
||||
if (callState != CallState.IDLE) {
|
||||
throw new IllegalStateException("Cannot transition to ANSWERING from state: " + callState);
|
||||
}
|
||||
|
||||
this.callId = callId;
|
||||
this.callState = CallState.ANSWERING;
|
||||
}
|
||||
|
||||
@@ -99,14 +101,6 @@ public final class RemotePeer implements Remote, Parcelable
|
||||
this.callState = CallState.REMOTE_RINGING;
|
||||
}
|
||||
|
||||
public void receivedBusy() {
|
||||
if (callState != CallState.DIALING) {
|
||||
Log.w(TAG, "RECEIVED_BUSY from unexpected state: " + callState);
|
||||
}
|
||||
|
||||
this.callState = CallState.RECEIVED_BUSY;
|
||||
}
|
||||
|
||||
public void localRinging() {
|
||||
if (callState != CallState.ANSWERING) {
|
||||
throw new IllegalStateException("Cannot transition to LOCAL_RINGING from state: " + callState);
|
||||
@@ -123,6 +117,14 @@ public final class RemotePeer implements Remote, Parcelable
|
||||
this.callState = CallState.CONNECTED;
|
||||
}
|
||||
|
||||
public void receivedBusy() {
|
||||
if (callState != CallState.DIALING) {
|
||||
Log.w(TAG, "RECEIVED_BUSY from unexpected state: " + callState);
|
||||
}
|
||||
|
||||
this.callState = CallState.RECEIVED_BUSY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user