Loading telecomm/java/android/telecom/AudioState.java +37 −14 Original line number Diff line number Diff line Loading @@ -54,25 +54,25 @@ public final class AudioState implements Parcelable { public static final int ROUTE_ALL = ROUTE_EARPIECE | ROUTE_BLUETOOTH | ROUTE_WIRED_HEADSET | ROUTE_SPEAKER; /** True if the call is muted, false otherwise. */ public final boolean isMuted; /** @hide */ @Deprecated public final boolean isMuted; /** The current audio route being used. */ public final int route; /** @hide */ @Deprecated public final int route; /** Bit mask of all routes supported by this call. */ public final int supportedRouteMask; /** @hide */ @Deprecated public final int supportedRouteMask; public AudioState(boolean isMuted, int route, int supportedRouteMask) { this.isMuted = isMuted; public AudioState(boolean muted, int route, int supportedRouteMask) { this.isMuted = muted; this.route = route; this.supportedRouteMask = supportedRouteMask; } public AudioState(AudioState state) { isMuted = state.isMuted; route = state.route; supportedRouteMask = state.supportedRouteMask; isMuted = state.isMuted(); route = state.getRoute(); supportedRouteMask = state.getSupportedRouteMask(); } @Override Loading @@ -84,15 +84,17 @@ public final class AudioState implements Parcelable { return false; } AudioState state = (AudioState) obj; return isMuted == state.isMuted && route == state.route && supportedRouteMask == state.supportedRouteMask; return isMuted() == state.isMuted() && getRoute() == state.getRoute() && getSupportedRouteMask() == state.getSupportedRouteMask(); } @Override public String toString() { return String.format(Locale.US, "[AudioState isMuted: %b, route; %s, supportedRouteMask: %s]", isMuted, audioRouteToString(route), audioRouteToString(supportedRouteMask)); isMuted, audioRouteToString(route), audioRouteToString(supportedRouteMask)); } /** @hide */ Loading Loading @@ -162,4 +164,25 @@ public final class AudioState implements Parcelable { destination.writeInt(route); destination.writeInt(supportedRouteMask); } /** * @return {@code true} if the call is muted, false otherwise. */ public boolean isMuted() { return isMuted; } /** * @return The current audio route being used. */ public int getRoute() { return route; } /** * @return Bit mask of all routes supported by this call. */ public int getSupportedRouteMask() { return supportedRouteMask; } } telecomm/java/android/telecom/Call.java +161 −4 Original line number Diff line number Diff line Loading @@ -97,6 +97,91 @@ public final class Call { public static final String AVAILABLE_PHONE_ACCOUNTS = "selectPhoneAccountAccounts"; public static class Details { /** Call can currently be put on hold or unheld. */ public static final int CAPABILITY_HOLD = 0x00000001; /** Call supports the hold feature. */ public static final int CAPABILITY_SUPPORT_HOLD = 0x00000002; /** * Calls within a conference can be merged. A {@link ConnectionService} has the option to * add a {@link Conference} call before the child {@link Connection}s are merged. This is how * CDMA-based {@link Connection}s are implemented. For these unmerged {@link Conference}s, this * capability allows a merge button to be shown while the conference call is in the foreground * of the in-call UI. * <p> * This is only intended for use by a {@link Conference}. */ public static final int CAPABILITY_MERGE_CONFERENCE = 0x00000004; /** * Calls within a conference can be swapped between foreground and background. * See {@link #CAPABILITY_MERGE_CONFERENCE} for additional information. * <p> * This is only intended for use by a {@link Conference}. */ public static final int CAPABILITY_SWAP_CONFERENCE = 0x00000008; /** * @hide */ public static final int CAPABILITY_UNUSED = 0x00000010; /** Call supports responding via text option. */ public static final int CAPABILITY_RESPOND_VIA_TEXT = 0x00000020; /** Call can be muted. */ public static final int CAPABILITY_MUTE = 0x00000040; /** * Call supports conference call management. This capability only applies to {@link Conference} * calls which can have {@link Connection}s as children. */ public static final int CAPABILITY_MANAGE_CONFERENCE = 0x00000080; /** * Local device supports video telephony. * @hide */ public static final int CAPABILITY_SUPPORTS_VT_LOCAL = 0x00000100; /** * Remote device supports video telephony. * @hide */ public static final int CAPABILITY_SUPPORTS_VT_REMOTE = 0x00000200; /** * Call is using voice over LTE. * @hide */ public static final int CAPABILITY_VoLTE = 0x00000400; /** * Call is using voice over WIFI. * @hide */ public static final int CAPABILITY_VoWIFI = 0x00000800; /** * Call is able to be separated from its parent {@code Conference}, if any. */ public static final int CAPABILITY_SEPARATE_FROM_CONFERENCE = 0x00001000; /** * Call is able to be individually disconnected when in a {@code Conference}. */ public static final int CAPABILITY_DISCONNECT_FROM_CONFERENCE = 0x00002000; /** * Whether the call is a generic conference, where we do not know the precise state of * participants in the conference (eg. on CDMA). * * @hide */ public static final int CAPABILITY_GENERIC_CONFERENCE = 0x00004000; private final Uri mHandle; private final int mHandlePresentation; private final String mCallerDisplayName; Loading @@ -111,6 +196,78 @@ public final class Call { private final StatusHints mStatusHints; private final Bundle mExtras; /** * Whether the supplied capabilities supports the specified capability. * * @param capabilities A bit field of capabilities. * @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 Details} 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(mCallCapabilities, capability); } /** * Render a set of capability bits ({@code CAPABILITY_*}) as a human readable string. * * @param capabilities A capability bit field. * @return A human readable string representation. */ public static String capabilitiesToString(int capabilities) { StringBuilder builder = new StringBuilder(); builder.append("[Capabilities:"); if (can(capabilities, CAPABILITY_HOLD)) { builder.append(" CAPABILITY_HOLD"); } if (can(capabilities, CAPABILITY_SUPPORT_HOLD)) { builder.append(" CAPABILITY_SUPPORT_HOLD"); } if (can(capabilities, CAPABILITY_MERGE_CONFERENCE)) { builder.append(" CAPABILITY_MERGE_CONFERENCE"); } if (can(capabilities, CAPABILITY_SWAP_CONFERENCE)) { builder.append(" CAPABILITY_SWAP_CONFERENCE"); } if (can(capabilities, CAPABILITY_RESPOND_VIA_TEXT)) { builder.append(" CAPABILITY_RESPOND_VIA_TEXT"); } if (can(capabilities, CAPABILITY_MUTE)) { builder.append(" CAPABILITY_MUTE"); } if (can(capabilities, CAPABILITY_MANAGE_CONFERENCE)) { builder.append(" CAPABILITY_MANAGE_CONFERENCE"); } if (can(capabilities, CAPABILITY_SUPPORTS_VT_LOCAL)) { builder.append(" CAPABILITY_SUPPORTS_VT_LOCAL"); } if (can(capabilities, CAPABILITY_SUPPORTS_VT_REMOTE)) { builder.append(" CAPABILITY_SUPPORTS_VT_REMOTE"); } if (can(capabilities, CAPABILITY_VoLTE)) { builder.append(" CAPABILITY_VoLTE"); } if (can(capabilities, CAPABILITY_VoWIFI)) { builder.append(" CAPABILITY_VoWIFI"); } if (can(capabilities, CAPABILITY_GENERIC_CONFERENCE)) { builder.append(" CAPABILITY_GENERIC_CONFERENCE"); } builder.append("]"); return builder.toString(); } /** * @return The handle (e.g., phone number) to which the {@code Call} is currently * connected. Loading Loading @@ -151,8 +308,8 @@ public final class Call { } /** * @return A bitmask of the capabilities of the {@code Call}, as defined in * {@link PhoneCapabilities}. * @return A bitmask of the capabilities of the {@code Call}, as defined by the various * {@code CAPABILITY_*} constants in this class. */ public int getCallCapabilities() { return mCallCapabilities; Loading Loading @@ -511,14 +668,14 @@ public final class Call { } /** * Merges the calls within this conference. See {@link PhoneCapabilities#MERGE_CONFERENCE}. * Merges the calls within this conference. See {@link Details#CAPABILITY_MERGE_CONFERENCE}. */ public void mergeConference() { mInCallAdapter.mergeConference(mTelecomCallId); } /** * Swaps the calls within this conference. See {@link PhoneCapabilities#SWAP_CONFERENCE}. * Swaps the calls within this conference. See {@link Details#CAPABILITY_SWAP_CONFERENCE}. */ public void swapConference() { mInCallAdapter.swapConference(mTelecomCallId); Loading telecomm/java/android/telecom/Conference.java +70 −14 Original line number Diff line number Diff line Loading @@ -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<>(); Loading @@ -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() { Loading Loading @@ -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 {@code CAPABILITY_*} constants in class * {@link Connection} for valid values. * * @return A bitmask of the capabilities of the conference call. */ 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); } /** * Returns the capabilities of a conference. See {@link PhoneCapabilities} for valid values. * Removes the specified capability from the set of capabilities of this {@code Conference}. * * @return A bitmask of the {@code PhoneCapabilities} of the conference call. * @param capability The capability to remove from the set. * @hide */ public final int getCapabilities() { return mCapabilities; 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; } /** Loading Loading @@ -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() {} Loading Loading @@ -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); } } } Loading telecomm/java/android/telecom/Connection.java +256 −39 File changed.Preview size limit exceeded, changes collapsed. Show changes telecomm/java/android/telecom/ConnectionService.java +12 −10 Original line number Diff line number Diff line Loading @@ -407,11 +407,13 @@ public abstract class ConnectionService extends Service { } @Override public void onCapabilitiesChanged(Conference conference, int capabilities) { public void onConnectionCapabilitiesChanged( Conference conference, int connectionCapabilities) { String id = mIdByConference.get(conference); Log.d(this, "call capabilities: conference: %s", PhoneCapabilities.toString(capabilities)); mAdapter.setCallCapabilities(id, capabilities); Connection.capabilitiesToString(connectionCapabilities)); mAdapter.setConnectionCapabilities(id, connectionCapabilities); } }; Loading Loading @@ -489,11 +491,11 @@ public abstract class ConnectionService extends Service { } @Override public void onCallCapabilitiesChanged(Connection c, int capabilities) { public void onConnectionCapabilitiesChanged(Connection c, int capabilities) { String id = mIdByConnection.get(c); Log.d(this, "capabilities: parcelableconnection: %s", PhoneCapabilities.toString(capabilities)); mAdapter.setCallCapabilities(id, capabilities); Connection.capabilitiesToString(capabilities)); mAdapter.setConnectionCapabilities(id, capabilities); } @Override Loading Loading @@ -581,7 +583,7 @@ public abstract class ConnectionService extends Service { Log.v(this, "createConnection, number: %s, state: %s, capabilities: %s", Connection.toLogSafePhoneNumber(number), Connection.stateToString(connection.getState()), PhoneCapabilities.toString(connection.getCallCapabilities())); Connection.capabilitiesToString(connection.getConnectionCapabilities())); Log.d(this, "createConnection, calling handleCreateConnectionSuccessful %s", callId); mAdapter.handleCreateConnectionComplete( Loading @@ -590,7 +592,7 @@ public abstract class ConnectionService extends Service { new ParcelableConnection( request.getAccountHandle(), connection.getState(), connection.getCallCapabilities(), connection.getConnectionCapabilities(), connection.getAddress(), connection.getAddressPresentation(), connection.getCallerDisplayName(), Loading Loading @@ -873,7 +875,7 @@ public abstract class ConnectionService extends Service { ParcelableConference parcelableConference = new ParcelableConference( conference.getPhoneAccountHandle(), conference.getState(), conference.getCapabilities(), conference.getConnectionCapabilities(), connectionIds); mAdapter.addConferenceCall(id, parcelableConference); Loading Loading @@ -904,7 +906,7 @@ public abstract class ConnectionService extends Service { ParcelableConnection parcelableConnection = new ParcelableConnection( phoneAccountHandle, connection.getState(), connection.getCallCapabilities(), connection.getConnectionCapabilities(), connection.getAddress(), connection.getAddressPresentation(), connection.getCallerDisplayName(), Loading Loading
telecomm/java/android/telecom/AudioState.java +37 −14 Original line number Diff line number Diff line Loading @@ -54,25 +54,25 @@ public final class AudioState implements Parcelable { public static final int ROUTE_ALL = ROUTE_EARPIECE | ROUTE_BLUETOOTH | ROUTE_WIRED_HEADSET | ROUTE_SPEAKER; /** True if the call is muted, false otherwise. */ public final boolean isMuted; /** @hide */ @Deprecated public final boolean isMuted; /** The current audio route being used. */ public final int route; /** @hide */ @Deprecated public final int route; /** Bit mask of all routes supported by this call. */ public final int supportedRouteMask; /** @hide */ @Deprecated public final int supportedRouteMask; public AudioState(boolean isMuted, int route, int supportedRouteMask) { this.isMuted = isMuted; public AudioState(boolean muted, int route, int supportedRouteMask) { this.isMuted = muted; this.route = route; this.supportedRouteMask = supportedRouteMask; } public AudioState(AudioState state) { isMuted = state.isMuted; route = state.route; supportedRouteMask = state.supportedRouteMask; isMuted = state.isMuted(); route = state.getRoute(); supportedRouteMask = state.getSupportedRouteMask(); } @Override Loading @@ -84,15 +84,17 @@ public final class AudioState implements Parcelable { return false; } AudioState state = (AudioState) obj; return isMuted == state.isMuted && route == state.route && supportedRouteMask == state.supportedRouteMask; return isMuted() == state.isMuted() && getRoute() == state.getRoute() && getSupportedRouteMask() == state.getSupportedRouteMask(); } @Override public String toString() { return String.format(Locale.US, "[AudioState isMuted: %b, route; %s, supportedRouteMask: %s]", isMuted, audioRouteToString(route), audioRouteToString(supportedRouteMask)); isMuted, audioRouteToString(route), audioRouteToString(supportedRouteMask)); } /** @hide */ Loading Loading @@ -162,4 +164,25 @@ public final class AudioState implements Parcelable { destination.writeInt(route); destination.writeInt(supportedRouteMask); } /** * @return {@code true} if the call is muted, false otherwise. */ public boolean isMuted() { return isMuted; } /** * @return The current audio route being used. */ public int getRoute() { return route; } /** * @return Bit mask of all routes supported by this call. */ public int getSupportedRouteMask() { return supportedRouteMask; } }
telecomm/java/android/telecom/Call.java +161 −4 Original line number Diff line number Diff line Loading @@ -97,6 +97,91 @@ public final class Call { public static final String AVAILABLE_PHONE_ACCOUNTS = "selectPhoneAccountAccounts"; public static class Details { /** Call can currently be put on hold or unheld. */ public static final int CAPABILITY_HOLD = 0x00000001; /** Call supports the hold feature. */ public static final int CAPABILITY_SUPPORT_HOLD = 0x00000002; /** * Calls within a conference can be merged. A {@link ConnectionService} has the option to * add a {@link Conference} call before the child {@link Connection}s are merged. This is how * CDMA-based {@link Connection}s are implemented. For these unmerged {@link Conference}s, this * capability allows a merge button to be shown while the conference call is in the foreground * of the in-call UI. * <p> * This is only intended for use by a {@link Conference}. */ public static final int CAPABILITY_MERGE_CONFERENCE = 0x00000004; /** * Calls within a conference can be swapped between foreground and background. * See {@link #CAPABILITY_MERGE_CONFERENCE} for additional information. * <p> * This is only intended for use by a {@link Conference}. */ public static final int CAPABILITY_SWAP_CONFERENCE = 0x00000008; /** * @hide */ public static final int CAPABILITY_UNUSED = 0x00000010; /** Call supports responding via text option. */ public static final int CAPABILITY_RESPOND_VIA_TEXT = 0x00000020; /** Call can be muted. */ public static final int CAPABILITY_MUTE = 0x00000040; /** * Call supports conference call management. This capability only applies to {@link Conference} * calls which can have {@link Connection}s as children. */ public static final int CAPABILITY_MANAGE_CONFERENCE = 0x00000080; /** * Local device supports video telephony. * @hide */ public static final int CAPABILITY_SUPPORTS_VT_LOCAL = 0x00000100; /** * Remote device supports video telephony. * @hide */ public static final int CAPABILITY_SUPPORTS_VT_REMOTE = 0x00000200; /** * Call is using voice over LTE. * @hide */ public static final int CAPABILITY_VoLTE = 0x00000400; /** * Call is using voice over WIFI. * @hide */ public static final int CAPABILITY_VoWIFI = 0x00000800; /** * Call is able to be separated from its parent {@code Conference}, if any. */ public static final int CAPABILITY_SEPARATE_FROM_CONFERENCE = 0x00001000; /** * Call is able to be individually disconnected when in a {@code Conference}. */ public static final int CAPABILITY_DISCONNECT_FROM_CONFERENCE = 0x00002000; /** * Whether the call is a generic conference, where we do not know the precise state of * participants in the conference (eg. on CDMA). * * @hide */ public static final int CAPABILITY_GENERIC_CONFERENCE = 0x00004000; private final Uri mHandle; private final int mHandlePresentation; private final String mCallerDisplayName; Loading @@ -111,6 +196,78 @@ public final class Call { private final StatusHints mStatusHints; private final Bundle mExtras; /** * Whether the supplied capabilities supports the specified capability. * * @param capabilities A bit field of capabilities. * @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 Details} 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(mCallCapabilities, capability); } /** * Render a set of capability bits ({@code CAPABILITY_*}) as a human readable string. * * @param capabilities A capability bit field. * @return A human readable string representation. */ public static String capabilitiesToString(int capabilities) { StringBuilder builder = new StringBuilder(); builder.append("[Capabilities:"); if (can(capabilities, CAPABILITY_HOLD)) { builder.append(" CAPABILITY_HOLD"); } if (can(capabilities, CAPABILITY_SUPPORT_HOLD)) { builder.append(" CAPABILITY_SUPPORT_HOLD"); } if (can(capabilities, CAPABILITY_MERGE_CONFERENCE)) { builder.append(" CAPABILITY_MERGE_CONFERENCE"); } if (can(capabilities, CAPABILITY_SWAP_CONFERENCE)) { builder.append(" CAPABILITY_SWAP_CONFERENCE"); } if (can(capabilities, CAPABILITY_RESPOND_VIA_TEXT)) { builder.append(" CAPABILITY_RESPOND_VIA_TEXT"); } if (can(capabilities, CAPABILITY_MUTE)) { builder.append(" CAPABILITY_MUTE"); } if (can(capabilities, CAPABILITY_MANAGE_CONFERENCE)) { builder.append(" CAPABILITY_MANAGE_CONFERENCE"); } if (can(capabilities, CAPABILITY_SUPPORTS_VT_LOCAL)) { builder.append(" CAPABILITY_SUPPORTS_VT_LOCAL"); } if (can(capabilities, CAPABILITY_SUPPORTS_VT_REMOTE)) { builder.append(" CAPABILITY_SUPPORTS_VT_REMOTE"); } if (can(capabilities, CAPABILITY_VoLTE)) { builder.append(" CAPABILITY_VoLTE"); } if (can(capabilities, CAPABILITY_VoWIFI)) { builder.append(" CAPABILITY_VoWIFI"); } if (can(capabilities, CAPABILITY_GENERIC_CONFERENCE)) { builder.append(" CAPABILITY_GENERIC_CONFERENCE"); } builder.append("]"); return builder.toString(); } /** * @return The handle (e.g., phone number) to which the {@code Call} is currently * connected. Loading Loading @@ -151,8 +308,8 @@ public final class Call { } /** * @return A bitmask of the capabilities of the {@code Call}, as defined in * {@link PhoneCapabilities}. * @return A bitmask of the capabilities of the {@code Call}, as defined by the various * {@code CAPABILITY_*} constants in this class. */ public int getCallCapabilities() { return mCallCapabilities; Loading Loading @@ -511,14 +668,14 @@ public final class Call { } /** * Merges the calls within this conference. See {@link PhoneCapabilities#MERGE_CONFERENCE}. * Merges the calls within this conference. See {@link Details#CAPABILITY_MERGE_CONFERENCE}. */ public void mergeConference() { mInCallAdapter.mergeConference(mTelecomCallId); } /** * Swaps the calls within this conference. See {@link PhoneCapabilities#SWAP_CONFERENCE}. * Swaps the calls within this conference. See {@link Details#CAPABILITY_SWAP_CONFERENCE}. */ public void swapConference() { mInCallAdapter.swapConference(mTelecomCallId); Loading
telecomm/java/android/telecom/Conference.java +70 −14 Original line number Diff line number Diff line Loading @@ -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<>(); Loading @@ -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() { Loading Loading @@ -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 {@code CAPABILITY_*} constants in class * {@link Connection} for valid values. * * @return A bitmask of the capabilities of the conference call. */ 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); } /** * Returns the capabilities of a conference. See {@link PhoneCapabilities} for valid values. * Removes the specified capability from the set of capabilities of this {@code Conference}. * * @return A bitmask of the {@code PhoneCapabilities} of the conference call. * @param capability The capability to remove from the set. * @hide */ public final int getCapabilities() { return mCapabilities; 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; } /** Loading Loading @@ -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() {} Loading Loading @@ -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); } } } Loading
telecomm/java/android/telecom/Connection.java +256 −39 File changed.Preview size limit exceeded, changes collapsed. Show changes
telecomm/java/android/telecom/ConnectionService.java +12 −10 Original line number Diff line number Diff line Loading @@ -407,11 +407,13 @@ public abstract class ConnectionService extends Service { } @Override public void onCapabilitiesChanged(Conference conference, int capabilities) { public void onConnectionCapabilitiesChanged( Conference conference, int connectionCapabilities) { String id = mIdByConference.get(conference); Log.d(this, "call capabilities: conference: %s", PhoneCapabilities.toString(capabilities)); mAdapter.setCallCapabilities(id, capabilities); Connection.capabilitiesToString(connectionCapabilities)); mAdapter.setConnectionCapabilities(id, connectionCapabilities); } }; Loading Loading @@ -489,11 +491,11 @@ public abstract class ConnectionService extends Service { } @Override public void onCallCapabilitiesChanged(Connection c, int capabilities) { public void onConnectionCapabilitiesChanged(Connection c, int capabilities) { String id = mIdByConnection.get(c); Log.d(this, "capabilities: parcelableconnection: %s", PhoneCapabilities.toString(capabilities)); mAdapter.setCallCapabilities(id, capabilities); Connection.capabilitiesToString(capabilities)); mAdapter.setConnectionCapabilities(id, capabilities); } @Override Loading Loading @@ -581,7 +583,7 @@ public abstract class ConnectionService extends Service { Log.v(this, "createConnection, number: %s, state: %s, capabilities: %s", Connection.toLogSafePhoneNumber(number), Connection.stateToString(connection.getState()), PhoneCapabilities.toString(connection.getCallCapabilities())); Connection.capabilitiesToString(connection.getConnectionCapabilities())); Log.d(this, "createConnection, calling handleCreateConnectionSuccessful %s", callId); mAdapter.handleCreateConnectionComplete( Loading @@ -590,7 +592,7 @@ public abstract class ConnectionService extends Service { new ParcelableConnection( request.getAccountHandle(), connection.getState(), connection.getCallCapabilities(), connection.getConnectionCapabilities(), connection.getAddress(), connection.getAddressPresentation(), connection.getCallerDisplayName(), Loading Loading @@ -873,7 +875,7 @@ public abstract class ConnectionService extends Service { ParcelableConference parcelableConference = new ParcelableConference( conference.getPhoneAccountHandle(), conference.getState(), conference.getCapabilities(), conference.getConnectionCapabilities(), connectionIds); mAdapter.addConferenceCall(id, parcelableConference); Loading Loading @@ -904,7 +906,7 @@ public abstract class ConnectionService extends Service { ParcelableConnection parcelableConnection = new ParcelableConnection( phoneAccountHandle, connection.getState(), connection.getCallCapabilities(), connection.getConnectionCapabilities(), connection.getAddress(), connection.getAddressPresentation(), connection.getCallerDisplayName(), Loading