Example usage for android.telecom VideoProfile STATE_BIDIRECTIONAL

List of usage examples for android.telecom VideoProfile STATE_BIDIRECTIONAL

Introduction

In this page you can find the example usage for android.telecom VideoProfile STATE_BIDIRECTIONAL.

Prototype

int STATE_BIDIRECTIONAL

To view the source code for android.telecom VideoProfile STATE_BIDIRECTIONAL.

Click Source Link

Document

Video signal is bi-directional.

Usage

From source file:Main.java

/**
 * Converts the call type to string/*from  w  w w.j a v a2  s.c  o m*/
 */
public static String callTypeToString(int callType) {
    switch (callType) {
    case VideoProfile.STATE_BIDIRECTIONAL:
        return "VT";
    case VideoProfile.STATE_TX_ENABLED:
        return "VT_TX";
    case VideoProfile.STATE_RX_ENABLED:
        return "VT_RX";
    }
    return "";
}

From source file:com.mobileglobe.android.customdialer.common.CallUtil.java

/**
 * A variant of {@link #getCallIntent} for starting a video call.
 *//*from   w  ww  .ja va2s. c om*/
public static Intent getVideoCallIntent(String number, String callOrigin) {
    final Intent intent = new Intent(Intent.ACTION_CALL, getCallUri(number));
    intent.putExtra(TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE, VideoProfile.STATE_BIDIRECTIONAL);
    if (!TextUtils.isEmpty(callOrigin)) {
        intent.putExtra(PhoneConstants.EXTRA_CALL_ORIGIN, callOrigin);
    }
    return intent;
}

From source file:com.android.server.telecom.testapps.TestConnectionService.java

@Override
public Connection onCreateOutgoingConnection(PhoneAccountHandle connectionManagerAccount,
        final ConnectionRequest originalRequest) {

    final Uri handle = originalRequest.getAddress();
    String number = originalRequest.getAddress().getSchemeSpecificPart();
    log("call, number: " + number);

    // Crash on 555-DEAD to test call service crashing.
    if ("5550340".equals(number)) {
        throw new RuntimeException("Goodbye, cruel world.");
    }/*from w w w  . j  a  va2 s.  c om*/

    Bundle extras = originalRequest.getExtras();
    String gatewayPackage = extras.getString(TelecomManager.GATEWAY_PROVIDER_PACKAGE);
    Uri originalHandle = extras.getParcelable(TelecomManager.GATEWAY_ORIGINAL_ADDRESS);

    log("gateway package [" + gatewayPackage + "], original handle [" + originalHandle + "]");

    final TestConnection connection = new TestConnection(false /* isIncoming */);
    setAddress(connection, handle);

    // If the number starts with 555, then we handle it ourselves. If not, then we
    // use a remote connection service.
    // TODO: Have a special phone number to test the account-picker dialog flow.
    if (number != null && number.startsWith("555")) {
        // Normally we would use the original request as is, but for testing purposes, we are
        // adding ".." to the end of the number to follow its path more easily through the logs.
        final ConnectionRequest request = new ConnectionRequest(originalRequest.getAccountHandle(),
                Uri.fromParts(handle.getScheme(), handle.getSchemeSpecificPart() + "..", ""),
                originalRequest.getExtras(), originalRequest.getVideoState());
        connection.setVideoState(originalRequest.getVideoState());
        /// M: only VideoCall addVideoProvider @{
        if (originalRequest.getVideoState() == VideoProfile.STATE_BIDIRECTIONAL) {
            addVideoProvider(connection);
        }
        /// @}

        addCall(connection);
        connection.startOutgoing();

        for (Connection c : getAllConnections()) {
            c.setOnHold();
        }
    } else {
        log("Not a test number");
    }
    return connection;
}

From source file:com.android.server.telecom.testapps.TestConnectionService.java

@Override
public Connection onCreateIncomingConnection(PhoneAccountHandle connectionManagerAccount,
        final ConnectionRequest request) {
    PhoneAccountHandle accountHandle = request.getAccountHandle();
    ComponentName componentName = new ComponentName(this, TestConnectionService.class);

    if (accountHandle != null && componentName.equals(accountHandle.getComponentName())) {
        final TestConnection connection = new TestConnection(true);
        // Get the stashed intent extra that determines if this is a video call or audio call.
        Bundle extras = request.getExtras();
        boolean isVideoCall = extras.getBoolean(EXTRA_IS_VIDEO_CALL);
        Uri providedHandle = extras.getParcelable(EXTRA_HANDLE);

        // Use dummy number for testing incoming calls.
        Uri address = providedHandle == null
                ? Uri.fromParts(PhoneAccount.SCHEME_TEL, getDummyNumber(isVideoCall), null)
                : providedHandle;//from   w w  w .j av  a2  s  .c o m

        int videoState = isVideoCall ? VideoProfile.STATE_BIDIRECTIONAL : VideoProfile.STATE_AUDIO_ONLY;
        connection.setVideoState(videoState);
        setAddress(connection, address);

        addVideoProvider(connection);

        addCall(connection);

        ConnectionRequest newRequest = new ConnectionRequest(request.getAccountHandle(), address,
                request.getExtras(), videoState);
        connection.setVideoState(videoState);
        return connection;
    } else {
        return Connection.createFailedConnection(new DisconnectCause(DisconnectCause.ERROR,
                "Invalid inputs: " + accountHandle + " " + componentName));
    }
}