Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d52ab69 authored by Tyler Gunn's avatar Tyler Gunn Committed by Android Partner Code Review
Browse files

Merge "IMS-VT: Upgrade/Downgrade change -Add isVideo API to...

Merge "IMS-VT: Upgrade/Downgrade change -Add isVideo API to VideoProfile.VideoState" into m-wireless-dev
parents 72db88e4 07366813
Loading
Loading
Loading
Loading
+28 −9
Original line number Diff line number Diff line
@@ -208,10 +208,6 @@ public final class Call {
         */
        public static final int CAPABILITY_WIFI = 0x00010000;

        //******************************************************************************************
        // Next CAPABILITY value: 0x00020000
        //******************************************************************************************

        /**
         * Indicates that the current device callback number should be shown.
         *
@@ -225,8 +221,14 @@ public final class Call {
         */
        public static final int CAPABILITY_SPEED_UP_MT_AUDIO = 0x00040000;

         /**
         * Call type can be modified for IMS call
         * @hide
         */
        public static final int CAPABILITY_CAN_UPGRADE_TO_VIDEO = 0x00080000;

        //******************************************************************************************
        // Next CAPABILITY value: 0x00080000
        // Next CAPABILITY value: 0x00100000
        //******************************************************************************************

        private final Uri mHandle;
@@ -242,6 +244,7 @@ public final class Call {
        private final int mVideoState;
        private final StatusHints mStatusHints;
        private final Bundle mExtras;
        private final int mCallSubstate;

        /**
         * Whether the supplied capabilities  supports the specified capability.
@@ -329,6 +332,9 @@ public final class Call {
            if (can(capabilities, CAPABILITY_SPEED_UP_MT_AUDIO)) {
                builder.append(" CAPABILITY_SPEED_UP_MT_AUDIO");
            }
            if (can(capabilities, CAPABILITY_CAN_UPGRADE_TO_VIDEO)) {
                builder.append(" CAPABILITY_CAN_UPGRADE_TO_VIDEO");
            }
            builder.append("]");
            return builder.toString();
        }
@@ -434,6 +440,14 @@ public final class Call {
            return mExtras;
        }

        /**
         * @return The substate of the {@code Call}.
         * @hide
         */
        public int getCallSubstate() {
            return mCallSubstate;
        }

        @Override
        public boolean equals(Object o) {
            if (o instanceof Details) {
@@ -452,7 +466,8 @@ public final class Call {
                        Objects.equals(mGatewayInfo, d.mGatewayInfo) &&
                        Objects.equals(mVideoState, d.mVideoState) &&
                        Objects.equals(mStatusHints, d.mStatusHints) &&
                        Objects.equals(mExtras, d.mExtras);
                        Objects.equals(mExtras, d.mExtras) &&
                        Objects.equals(mCallSubstate, d.mCallSubstate);
            }
            return false;
        }
@@ -472,7 +487,8 @@ public final class Call {
                    Objects.hashCode(mGatewayInfo) +
                    Objects.hashCode(mVideoState) +
                    Objects.hashCode(mStatusHints) +
                    Objects.hashCode(mExtras);
                    Objects.hashCode(mExtras) +
                    Objects.hashCode(mCallSubstate);
        }

        /** {@hide} */
@@ -489,7 +505,8 @@ public final class Call {
                GatewayInfo gatewayInfo,
                int videoState,
                StatusHints statusHints,
                Bundle extras) {
                Bundle extras,
                int callSubstate) {
            mHandle = handle;
            mHandlePresentation = handlePresentation;
            mCallerDisplayName = callerDisplayName;
@@ -503,6 +520,7 @@ public final class Call {
            mVideoState = videoState;
            mStatusHints = statusHints;
            mExtras = extras;
            mCallSubstate = callSubstate;
        }
    }

@@ -883,7 +901,8 @@ public final class Call {
                parcelableCall.getGatewayInfo(),
                parcelableCall.getVideoState(),
                parcelableCall.getStatusHints(),
                parcelableCall.getExtras());
                parcelableCall.getExtras(),
                parcelableCall.getCallSubstate());
        boolean detailsChanged = !Objects.equals(mDetails, details);
        if (detailsChanged) {
            mDetails = details;
+64 −0
Original line number Diff line number Diff line
@@ -17,10 +17,12 @@
package android.telecom;

import android.annotation.SystemApi;
import android.telecom.Connection.VideoProvider;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CopyOnWriteArraySet;
@@ -49,6 +51,8 @@ public abstract class Conference implements IConferenceable {
        public void onDestroyed(Conference conference) {}
        public void onConnectionCapabilitiesChanged(
                Conference conference, int connectionCapabilities) {}
        public void onVideoStateChanged(Conference c, int videoState) { }
        public void onVideoProviderChanged(Conference c, Connection.VideoProvider videoProvider) {}
    }

    private final Set<Listener> mListeners = new CopyOnWriteArraySet<>();
@@ -179,6 +183,22 @@ public abstract class Conference implements IConferenceable {
        return mAudioState;
    }

    /**
     * Returns VideoProvider of the primary call. This can be null.
     *  @hide
     */
    public VideoProvider getVideoProvider() {
        return null;
    }

    /**
     * Returns video state of the primary call.
     *  @hide
     */
    public int getVideoState() {
        return VideoProfile.VideoState.AUDIO_ONLY;
    }

    /**
     * Invoked when the Conference and all it's {@link Connection}s should be disconnected.
     */
@@ -309,6 +329,7 @@ public abstract class Conference implements IConferenceable {
     * @return True if the connection was successfully added.
     */
    public final boolean addConnection(Connection connection) {
        Log.d(this, "Connection=%s, connection=", connection);
        if (connection != null && !mChildConnections.contains(connection)) {
            if (connection.setConference(this)) {
                mChildConnections.add(connection);
@@ -355,6 +376,38 @@ public abstract class Conference implements IConferenceable {
        fireOnConferenceableConnectionsChanged();
    }

    /**
     * Set the video state for the conference.
     * Valid values: {@link VideoProfile.VideoState#AUDIO_ONLY},
     * {@link VideoProfile.VideoState#BIDIRECTIONAL},
     * {@link VideoProfile.VideoState#TX_ENABLED},
     * {@link VideoProfile.VideoState#RX_ENABLED}.
     *
     * @param videoState The new video state.
     * @hide
     */
    public final void setVideoState(Connection c, int videoState) {
        Log.d(this, "setVideoState Conference: %s Connection: %s VideoState: %s",
                this, c, videoState);
        for (Listener l : mListeners) {
            l.onVideoStateChanged(this, videoState);
        }
    }

    /**
     * Sets the video connection provider.
     *
     * @param videoProvider The video provider.
     * @hide
     */
    public final void setVideoProvider(Connection c, Connection.VideoProvider videoProvider) {
        Log.d(this, "setVideoProvider Conference: %s Connection: %s VideoState: %s",
                this, c, videoProvider);
        for (Listener l : mListeners) {
            l.onVideoProviderChanged(this, videoProvider);
        }
    }

    private final void fireOnConferenceableConnectionsChanged() {
        for (Listener l : mListeners) {
            l.onConferenceableConnectionsChanged(this, getConferenceableConnections());
@@ -484,4 +537,15 @@ public abstract class Conference implements IConferenceable {
        }
        mConferenceableConnections.clear();
    }

    @Override
    public String toString() {
        return String.format(Locale.US,
                "[State: %s,Capabilites: %s, VideoState: %s, VideoProvider: %s, ThisObject %s]",
                Connection.stateToString(mState),
                Call.Details.capabilitiesToString(mConnectionCapabilities),
                getVideoState(),
                getVideoProvider(),
                super.toString());
    }
}
+115 −3
Original line number Diff line number Diff line
@@ -186,10 +186,58 @@ public abstract class Connection implements IConferenceable {
    */
    public static final int CAPABILITY_SPEED_UP_MT_AUDIO = 0x00040000;

    /**
     * Call type can be modified for IMS call
     * @hide
     */
    public static final int CAPABILITY_CAN_UPGRADE_TO_VIDEO = 0x00080000;

    //**********************************************************************************************
    // Next CAPABILITY value: 0x00080000
    // Next CAPABILITY value: 0x00100000
    //**********************************************************************************************

    /**
     * Call substate bitmask values
     */

    /* Default case */
    /**
     * @hide
     */
    public static final int SUBSTATE_NONE = 0;

    /* Indicates that the call is connected but audio attribute is suspended */
    /**
     * @hide
     */
    public static final int SUBSTATE_AUDIO_CONNECTED_SUSPENDED = 0x1;

    /* Indicates that the call is connected but video attribute is suspended */
    /**
     * @hide
     */
    public static final int SUBSTATE_VIDEO_CONNECTED_SUSPENDED = 0x2;

    /* Indicates that the call is established but media retry is needed */
    /**
     * @hide
     */
    public static final int SUBSTATE_AVP_RETRY = 0x4;

    /* Indicates that the call is multitasking */
    /**
     * @hide
     */
    public static final int SUBSTATE_MEDIA_PAUSED = 0x8;

    /* Mask containing all the call substate bits set */
    /**
     * @hide
     */
    public static final int SUBSTATE_ALL = SUBSTATE_AUDIO_CONNECTED_SUSPENDED |
        SUBSTATE_VIDEO_CONNECTED_SUSPENDED | SUBSTATE_AVP_RETRY |
        SUBSTATE_MEDIA_PAUSED;

    // Flag controlling whether PII is emitted into the logs
    private static final boolean PII_DEBUG = Log.isLoggable(android.util.Log.DEBUG);

@@ -294,6 +342,9 @@ public abstract class Connection implements IConferenceable {
        if (can(capabilities, CAPABILITY_SPEED_UP_MT_AUDIO)) {
            builder.append(" CAPABILITY_SPEED_UP_MT_AUDIO");
        }
        if (can(capabilities, CAPABILITY_CAN_UPGRADE_TO_VIDEO)) {
            builder.append(" CAPABILITY_CAN_UPGRADE_TO_VIDEO");
        }
        builder.append("]");
        return builder.toString();
    }
@@ -322,6 +373,7 @@ public abstract class Connection implements IConferenceable {
        public void onConferenceParticipantsChanged(Connection c,
                List<ConferenceParticipant> participants) {}
        public void onConferenceStarted() {}
        public void onCallSubstateChanged(Connection c, int substate) {}
    }

    /** @hide */
@@ -377,6 +429,16 @@ public abstract class Connection implements IConferenceable {
         */
        public static final int SESSION_MODIFY_REQUEST_INVALID = 3;

        /**
         * Session modify request timed out.
         */
        public static final int SESSION_MODIFY_REQUEST_TIMED_OUT = 4;

        /**
         * Session modify request rejected by remote UE.
         */
        public static final int SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE = 5;

        private static final int MSG_SET_VIDEO_CALLBACK = 1;
        private static final int MSG_SET_CAMERA = 2;
        private static final int MSG_SET_PREVIEW_SURFACE = 3;
@@ -462,7 +524,8 @@ public abstract class Connection implements IConferenceable {
            }

            public void setDeviceOrientation(int rotation) {
                mMessageHandler.obtainMessage(MSG_SET_DEVICE_ORIENTATION, rotation).sendToTarget();
                mMessageHandler.obtainMessage(
                        MSG_SET_DEVICE_ORIENTATION, rotation, 0).sendToTarget();
            }

            public void setZoom(float value) {
@@ -656,7 +719,7 @@ public abstract class Connection implements IConferenceable {
         *
         * @param dataUsage The updated data usage.
         */
        public void changeCallDataUsage(int dataUsage) {
        public void changeCallDataUsage(long dataUsage) {
            if (mVideoCallback != null) {
                try {
                    mVideoCallback.changeCallDataUsage(dataUsage);
@@ -678,6 +741,20 @@ public abstract class Connection implements IConferenceable {
                }
            }
        }

        /**
         * Invokes callback method defined in In-Call UI.
         *
         * @param videoQuality The updated video quality.
         */
        public void changeVideoQuality(int videoQuality) {
            if (mVideoCallback != null) {
                try {
                    mVideoCallback.changeVideoQuality(videoQuality);
                } catch (RemoteException ignored) {
                }
            }
        }
    }

    private final Listener mConnectionDeathListener = new Listener() {
@@ -724,6 +801,7 @@ public abstract class Connection implements IConferenceable {
    private DisconnectCause mDisconnectCause;
    private Conference mConference;
    private ConnectionService mConnectionService;
    private int mCallSubstate;

    /**
     * Create a new Connection.
@@ -781,6 +859,21 @@ public abstract class Connection implements IConferenceable {
        return mVideoState;
    }

    /**
     * Returns the call substate of the call.
     * Valid values: {@link Connection#SUBSTATE_NONE},
     * {@link Connection#SUBSTATE_AUDIO_CONNECTED_SUSPENDED},
     * {@link Connection#SUBSTATE_VIDEO_CONNECTED_SUSPENDED},
     * {@link Connection#SUBSTATE_AVP_RETRY},
     * {@link Connection#SUBSTATE_MEDIA_PAUSED}.
     *
     * @param callSubstate The new call substate.
     * @hide
     */
    public final int getCallSubstate() {
        return mCallSubstate;
    }

    /**
     * @return The audio state of the connection, describing how its audio is currently
     *         being routed by the system. This is {@code null} if this Connection
@@ -959,6 +1052,25 @@ public abstract class Connection implements IConferenceable {
        }
    }

    /**
     * Set the call substate for the connection.
     * Valid values: {@link Connection#SUBSTATE_NONE},
     * {@link Connection#SUBSTATE_AUDIO_CONNECTED_SUSPENDED},
     * {@link Connection#SUBSTATE_VIDEO_CONNECTED_SUSPENDED},
     * {@link Connection#SUBSTATE_AVP_RETRY},
     * {@link Connection#SUBSTATE_MEDIA_PAUSED}.
     *
     * @param callSubstate The new call substate.
     * @hide
     */
    public final void setCallSubstate(int callSubstate) {
        Log.d(this, "setCallSubstate %d", callSubstate);
        mCallSubstate = callSubstate;
        for (Listener l : mListeners) {
            l.onCallSubstateChanged(this, mCallSubstate);
        }
    }

    /**
     * Sets state to active (e.g., an ongoing connection where two or more parties can actively
     * communicate).
+36 −3
Original line number Diff line number Diff line
@@ -415,6 +415,21 @@ public abstract class ConnectionService extends Service {
                    Connection.capabilitiesToString(connectionCapabilities));
            mAdapter.setConnectionCapabilities(id, connectionCapabilities);
        }

        @Override
        public void onVideoStateChanged(Conference c, int videoState) {
            String id = mIdByConference.get(c);
            Log.d(this, "onVideoStateChanged set video state %d", videoState);
            mAdapter.setVideoState(id, videoState);
        }

        @Override
        public void onVideoProviderChanged(Conference c, Connection.VideoProvider videoProvider) {
            String id = mIdByConference.get(c);
            Log.d(this, "onVideoProviderChanged: Connection: %s, VideoProvider: %s", c,
                    videoProvider);
            mAdapter.setVideoProvider(id, videoProvider);
        }
    };

    private final Connection.Listener mConnectionListener = new Connection.Listener() {
@@ -508,6 +523,8 @@ public abstract class ConnectionService extends Service {
        @Override
        public void onVideoProviderChanged(Connection c, Connection.VideoProvider videoProvider) {
            String id = mIdByConnection.get(c);
            Log.d(this, "onVideoProviderChanged: Connection: %s, VideoProvider: %s", c,
                    videoProvider);
            mAdapter.setVideoProvider(id, videoProvider);
        }

@@ -542,6 +559,13 @@ public abstract class ConnectionService extends Service {
                mAdapter.setIsConferenced(id, conferenceId);
            }
        }

        @Override
        public void onCallSubstateChanged(Connection c, int callSubstate) {
            String id = mIdByConnection.get(c);
            Log.d(this, "Adapter set call substate %d", callSubstate);
            mAdapter.setCallSubstate(id, callSubstate);
        }
    };

    /** {@inheritDoc} */
@@ -611,7 +635,8 @@ public abstract class ConnectionService extends Service {
                        connection.getAudioModeIsVoip(),
                        connection.getStatusHints(),
                        connection.getDisconnectCause(),
                        createIdList(connection.getConferenceables())));
                        createIdList(connection.getConferenceables()),
                        connection.getCallSubstate()));
    }

    private void abort(String callId) {
@@ -871,6 +896,8 @@ public abstract class ConnectionService extends Service {
     * @param conference The new conference object.
     */
    public final void addConference(Conference conference) {
        Log.d(this, "addConference: conference=%s", conference);

        String id = addConferenceInternal(conference);
        if (id != null) {
            List<String> connectionIds = new ArrayList<>(2);
@@ -884,8 +911,14 @@ public abstract class ConnectionService extends Service {
                    conference.getState(),
                    conference.getConnectionCapabilities(),
                    connectionIds,
                    conference.getConnectTimeMillis());
                    conference.getVideoProvider() == null ?
                            null : conference.getVideoProvider().getInterface(),
                    conference.getVideoState(),
                    conference.getConnectTimeMillis()
                    );
            mAdapter.addConferenceCall(id, parcelableConference);
            mAdapter.setVideoProvider(id, conference.getVideoProvider());
            mAdapter.setVideoState(id, conference.getVideoState());

            // Go through any child calls and set the parent.
            for (Connection connection : conference.getConnections()) {
@@ -926,7 +959,7 @@ public abstract class ConnectionService extends Service {
                    connection.getAudioModeIsVoip(),
                    connection.getStatusHints(),
                    connection.getDisconnectCause(),
                    emptyList);
                    emptyList, connection.getCallSubstate());
            mAdapter.addExistingConnection(id, parcelableConnection);
        }
    }
+22 −0
Original line number Diff line number Diff line
@@ -369,4 +369,26 @@ final class ConnectionServiceAdapter implements DeathRecipient {
            }
        }
    }

    /**
     * Set the call substate for the connection.
     * Valid values: {@link Connection#CALL_SUBSTATE_NONE},
     * {@link Connection#CALL_SUBSTATE_AUDIO_CONNECTED_SUSPENDED},
     * {@link Connection#CALL_SUBSTATE_VIDEO_CONNECTED_SUSPENDED},
     * {@link Connection#CALL_SUBSTATE_AVP_RETRY},
     * {@link Connection#CALL_SUBSTATE_MEDIA_PAUSED}.
     *
     * @param callId The unique ID of the call to set the substate for.
     * @param callSubstate The new call substate.
     * @hide
     */
    public final void setCallSubstate(String callId, int callSubstate) {
        Log.v(this, "setCallSubstate: %d", callSubstate);
        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.setCallSubstate(callId, callSubstate);
            } catch (RemoteException ignored) {
            }
        }
    }
}
Loading