Telecom API updates (1/6)

Bug: 18292176

Change-Id: I060366234a5a60510c385dc837f2b7e79596eaf5
This commit is contained in:
Ihab Awad
2014-11-12 13:41:16 -08:00
parent 07b4a29131
commit 5c9c86ec0f
15 changed files with 644 additions and 331 deletions

View File

@@ -41,7 +41,8 @@ public abstract class Conference implements IConferenceable {
public void onConferenceableConnectionsChanged(
Conference conference, List<Connection> conferenceableConnections) {}
public void onDestroyed(Conference conference) {}
public void onCapabilitiesChanged(Conference conference, int capabilities) {}
public void onConnectionCapabilitiesChanged(
Conference conference, int connectionCapabilities) {}
}
private final Set<Listener> mListeners = new CopyOnWriteArraySet<>();
@@ -56,7 +57,7 @@ public abstract class Conference implements IConferenceable {
private AudioState mAudioState;
private int mState = Connection.STATE_NEW;
private DisconnectCause mDisconnectCause;
private int mCapabilities;
private int mConnectionCapabilities;
private String mDisconnectMessage;
private final Connection.Listener mConnectionDeathListener = new Connection.Listener() {
@@ -104,13 +105,62 @@ public abstract class Conference implements IConferenceable {
return mState;
}
/** @hide */
@Deprecated public final int getCapabilities() {
return getConnectionCapabilities();
}
/**
* Returns the capabilities of a conference. See {@link PhoneCapabilities} for valid values.
* Returns the capabilities of a conference. See {@code CAPABILITY_*} constants in class
* {@link Connection} for valid values.
*
* @return A bitmask of the {@code PhoneCapabilities} of the conference call.
* @return A bitmask of the capabilities of the conference call.
*/
public final int getCapabilities() {
return mCapabilities;
public final int getConnectionCapabilities() {
return mConnectionCapabilities;
}
/**
* Whether the given capabilities support the specified capability.
*
* @param capabilities A capability bit field.
* @param capability The capability to check capabilities for.
* @return Whether the specified capability is supported.
* @hide
*/
public static boolean can(int capabilities, int capability) {
return (capabilities & capability) != 0;
}
/**
* Whether the capabilities of this {@code Connection} supports the specified capability.
*
* @param capability The capability to check capabilities for.
* @return Whether the specified capability is supported.
* @hide
*/
public boolean can(int capability) {
return can(mConnectionCapabilities, capability);
}
/**
* Removes the specified capability from the set of capabilities of this {@code Conference}.
*
* @param capability The capability to remove from the set.
* @hide
*/
public void removeCapability(int capability) {
mConnectionCapabilities &= ~capability;
}
/**
* Adds the specified capability to the set of capabilities of this {@code Conference}.
*
* @param capability The capability to add to the set.
* @hide
*/
public void addCapability(int capability) {
mConnectionCapabilities |= capability;
}
/**
@@ -153,13 +203,13 @@ public abstract class Conference implements IConferenceable {
/**
* Invoked when the child calls should be merged. Only invoked if the conference contains the
* capability {@link PhoneCapabilities#MERGE_CONFERENCE}.
* capability {@link Connection#CAPABILITY_MERGE_CONFERENCE}.
*/
public void onMerge() {}
/**
* Invoked when the child calls should be swapped. Only invoked if the conference contains the
* capability {@link PhoneCapabilities#SWAP_CONFERENCE}.
* capability {@link Connection#CAPABILITY_SWAP_CONFERENCE}.
*/
public void onSwap() {}
@@ -224,17 +274,23 @@ public abstract class Conference implements IConferenceable {
return mDisconnectCause;
}
/** @hide */
@Deprecated public final void setCapabilities(int connectionCapabilities) {
setConnectionCapabilities(connectionCapabilities);
}
/**
* Sets the capabilities of a conference. See {@link PhoneCapabilities} for valid values.
* Sets the capabilities of a conference. See {@code CAPABILITY_*} constants of class
* {@link Connection} for valid values.
*
* @param capabilities A bitmask of the {@code PhoneCapabilities} of the conference call.
* @param connectionCapabilities A bitmask of the {@code PhoneCapabilities} of the conference call.
*/
public final void setCapabilities(int capabilities) {
if (capabilities != mCapabilities) {
mCapabilities = capabilities;
public final void setConnectionCapabilities(int connectionCapabilities) {
if (connectionCapabilities != mConnectionCapabilities) {
mConnectionCapabilities = connectionCapabilities;
for (Listener l : mListeners) {
l.onCapabilitiesChanged(this, mCapabilities);
l.onConnectionCapabilitiesChanged(this, mConnectionCapabilities);
}
}
}