Skip to content

Commit a11d778

Browse files
maniac103arnavgosain
authored andcommitted
Fix display of 'Dialing (waiting...)' state.
Change-Id: I8a659823dd61d452641c4ddb0f3141304b86d613
1 parent 307c6ba commit a11d778

2 files changed

Lines changed: 27 additions & 22 deletions

File tree

src/com/android/incallui/CallCardFragment.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,8 @@ public void setSecondaryImage(Drawable image) {
356356

357357
@Override
358358
public void setCallState(int state, Call.DisconnectCause cause, boolean bluetoothOn,
359-
String gatewayLabel, String gatewayNumber, boolean isHeldRemotely, int callType) {
359+
String gatewayLabel, String gatewayNumber, boolean isWaitingForRemoteSide,
360+
int callType) {
360361
String callStateLabel = null;
361362

362363
// If this is a video call then update the state of the VideoCallPanel
@@ -369,7 +370,7 @@ public void setCallState(int state, Call.DisconnectCause cause, boolean bluetoot
369370
}
370371

371372
// States other than disconnected not yet supported
372-
callStateLabel = getCallStateLabelFromState(state, cause, isHeldRemotely);
373+
callStateLabel = getCallStateLabelFromState(state, cause, isWaitingForRemoteSide);
373374

374375
Log.v(this, "setCallState " + callStateLabel);
375376
Log.v(this, "DisconnectCause " + cause);
@@ -502,7 +503,7 @@ private void setBluetoothOn(boolean onOff) {
502503
* cause of disconnect
503504
*/
504505
private String getCallStateLabelFromState(int state, Call.DisconnectCause cause,
505-
boolean isHeldRemotely) {
506+
boolean isWaitingForRemoteSide) {
506507
final Context context = getView().getContext();
507508
String callStateLabel = null; // Label to display as part of the call banner
508509

@@ -512,13 +513,13 @@ private String getCallStateLabelFromState(int state, Call.DisconnectCause cause,
512513
} else if (Call.State.ACTIVE == state) {
513514
// We normally don't show a "call state label" at all in
514515
// this state (but see below for some special cases).
515-
if (isHeldRemotely) {
516+
if (isWaitingForRemoteSide) {
516517
callStateLabel = context.getString(R.string.card_title_waiting_call);
517518
}
518519
} else if (Call.State.ONHOLD == state) {
519520
callStateLabel = context.getString(R.string.card_title_on_hold);
520521
} else if (Call.State.DIALING == state) {
521-
callStateLabel = context.getString(isHeldRemotely
522+
callStateLabel = context.getString(isWaitingForRemoteSide
522523
? R.string.card_title_dialing_waiting : R.string.card_title_dialing);
523524
} else if (Call.State.REDIALING == state) {
524525
callStateLabel = context.getString(R.string.card_title_redialing);

src/com/android/incallui/CallCardPresenter.java

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)