summaryrefslogtreecommitdiffstats
path: root/telecomm
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2014-07-17 07:50:22 -0700
committerTyler Gunn <tgunn@google.com>2014-07-18 01:30:34 +0000
commitaa07df84f279a87ad6370758c9d792a660f2cebb (patch)
tree2aa10da887653db7be81d0d71f48d9a787336a3f /telecomm
parent3ee06efef34b7f619b6b31b58447c64eda9fc0e7 (diff)
downloadframeworks_base-aa07df84f279a87ad6370758c9d792a660f2cebb.zip
frameworks_base-aa07df84f279a87ad6370758c9d792a660f2cebb.tar.gz
frameworks_base-aa07df84f279a87ad6370758c9d792a660f2cebb.tar.bz2
Wiring video state through from Connection
Bug: 16285417 Bug: 16013178 Change-Id: Ia48959248ca22f4569b0ffd01a1716470aa0a711
Diffstat (limited to 'telecomm')
-rw-r--r--telecomm/java/android/telecomm/Connection.java32
-rw-r--r--telecomm/java/android/telecomm/ConnectionService.java7
-rw-r--r--telecomm/java/android/telecomm/ConnectionServiceAdapter.java21
-rw-r--r--telecomm/java/android/telecomm/PhoneAccountMetadata.java19
-rw-r--r--telecomm/java/android/telecomm/RemoteConnection.java16
-rw-r--r--telecomm/java/android/telecomm/RemoteConnectionService.java7
-rw-r--r--telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl2
7 files changed, 100 insertions, 4 deletions
diff --git a/telecomm/java/android/telecomm/Connection.java b/telecomm/java/android/telecomm/Connection.java
index 130364f..c050f30 100644
--- a/telecomm/java/android/telecomm/Connection.java
+++ b/telecomm/java/android/telecomm/Connection.java
@@ -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.
@@ -118,6 +120,19 @@ public abstract class Connection {
}
/**
+ * 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
* does not directly know about its audio state.
@@ -285,6 +300,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).
*/
diff --git a/telecomm/java/android/telecomm/ConnectionService.java b/telecomm/java/android/telecomm/ConnectionService.java
index 5855470..9e04c6e 100644
--- a/telecomm/java/android/telecomm/ConnectionService.java
+++ b/telecomm/java/android/telecomm/ConnectionService.java
@@ -324,6 +324,13 @@ public abstract class ConnectionService extends Service {
}
@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);
mAdapter.setHandle(id, handle, presentation);
diff --git a/telecomm/java/android/telecomm/ConnectionServiceAdapter.java b/telecomm/java/android/telecomm/ConnectionServiceAdapter.java
index a812fa4..63546d3 100644
--- a/telecomm/java/android/telecomm/ConnectionServiceAdapter.java
+++ b/telecomm/java/android/telecomm/ConnectionServiceAdapter.java
@@ -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) {
+ }
+ }
+ }
}
diff --git a/telecomm/java/android/telecomm/PhoneAccountMetadata.java b/telecomm/java/android/telecomm/PhoneAccountMetadata.java
index 20a4d47..7232218 100644
--- a/telecomm/java/android/telecomm/PhoneAccountMetadata.java
+++ b/telecomm/java/android/telecomm/PhoneAccountMetadata.java
@@ -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;
}
}
diff --git a/telecomm/java/android/telecomm/RemoteConnection.java b/telecomm/java/android/telecomm/RemoteConnection.java
index 5d8579e..d17e62a 100644
--- a/telecomm/java/android/telecomm/RemoteConnection.java
+++ b/telecomm/java/android/telecomm/RemoteConnection.java
@@ -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;
diff --git a/telecomm/java/android/telecomm/RemoteConnectionService.java b/telecomm/java/android/telecomm/RemoteConnectionService.java
index 7fd8f93..25ff5bc 100644
--- a/telecomm/java/android/telecomm/RemoteConnectionService.java
+++ b/telecomm/java/android/telecomm/RemoteConnectionService.java
@@ -167,6 +167,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)) {
mConnection.setAudioModeIsVoip(isVoip);
diff --git a/telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl b/telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl
index b36f72c..e12cfca 100644
--- a/telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl
+++ b/telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl
@@ -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);