Example usage for android.telecom VideoProfile STATE_AUDIO_ONLY

List of usage examples for android.telecom VideoProfile STATE_AUDIO_ONLY

Introduction

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

Prototype

int STATE_AUDIO_ONLY

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

Click Source Link

Document

Used when answering or dialing a call to indicate that the call does not have a video component.

Usage

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;// ww w.  j  a v  a  2s  .  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));
    }
}