Wiring video state through from Connection
Bug: 16285417 Bug: 16013178 Change-Id: Ia48959248ca22f4569b0ffd01a1716470aa0a711
This commit is contained in:
@@ -37,6 +37,7 @@ public abstract class Connection {
|
||||
public void onHandleChanged(Connection c, Uri newHandle, int presentation) {}
|
||||
public void onCallerDisplayNameChanged(
|
||||
Connection c, String callerDisplayName, int presentation) {}
|
||||
public void onVideoStateChanged(Connection c, int videoState) {}
|
||||
public void onSignalChanged(Connection c, Bundle details) {}
|
||||
public void onDisconnected(Connection c, int cause, String message) {}
|
||||
public void onPostDialWait(Connection c, String remaining) {}
|
||||
@@ -75,6 +76,7 @@ public abstract class Connection {
|
||||
private CallVideoProvider mCallVideoProvider;
|
||||
private boolean mAudioModeIsVoip;
|
||||
private StatusHints mStatusHints;
|
||||
private int mVideoState;
|
||||
|
||||
/**
|
||||
* Create a new Connection.
|
||||
@@ -117,6 +119,19 @@ public abstract class Connection {
|
||||
return mState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the video state of the call.
|
||||
* Valid values: {@link android.telecomm.VideoCallProfile#VIDEO_STATE_AUDIO_ONLY},
|
||||
* {@link android.telecomm.VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL},
|
||||
* {@link android.telecomm.VideoCallProfile#VIDEO_STATE_TX_ENABLED},
|
||||
* {@link android.telecomm.VideoCallProfile#VIDEO_STATE_RX_ENABLED}.
|
||||
*
|
||||
* @return The video state of the call.
|
||||
*/
|
||||
public final int getVideoState() {
|
||||
return mVideoState;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The audio state of the call, describing how its audio is currently
|
||||
* being routed by the system. This is {@code null} if this Connection
|
||||
@@ -284,6 +299,23 @@ public abstract class Connection {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the video state for the connection.
|
||||
* Valid values: {@link android.telecomm.VideoCallProfile#VIDEO_STATE_AUDIO_ONLY},
|
||||
* {@link android.telecomm.VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL},
|
||||
* {@link android.telecomm.VideoCallProfile#VIDEO_STATE_TX_ENABLED},
|
||||
* {@link android.telecomm.VideoCallProfile#VIDEO_STATE_RX_ENABLED}.
|
||||
*
|
||||
* @param videoState The new video state.
|
||||
*/
|
||||
public final void setVideoState(int videoState) {
|
||||
Log.d(this, "setVideoState %d", videoState);
|
||||
mVideoState = videoState;
|
||||
for (Listener l : mListeners) {
|
||||
l.onVideoStateChanged(this, mVideoState);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets state to active (e.g., an ongoing call where two or more parties can actively
|
||||
* communicate).
|
||||
|
||||
@@ -323,6 +323,13 @@ public abstract class ConnectionService extends Service {
|
||||
mAdapter.setDisconnected(id, cause, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoStateChanged(Connection c, int videoState) {
|
||||
String id = mIdByConnection.get(c);
|
||||
Log.d(this, "Adapter set video state %d", videoState);
|
||||
mAdapter.setVideoState(id, videoState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHandleChanged(Connection c, Uri handle, int presentation) {
|
||||
String id = mIdByConnection.get(c);
|
||||
|
||||
@@ -323,4 +323,25 @@ final class ConnectionServiceAdapter implements DeathRecipient {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the video state associated with a call.
|
||||
*
|
||||
* Valid values: {@link android.telecomm.VideoCallProfile#VIDEO_STATE_AUDIO_ONLY},
|
||||
* {@link android.telecomm.VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL},
|
||||
* {@link android.telecomm.VideoCallProfile#VIDEO_STATE_TX_ENABLED},
|
||||
* {@link android.telecomm.VideoCallProfile#VIDEO_STATE_RX_ENABLED}.
|
||||
*
|
||||
* @param callId The unique ID of the call to set the video state for.
|
||||
* @param videoState The video state.
|
||||
*/
|
||||
void setVideoState(String callId, int videoState) {
|
||||
Log.v(this, "setVideoState: %d", videoState);
|
||||
for (IConnectionServiceAdapter adapter : mAdapters) {
|
||||
try {
|
||||
adapter.setVideoState(callId, videoState);
|
||||
} catch (RemoteException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,9 +22,6 @@ import android.graphics.drawable.Drawable;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectStreamException;
|
||||
import java.io.Serializable;
|
||||
import java.util.MissingResourceException;
|
||||
|
||||
/**
|
||||
@@ -35,16 +32,19 @@ public class PhoneAccountMetadata implements Parcelable {
|
||||
private int mIconResId;
|
||||
private String mLabel;
|
||||
private String mShortDescription;
|
||||
private boolean mVideoCallingSupported;
|
||||
|
||||
public PhoneAccountMetadata(
|
||||
PhoneAccount account,
|
||||
int iconResId,
|
||||
String label,
|
||||
String shortDescription) {
|
||||
String shortDescription,
|
||||
boolean supportsVideoCalling) {
|
||||
mAccount = account;
|
||||
mIconResId = iconResId;
|
||||
mLabel = label;
|
||||
mShortDescription = shortDescription;
|
||||
mVideoCallingSupported = supportsVideoCalling;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,6 +101,15 @@ public class PhoneAccountMetadata implements Parcelable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether this {@code PhoneAccount} supports video calling.
|
||||
*
|
||||
* @return {@code true} if this {@code PhoneAccount} supports video calling.
|
||||
*/
|
||||
public boolean isVideoCallingSupported() {
|
||||
return mVideoCallingSupported;
|
||||
}
|
||||
|
||||
//
|
||||
// Parcelable implementation
|
||||
//
|
||||
@@ -116,6 +125,7 @@ public class PhoneAccountMetadata implements Parcelable {
|
||||
out.writeInt(mIconResId);
|
||||
out.writeString(mLabel);
|
||||
out.writeString(mShortDescription);
|
||||
out.writeInt(mVideoCallingSupported ? 1: 0);
|
||||
}
|
||||
|
||||
public static final Creator<PhoneAccountMetadata> CREATOR
|
||||
@@ -136,5 +146,6 @@ public class PhoneAccountMetadata implements Parcelable {
|
||||
mIconResId = in.readInt();
|
||||
mLabel = in.readString();
|
||||
mShortDescription = in.readString();
|
||||
mVideoCallingSupported = in.readInt() == 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ public final class RemoteConnection {
|
||||
void onHandleChanged(RemoteConnection connection, Uri handle, int presentation);
|
||||
void onCallerDisplayNameChanged(
|
||||
RemoteConnection connection, String callerDisplayName, int presentation);
|
||||
void onVideoStateChanged(RemoteConnection connection, int videoState);
|
||||
void onDestroyed(RemoteConnection connection);
|
||||
}
|
||||
|
||||
@@ -55,6 +56,7 @@ public final class RemoteConnection {
|
||||
private boolean mRequestingRingback;
|
||||
private boolean mConnected;
|
||||
private int mCallCapabilities;
|
||||
private int mVideoState;
|
||||
private boolean mAudioModeIsVoip;
|
||||
private StatusHints mStatusHints;
|
||||
private Uri mHandle;
|
||||
@@ -120,6 +122,10 @@ public final class RemoteConnection {
|
||||
return mCallerDisplayNamePresentation;
|
||||
}
|
||||
|
||||
public int getVideoState() {
|
||||
return mVideoState;
|
||||
}
|
||||
|
||||
public void abort() {
|
||||
try {
|
||||
if (mConnected) {
|
||||
@@ -297,6 +303,16 @@ public final class RemoteConnection {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
void setVideoState(int videoState) {
|
||||
mVideoState = videoState;
|
||||
for (Listener l : mListeners) {
|
||||
l.onVideoStateChanged(this, videoState);
|
||||
}
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
void setAudioModeIsVoip(boolean isVoip) {
|
||||
mAudioModeIsVoip = isVoip;
|
||||
|
||||
@@ -166,6 +166,13 @@ final class RemoteConnectionService implements DeathRecipient {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVideoState(String connectionId, int videoState) {
|
||||
if (isCurrentConnection(connectionId)) {
|
||||
mConnection.setVideoState(videoState);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setAudioModeIsVoip(String connectionId, boolean isVoip) {
|
||||
if (isCurrentConnection(connectionId)) {
|
||||
|
||||
@@ -64,6 +64,8 @@ oneway interface IConnectionServiceAdapter {
|
||||
|
||||
void setCallVideoProvider(String callId, ICallVideoProvider callVideoProvider);
|
||||
|
||||
void setVideoState(String callId, int videoState);
|
||||
|
||||
void setAudioModeIsVoip(String callId, boolean isVoip);
|
||||
|
||||
void setStatusHints(String callId, in StatusHints statusHints);
|
||||
|
||||
Reference in New Issue
Block a user