Merge "Move onRttInitiated callback onto TelephonyConnection handler."
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 488b43c..1cf35a5 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -144,6 +144,7 @@
private static final int MSG_REJECT = 21;
private static final int MSG_DTMF_DONE = 22;
private static final int MSG_MEDIA_ATTRIBUTES_CHANGED = 23;
+ private static final int MSG_ON_RTT_INITIATED = 24;
private static final String JAPAN_COUNTRY_CODE_WITH_PLUS_SIGN = "+81";
private static final String JAPAN_ISO_COUNTRY_CODE = "JP";
@@ -331,6 +332,15 @@
args.recycle();
}
break;
+ case MSG_ON_RTT_INITIATED:
+ if (mOriginalConnection != null) {
+ // if mOriginalConnection is null, the properties will get set when
+ // mOriginalConnection gets set.
+ updateConnectionProperties();
+ refreshConferenceSupported();
+ }
+ sendRttInitiationSuccess();
+ break;
}
}
};
@@ -752,13 +762,11 @@
@Override
public void onRttInitiated() {
- if (mOriginalConnection != null) {
- // if mOriginalConnection is null, the properties will get set when
- // mOriginalConnection gets set.
- updateConnectionProperties();
- refreshConferenceSupported();
- }
- sendRttInitiationSuccess();
+ Log.i(TelephonyConnection.this, "onRttInitiated: callId=%s", getTelecomCallId());
+ // Post RTT initiation to the Handler associated with this TelephonyConnection.
+ // This avoids a race condition where a call starts as RTT but ConnectionService call to
+ // handleCreateConnectionComplete happens AFTER the RTT status is reported to Telecom.
+ mHandler.obtainMessage(MSG_ON_RTT_INITIATED).sendToTarget();
}
@Override