Search in sources :

Example 1 with Connection

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);
    }
}
Also used : DisconnectCause(android.telecom.DisconnectCause) Connection(android.telecom.Connection)

Example 2 with Connection

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();
}
Also used : Connection(android.telecom.Connection) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 3 with Connection

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);
}
Also used : Connection(android.telecom.Connection) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 4 with Connection

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();
}
Also used : Connection(android.telecom.Connection) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 5 with Connection

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");
}
Also used : ArrayList(java.util.ArrayList) Connection(android.telecom.Connection) Map(java.util.Map) ReadableMap(com.facebook.react.bridge.ReadableMap) WritableNativeMap(com.facebook.react.bridge.WritableNativeMap) HashMap(java.util.HashMap) WritableMap(com.facebook.react.bridge.WritableMap) ReactMethod(com.facebook.react.bridge.ReactMethod)

Aggregations

Connection (android.telecom.Connection)47 Bundle (android.os.Bundle)15 DisconnectCause (android.telecom.DisconnectCause)14 PhoneAccountHandle (android.telecom.PhoneAccountHandle)14 ArrayList (java.util.ArrayList)14 Phone (com.android.internal.telephony.Phone)11 ImsPhoneConnection (com.android.internal.telephony.imsphone.ImsPhoneConnection)11 ImsPhone (com.android.internal.telephony.imsphone.ImsPhone)9 ReactMethod (com.facebook.react.bridge.ReactMethod)9 Context (android.content.Context)8 Uri (android.net.Uri)8 Call (com.android.internal.telephony.Call)7 GsmCdmaPhone (com.android.internal.telephony.GsmCdmaPhone)7 HashMap (java.util.HashMap)6 HashSet (java.util.HashSet)6 TelecomManager (android.telecom.TelecomManager)5 CarrierConfigManager (android.telephony.CarrierConfigManager)5 PhoneUtils (com.android.phone.PhoneUtils)5 List (java.util.List)5 ComponentName (android.content.ComponentName)4