use of android.telecom.Connection in project android_vendor_qcom_opensource_packages_apps_Bluetooth by NusantaraProject-ROM.
the class HfpClientDeviceBlock method updateConferenceableConnections.
// Updates any conferencable connections.
private void updateConferenceableConnections() {
boolean addConf = false;
if (DBG) {
Log.d(mTAG, "Existing connections: " + mConnections + " existing conference " + mConference);
}
// connections that may have switched from conference -> non-conference.
if (mConference != null) {
for (Connection confConn : mConference.getConnections()) {
if (!((HfpClientConnection) confConn).inConference()) {
if (DBG) {
Log.d(mTAG, "Removing connection " + confConn + " from conference.");
}
mConference.removeConnection(confConn);
}
}
}
// connection is maintained by the UUID.
for (Connection otherConn : mConnections.values()) {
if (((HfpClientConnection) otherConn).inConference()) {
// If this is the first connection with conference, create the conference first.
if (mConference == null) {
mConference = new HfpClientConference(mPhoneAccount.getAccountHandle(), mDevice, mHeadsetProfile);
}
if (mConference.addConnection(otherConn)) {
if (DBG) {
Log.d(mTAG, "Adding connection " + otherConn + " to conference.");
}
addConf = true;
}
}
}
// If we have no connections in the conference we should simply end it.
if (mConference != null && mConference.getConnections().size() == 0) {
if (DBG) {
Log.d(mTAG, "Conference has no connection, destroying");
}
mConference.setDisconnected(new DisconnectCause(DisconnectCause.LOCAL));
mConference.destroy();
mConference = null;
}
// If we have a valid conference and not previously added then add it.
if (mConference != null && addConf) {
if (DBG) {
Log.d(mTAG, "Adding conference to stack.");
}
mConnServ.addConference(mConference);
}
}
use of android.telecom.Connection in project react-native-callkeep by react-native-webrtc.
the class RNCallKeepModule method setCurrentCallActive.
@ReactMethod
public void setCurrentCallActive(String uuid) {
Log.d(TAG, "[RNCallKeepModule] setCurrentCallActive, uuid: " + uuid);
Connection conn = VoiceConnectionService.getConnection(uuid);
if (conn == null) {
Log.w(TAG, "[RNCallKeepModule] setCurrentCallActive ignored because no connection found, uuid: " + uuid);
return;
}
conn.setConnectionCapabilities(conn.getConnectionCapabilities() | Connection.CAPABILITY_HOLD);
conn.setActive();
}
use of android.telecom.Connection in project react-native-callkeep by react-native-webrtc.
the class RNCallKeepModule method endCall.
@ReactMethod
public void endCall(String uuid) {
Log.d(TAG, "[RNCallKeepModule] endCall called, uuid: " + uuid);
if (!isConnectionServiceAvailable() || !hasPhoneAccount()) {
Log.w(TAG, "[RNCallKeepModule] endCall ignored due to no ConnectionService or no phone account");
return;
}
Connection conn = VoiceConnectionService.getConnection(uuid);
if (conn == null) {
Log.w(TAG, "[RNCallKeepModule] endCall ignored because no connection found, uuid: " + uuid);
return;
}
conn.onDisconnect();
Log.d(TAG, "[RNCallKeepModule] endCall executed, uuid: " + uuid);
}
use of android.telecom.Connection in project react-native-callkeep by react-native-webrtc.
the class RNCallKeepModule method answerIncomingCall.
@ReactMethod
public void answerIncomingCall(String uuid) {
Log.d(TAG, "[RNCallKeepModule] answerIncomingCall, uuid: " + uuid);
if (!isConnectionServiceAvailable() || !hasPhoneAccount()) {
Log.w(TAG, "[RNCallKeepModule] answerIncomingCall ignored due to no ConnectionService or no phone account");
return;
}
Connection conn = VoiceConnectionService.getConnection(uuid);
if (conn == null) {
Log.w(TAG, "[RNCallKeepModule] answerIncomingCall ignored because no connection found, uuid: " + uuid);
return;
}
conn.onAnswer();
}
use of android.telecom.Connection in project react-native-callkeep by react-native-webrtc.
the class RNCallKeepModule method endAllCalls.
@ReactMethod
public void endAllCalls() {
Log.d(TAG, "[RNCallKeepModule] endAllCalls called");
if (!isConnectionServiceAvailable() || !hasPhoneAccount()) {
Log.w(TAG, "[RNCallKeepModule] endAllCalls ignored due to no ConnectionService or no phone account");
return;
}
ArrayList<Map.Entry<String, VoiceConnection>> connections = new ArrayList<Map.Entry<String, VoiceConnection>>(VoiceConnectionService.currentConnections.entrySet());
for (Map.Entry<String, VoiceConnection> connectionEntry : connections) {
Connection connectionToEnd = connectionEntry.getValue();
connectionToEnd.onDisconnect();
}
Log.d(TAG, "[RNCallKeepModule] endAllCalls executed");
}
Aggregations