@@ -209,27 +209,13 @@ public void onStateChange(InCallState state, CallList callList) {
209209 }
210210
211211 // Set the call state
212- final int callType = CallUtils .getCallType (mPrimary );
213-
214- if (mPrimary != null ) {
215- final boolean bluetoothOn =
216- (AudioModeProvider .getInstance ().getAudioMode () == AudioMode .BLUETOOTH );
217- ui .setCallState (mPrimary .getState (), mPrimary .getDisconnectCause (), bluetoothOn ,
218- getGatewayLabel (), getGatewayNumber (), mPrimary .isHeldRemotely (), callType );
219- } else {
220- ui .setCallState (Call .State .IDLE , Call .DisconnectCause .UNKNOWN ,
221- false , null , null , false , callType );
222- }
212+ updateCallState (mPrimary , AudioModeProvider .getInstance ().getAudioMode ());
223213 }
224214
225215 @ Override
226216 public void onAudioMode (int mode ) {
227217 if (mPrimary != null && getUi () != null ) {
228- final boolean bluetoothOn = (AudioMode .BLUETOOTH == mode );
229-
230- getUi ().setCallState (mPrimary .getState (), mPrimary .getDisconnectCause (), bluetoothOn ,
231- getGatewayLabel (), getGatewayNumber (), mPrimary .isHeldRemotely (),
232- CallUtils .getCallType (mPrimary ));
218+ updateCallState (mPrimary , mode );
233219 }
234220 }
235221
@@ -241,6 +227,23 @@ public void onSupportedAudioMode(int mask) {
241227 public void onMute (boolean muted ) {
242228 }
243229
230+ private void updateCallState (Call call , int audioMode ) {
231+ final int callType = CallUtils .getCallType (call );
232+ if (call == null ) {
233+ getUi ().setCallState (Call .State .IDLE , Call .DisconnectCause .UNKNOWN ,
234+ false , null , null , false , callType );
235+ return ;
236+ }
237+
238+ final boolean bluetoothOn = audioMode == AudioMode .BLUETOOTH ;
239+ final int state = call .getState ();
240+ final boolean isWaitingForRemoteSide =
241+ (state == Call .State .ACTIVE && call .isHeldRemotely ()) ||
242+ (state == Call .State .DIALING && call .isDialingWaiting ());
243+ getUi ().setCallState (call .getState (), call .getDisconnectCause (), bluetoothOn ,
244+ getGatewayLabel (), getGatewayNumber (), isWaitingForRemoteSide , callType );
245+ }
246+
244247 public void updateCallTime () {
245248 final CallCardUi ui = getUi ();
246249
@@ -520,7 +523,8 @@ void setSecondary(boolean show, String name, boolean nameIsNumber, String label,
520523 Drawable photo , boolean isConference , boolean isGeneric );
521524 void setSecondaryImage (Drawable image );
522525 void setCallState (int state , Call .DisconnectCause cause , boolean bluetoothOn ,
523- String gatewayLabel , String gatewayNumber , boolean isHeldRemotely , int callType );
526+ String gatewayLabel , String gatewayNumber ,
527+ boolean isWaitingForRemoteSide , int callType );
524528 void setPrimaryCallElapsedTime (boolean show , String duration );
525529 void setPrimaryName (String name , boolean nameIsNumber );
526530 void setPrimaryImage (Drawable image );
0 commit comments