diff options
Diffstat (limited to 'telecomm')
24 files changed, 883 insertions, 17 deletions
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java index 6511705..8af52f2 100644 --- a/telecomm/java/android/telecom/Call.java +++ b/telecomm/java/android/telecom/Call.java @@ -207,13 +207,43 @@ public final class Call { public static final int CAPABILITY_CAN_PAUSE_VIDEO = 0x00100000; /** + * Call has voice privacy capability. + * @hide + */ + public static final int CAPABILITY_VOICE_PRIVACY = 0x00400000; + + /** + * Local device supports downgrading a video call to a voice-only call. + * @hide + */ + public static final int CAPABILITY_SUPPORTS_DOWNGRADE_TO_VOICE_LOCAL = 0x00800000; + + /** + * Remote device supports downgrading a video call to a voice-only call. + * @hide + */ + public static final int CAPABILITY_SUPPORTS_DOWNGRADE_TO_VOICE_REMOTE = 0x01000000; + + /** + * Add participant in an active or conference call option + * @hide + */ + public static final int CAPABILITY_ADD_PARTICIPANT = 0x02000000; + + /** + * Remote device supports call transfers. + * @hide + */ + public static final int CAPABILITY_SUPPORTS_TRANSFER = 0x04000000; + + /** * Call sends responses through connection. * @hide */ - public static final int CAPABILITY_CAN_SEND_RESPONSE_VIA_CONNECTION = 0x00400000; + public static final int CAPABILITY_CAN_SEND_RESPONSE_VIA_CONNECTION = 0x08000000; //****************************************************************************************** - // Next CAPABILITY value: 0x00800000 + // Next CAPABILITY value: 0x10000000 //****************************************************************************************** /** @@ -242,8 +272,38 @@ public final class Call { */ public static final int PROPERTY_HIGH_DEF_AUDIO = 0x00000010; + /** + * Whether the call was forwarded from another party (GSM only) + * @hide + */ + public static final int PROPERTY_WAS_FORWARDED = 0x00000020; + + /** + * Whether the call is held remotely + * @hide + */ + public static final int PROPERTY_HELD_REMOTELY = 0x00000040; + + /** + * Whether the dialing state is waiting for the busy remote side + * @hide + */ + public static final int PROPERTY_DIALING_IS_WAITING = 0x00000080; + + /** + * Whether an additional call came in and was forwarded while the call was active + * @hide + */ + public static final int PROPERTY_ADDITIONAL_CALL_FORWARDED = 0x00000100; + + /** + * Whether incoming calls are barred at the remote side + * @hide + */ + public static final int PROPERTY_REMOTE_INCOMING_CALLS_BARRED = 0x00000200; + //****************************************************************************************** - // Next PROPERTY value: 0x00000020 + // Next PROPERTY value: 0x00000400 //****************************************************************************************** private final Uri mHandle; @@ -254,6 +314,7 @@ public final class Call { private final int mCallCapabilities; private final int mCallProperties; private final DisconnectCause mDisconnectCause; + private final long mCreateTimeMillis; private final long mConnectTimeMillis; private final GatewayInfo mGatewayInfo; private final int mVideoState; @@ -327,6 +388,12 @@ public final class Call { if (can(capabilities, CAPABILITY_SUPPORTS_VT_REMOTE_TX)) { builder.append(" CAPABILITY_SUPPORTS_VT_REMOTE_TX"); } + if (can(capabilities, CAPABILITY_SUPPORTS_DOWNGRADE_TO_VOICE_LOCAL)) { + builder.append(" CAPABILITY_SUPPORTS_DOWNGRADE_TO_VOICE_LOCAL"); + } + if (can(capabilities, CAPABILITY_SUPPORTS_DOWNGRADE_TO_VOICE_REMOTE)) { + builder.append(" CAPABILITY_SUPPORTS_DOWNGRADE_TO_VOICE_REMOTE"); + } if (can(capabilities, CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL)) { builder.append(" CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL"); } @@ -339,6 +406,15 @@ public final class Call { if (can(capabilities, CAPABILITY_CAN_PAUSE_VIDEO)) { builder.append(" CAPABILITY_CAN_PAUSE_VIDEO"); } + if (can(capabilities, CAPABILITY_VOICE_PRIVACY)) { + builder.append(" CAPABILITY_VOICE_PRIVACY"); + } + if (can(capabilities, CAPABILITY_ADD_PARTICIPANT)) { + builder.append(" CAPABILITY_ADD_PARTICIPANT"); + } + if (can(capabilities, CAPABILITY_SUPPORTS_TRANSFER)) { + builder.append(" CAPABILITY_SUPPORTS_TRANSFER"); + } builder.append("]"); return builder.toString(); } @@ -388,6 +464,22 @@ public final class Call { if (hasProperty(properties, PROPERTY_EMERGENCY_CALLBACK_MODE)) { builder.append(" PROPERTY_EMERGENCY_CALLBACK_MODE"); } + if (hasProperty(properties, PROPERTY_WAS_FORWARDED)) { + builder.append(" PROPERTY_WAS_FORWARDED"); + } + if (hasProperty(properties, PROPERTY_HELD_REMOTELY)) { + builder.append(" PROPERTY_HELD_REMOTELY"); + } + if (hasProperty(properties, PROPERTY_DIALING_IS_WAITING)) { + builder.append(" PROPERTY_DIALING_IS_WAITING"); + } + if (hasProperty(properties, PROPERTY_ADDITIONAL_CALL_FORWARDED)) { + builder.append(" PROPERTY_ADDITIONAL_CALL_FORWARDED"); + } + if (hasProperty(properties, PROPERTY_REMOTE_INCOMING_CALLS_BARRED)) { + builder.append(" PROPERTY_REMOTE_INCOMING_CALLS_BARRED"); + } + builder.append("]"); return builder.toString(); } @@ -465,6 +557,14 @@ public final class Call { } /** + * @return the time the Call object was created + * {@hide} + */ + public long getCreateTimeMillis() { + return mCreateTimeMillis; + } + + /** * @return Information about any calling gateway the {@code Call} may be using. */ public GatewayInfo getGatewayInfo() { @@ -514,6 +614,7 @@ public final class Call { Objects.equals(mCallCapabilities, d.mCallCapabilities) && Objects.equals(mCallProperties, d.mCallProperties) && Objects.equals(mDisconnectCause, d.mDisconnectCause) && + Objects.equals(mCreateTimeMillis, d.mCreateTimeMillis) && Objects.equals(mConnectTimeMillis, d.mConnectTimeMillis) && Objects.equals(mGatewayInfo, d.mGatewayInfo) && Objects.equals(mVideoState, d.mVideoState) && @@ -535,6 +636,7 @@ public final class Call { Objects.hashCode(mCallCapabilities) + Objects.hashCode(mCallProperties) + Objects.hashCode(mDisconnectCause) + + Objects.hashCode(mCreateTimeMillis) + Objects.hashCode(mConnectTimeMillis) + Objects.hashCode(mGatewayInfo) + Objects.hashCode(mVideoState) + @@ -553,6 +655,7 @@ public final class Call { int capabilities, int properties, DisconnectCause disconnectCause, + long createTimeMillis, long connectTimeMillis, GatewayInfo gatewayInfo, int videoState, @@ -567,6 +670,7 @@ public final class Call { mCallCapabilities = capabilities; mCallProperties = properties; mDisconnectCause = disconnectCause; + mCreateTimeMillis = createTimeMillis; mConnectTimeMillis = connectTimeMillis; mGatewayInfo = gatewayInfo; mVideoState = videoState; @@ -688,6 +792,28 @@ public final class Call { private Details mDetails; /** + * when mIsActiveSub True indicates this call belongs to active subscription + * Calls belonging to active subscription are shown to user. + */ + private boolean mIsActiveSub = false; + + /** + * Set this call object as active subscription. + * @hide + */ + public void setActive() { + mIsActiveSub = true; + } + + /** + * return if this call object belongs to active subscription. + * @hide + */ + public boolean isActive() { + return mIsActiveSub; + } + + /** * Obtains the post-dial sequence remaining to be emitted by this {@code Call}, if any. * * @return The remaining post-dial sequence, or {@code null} if there is no post-dial sequence @@ -817,6 +943,15 @@ public final class Call { } /** + * Instructs this {@code Call} to connect the current active call and the call on hold. + * The current call will then disconnect. See {@link Details#CAPABILITY_SUPPORTS_TRANSFER}. + * @hide + */ + public void transferCall() { + mInCallAdapter.transferCall(mTelecomCallId); + } + + /** * Swaps the calls within this conference. See {@link Details#CAPABILITY_SWAP_CONFERENCE}. */ public void swapConference() { @@ -977,11 +1112,22 @@ public final class Call { } /** {@hide} */ - Call(Phone phone, String telecomCallId, InCallAdapter inCallAdapter) { + Call(Phone phone, String telecomCallId, InCallAdapter inCallAdapter, boolean isActiveSub) { mPhone = phone; mTelecomCallId = telecomCallId; mInCallAdapter = inCallAdapter; mState = STATE_NEW; + mIsActiveSub = isActiveSub; + } + + /** {@hide} */ + Call(Phone phone, String telecomCallId, InCallAdapter inCallAdapter, int state, + boolean isActiveSub) { + mPhone = phone; + mTelecomCallId = telecomCallId; + mInCallAdapter = inCallAdapter; + mState = state; + mIsActiveSub = isActiveSub; } /** {@hide} */ @@ -1009,6 +1155,7 @@ public final class Call { parcelableCall.getCapabilities(), parcelableCall.getProperties(), parcelableCall.getDisconnectCause(), + parcelableCall.getCreateTimeMillis(), parcelableCall.getConnectTimeMillis(), parcelableCall.getGatewayInfo(), parcelableCall.getVideoState(), @@ -1034,9 +1181,10 @@ public final class Call { } int state = parcelableCall.getState(); - boolean stateChanged = mState != state; + boolean stateChanged = (mState != state) || (mIsActiveSub != parcelableCall.isActive()); if (stateChanged) { mState = state; + mIsActiveSub = parcelableCall.isActive(); } String parentId = parcelableCall.getParentCallId(); @@ -1113,6 +1261,11 @@ public final class Call { } } + /** {@hide} */ + final void onMergeFailed() { + fireStateChanged(mState); + } + private void fireStateChanged(final int newState) { for (CallbackRecord<Callback> record : mCallbackRecords) { final Call call = this; diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java index 77fdb65..046e615 100644 --- a/telecomm/java/android/telecom/Conference.java +++ b/telecomm/java/android/telecom/Conference.java @@ -51,6 +51,8 @@ public abstract class Conference extends Conferenceable { public void onDestroyed(Conference conference) {} public void onConnectionCapabilitiesChanged( Conference conference, int connectionCapabilities) {} + public void onConnectionPropertiesChanged( + Conference conference, int connectionProperties) {} public void onVideoStateChanged(Conference c, int videoState) { } public void onVideoProviderChanged(Conference c, Connection.VideoProvider videoProvider) {} public void onStatusHintsChanged(Conference conference, StatusHints statusHints) {} @@ -70,6 +72,7 @@ public abstract class Conference extends Conferenceable { private int mState = Connection.STATE_NEW; private DisconnectCause mDisconnectCause; private int mConnectionCapabilities; + private int mConnectionProperties; private String mDisconnectMessage; private long mConnectTimeMillis = CONNECT_TIME_NOT_SPECIFIED; private StatusHints mStatusHints; @@ -160,7 +163,10 @@ public abstract class Conference extends Conferenceable { * @hide */ public void removeCapability(int capability) { - mConnectionCapabilities &= ~capability; + int newCapabilities = mConnectionCapabilities; + newCapabilities &= ~capability; + + setConnectionCapabilities(newCapabilities); } /** @@ -170,7 +176,36 @@ public abstract class Conference extends Conferenceable { * @hide */ public void addCapability(int capability) { - mConnectionCapabilities |= capability; + int newCapabilities = mConnectionCapabilities; + newCapabilities |= capability; + + setConnectionCapabilities(newCapabilities); + } + + /** + * Returns a bit mask of this conference's properties. See the {@code PROPERTY_*} constants + * in the {@link Connection} class. + * @hide + */ + public final int getConnectionProperties() { + return mConnectionProperties; + } + + + /** + * Sets this conference's properties as a bit mask of the {@code PROPERTY_*} constants + * in the {@link Connection} class. + * + * @param connectionProperties The new connection properties. + * @hide + */ + public final void setConnectionProperties(int connectionProperties) { + if (mConnectionProperties != connectionProperties) { + mConnectionProperties = connectionProperties; + for (Listener l : mListeners) { + l.onConnectionPropertiesChanged(this, mConnectionProperties); + } + } } /** @@ -222,6 +257,14 @@ public abstract class Conference extends Conferenceable { public void onSeparate(Connection connection) {} /** + * Invoked when the conference adds a participant to the conference call. + * + * @param participant The participant to be added with conference call. + * @hide + */ + public void onAddParticipant(String participant) {} + + /** * Invoked when the specified {@link Connection} should merged with the conference call. * * @param connection The {@code Connection} to merge. @@ -559,6 +602,7 @@ public abstract class Conference extends Conferenceable { private void setState(int newState) { if (newState != Connection.STATE_ACTIVE && + newState != Connection.STATE_DIALING && newState != Connection.STATE_HOLDING && newState != Connection.STATE_DISCONNECTED) { Log.w(this, "Unsupported state transition for Conference call.", @@ -585,9 +629,11 @@ public abstract class Conference extends Conferenceable { @Override public String toString() { return String.format(Locale.US, - "[State: %s,Capabilites: %s, VideoState: %s, VideoProvider: %s, ThisObject %s]", + "[State: %s, Capabilites: %s, Properties: %s, " + + "VideoState: %s, VideoProvider: %s, ThisObject %s]", Connection.stateToString(mState), Call.Details.capabilitiesToString(mConnectionCapabilities), + Call.Details.propertiesToString(mConnectionProperties), getVideoState(), getVideoProvider(), super.toString()); diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index 520a1d7..5e2ec3c 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -227,6 +227,13 @@ public abstract class Connection extends Conferenceable { public static final int CAPABILITY_CAN_PAUSE_VIDEO = 0x00100000; /** + * Add participant in an active or conference call option + * + * @hide + */ + public static final int CAPABILITY_ADD_PARTICIPANT = 0x02000000; + + /** * For a conference, indicates the conference will not have child connections. * <p> * An example of a conference with child connections is a GSM conference call, where the radio @@ -247,6 +254,29 @@ public abstract class Connection extends Conferenceable { * @hide */ public static final int CAPABILITY_CONFERENCE_HAS_NO_CHILDREN = 0x00200000; + /** + * Call has voice privacy capability. + * @hide + */ + public static final int CAPABILITY_VOICE_PRIVACY = 0x00400000; + + /** + * Local device supports voice telephony. + * @hide + */ + public static final int CAPABILITY_SUPPORTS_DOWNGRADE_TO_VOICE_LOCAL = 0x00800000; + + /** + * Remote device supports voice telephony. + * @hide + */ + public static final int CAPABILITY_SUPPORTS_DOWNGRADE_TO_VOICE_REMOTE = 0x01000000; + + /** + * Remote device supports call transfers. + * @hide + */ + public static final int CAPABILITY_SUPPORTS_TRANSFER = 0x04000000; /** * Indicates that the connection itself wants to handle any sort of reply response, rather than @@ -260,6 +290,40 @@ public abstract class Connection extends Conferenceable { //********************************************************************************************** /** + * Whether the call was forwarded from another party (GSM only) + * @hide + */ + public static final int PROPERTY_WAS_FORWARDED = 0x00000001; + + /** + * Whether the call is held remotely + * @hide + */ + public static final int PROPERTY_HELD_REMOTELY = 0x00000002; + + /** + * Whether the dialing state is waiting for the busy remote side + * @hide + */ + public static final int PROPERTY_DIALING_IS_WAITING = 0x00000004; + + /** + * Whether an additional call came in and was forwarded while the call was active + * @hide + */ + public static final int PROPERTY_ADDITIONAL_CALL_FORWARDED = 0x00000008; + + /** + * Whether incoming calls are barred at the remote side + * @hide + */ + public static final int PROPERTY_REMOTE_INCOMING_CALLS_BARRED = 0x00000010; + + //****************************************************************************************** + // Next PROPERTY value: 0x00000020 + //****************************************************************************************** + + /** * Connection extra key used to store the last forwarded number associated with the current * connection. Used to communicate to the user interface that the connection was forwarded via * the specified number. @@ -282,6 +346,13 @@ public abstract class Connection extends Conferenceable { */ public static final String EXTRA_CALL_SUBJECT = "android.telecom.extra.CALL_SUBJECT"; + /** + * Call extras key to pack/unpack call history info. + * The value for this key should be an ArrayList of Strings. + * @hide + */ + public static final String EXTRA_CALL_HISTORY_INFO = "EXTRA_CALL_HISTORY_INFO"; + // Flag controlling whether PII is emitted into the logs private static final boolean PII_DEBUG = Log.isLoggable(android.util.Log.DEBUG); @@ -328,7 +399,6 @@ public abstract class Connection extends Conferenceable { mConnectionCapabilities |= capability; } - public static String capabilitiesToString(int capabilities) { StringBuilder builder = new StringBuilder(); builder.append("[Capabilities:"); @@ -371,6 +441,12 @@ public abstract class Connection extends Conferenceable { if (can(capabilities, CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL)) { builder.append(" CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL"); } + if (can(capabilities, CAPABILITY_SUPPORTS_DOWNGRADE_TO_VOICE_LOCAL)) { + builder.append(" CAPABILITY_SUPPORTS_DOWNGRADE_TO_VOICE_LOCAL"); + } + if (can(capabilities, CAPABILITY_SUPPORTS_DOWNGRADE_TO_VOICE_REMOTE)) { + builder.append(" CAPABILITY_SUPPORTS_DOWNGRADE_TO_VOICE_REMOTE"); + } if (can(capabilities, CAPABILITY_HIGH_DEF_AUDIO)) { builder.append(" CAPABILITY_HIGH_DEF_AUDIO"); } @@ -403,6 +479,75 @@ public abstract class Connection extends Conferenceable { return builder.toString(); } + /** + * Whether the given properties include the specified property. + * + * @param properties A property bit field. + * @param property The property to check properties for. + * @return Whether the specified property is present. + * @hide + */ + public static boolean hasProperty(int properties, int property) { + return (properties & property) != 0; + } + + /** + * Whether the properties of this {@code Connection} include the specified property. + * + * @param property The property to look for. + * @return Whether the specified property is present. + * @hide + */ + public boolean hasProperty(int property) { + return hasProperty(mConnectionProperties, property); + } + + /** + * Removes the specified property from the set of properties of this {@code Connection}. + * + * @param property The property to remove from the set. + * @hide + */ + public void removeProperty(int property) { + mConnectionProperties &= ~property; + } + + /** + * Adds the specified property to the set of propertes of this {@code Connection}. + * + * @param property The property to add to the set. + * @hide + */ + public void addProperty(int property) { + mConnectionProperties |= property; + } + + /** + * @hide + */ + public static String propertiesToString(int properties) { + StringBuilder builder = new StringBuilder(); + builder.append("[Properties:"); + + if (hasProperty(properties, PROPERTY_WAS_FORWARDED)) { + builder.append(" PROPERTY_WAS_FORWARDED"); + } + if (hasProperty(properties, PROPERTY_HELD_REMOTELY)) { + builder.append(" PROPERTY_HELD_REMOTELY"); + } + if (hasProperty(properties, PROPERTY_DIALING_IS_WAITING)) { + builder.append(" PROPERTY_DIALING_IS_WAITING"); + } + if (hasProperty(properties, PROPERTY_ADDITIONAL_CALL_FORWARDED)) { + builder.append(" PROPERTY_ADDITIONAL_CALL_FORWARDED"); + } + if (hasProperty(properties, PROPERTY_REMOTE_INCOMING_CALLS_BARRED)) { + builder.append(" PROPERTY_REMOTE_INCOMING_CALLS_BARRED"); + } + builder.append("]"); + return builder.toString(); + } + /** @hide */ public abstract static class Listener { public void onStateChanged(Connection c, int state) {} @@ -416,6 +561,7 @@ public abstract class Connection extends Conferenceable { public void onRingbackRequested(Connection c, boolean ringback) {} public void onDestroyed(Connection c) {} public void onConnectionCapabilitiesChanged(Connection c, int capabilities) {} + public void onConnectionPropertiesChanged(Connection c, int properties) {} public void onVideoProviderChanged( Connection c, VideoProvider videoProvider) {} public void onAudioModeIsVoipChanged(Connection c, boolean isVoip) {} @@ -429,6 +575,7 @@ public abstract class Connection extends Conferenceable { public void onConferenceStarted() {} public void onConferenceMergeFailed(Connection c) {} public void onExtrasChanged(Connection c, Bundle extras) {} + public void onCdmaConnectionTimeReset(Connection c) {} } /** @@ -1082,6 +1229,7 @@ public abstract class Connection extends Conferenceable { private int mCallerDisplayNamePresentation; private boolean mRingbackRequested = false; private int mConnectionCapabilities; + private int mConnectionProperties; private VideoProvider mVideoProvider; private boolean mAudioModeIsVoip; private long mConnectTimeMillis = Conference.CONNECT_TIME_NOT_SPECIFIED; @@ -1306,6 +1454,14 @@ public abstract class Connection extends Conferenceable { } /** + * Returns the connection's properties, as a bit mask of the {@code PROPERTY_*} constants. + * @hide + */ + public final int getConnectionProperties() { + return mConnectionProperties; + } + + /** * Sets the value of the {@link #getAddress()} property. * * @param address The new address. @@ -1502,6 +1658,22 @@ public abstract class Connection extends Conferenceable { } /** + * Sets the connection's properties as a bit mask of the {@code PROPERTY_*} constants. + * + * @param connectionProperties The new connection properties. + * @hide + */ + public final void setConnectionProperties(int connectionProperties) { + checkImmutable(); + if (mConnectionProperties != connectionProperties) { + mConnectionProperties = connectionProperties; + for (Listener l : mListeners) { + l.onConnectionPropertiesChanged(this, mConnectionProperties); + } + } + } + + /** * Tears down the Connection object. */ public final void destroy() { @@ -1593,6 +1765,16 @@ public abstract class Connection extends Conferenceable { } /** + *@hide + * Resets the cdma connection time. + */ + public final void resetCdmaConnectionTime() { + for (Listener l : mListeners) { + l.onCdmaConnectionTimeReset(this); + } + } + + /** * Returns the connections or conferences with which this connection can be conferenced. */ public final List<Conferenceable> getConferenceables() { @@ -1718,6 +1900,12 @@ public abstract class Connection extends Conferenceable { public void onStopDtmfTone() {} /** + * Notifies this to set local call hold. + * {@hide} + */ + public void setLocalCallHold(boolean lchState) {} + + /** * Notifies this Connection of a request to disconnect. */ public void onDisconnect() {} @@ -1774,6 +1962,12 @@ public abstract class Connection extends Conferenceable { public void onReject() {} /** + * Transfers the current call. + * @hide + */ + public void onTransfer() { } + + /** * Notifies ths Connection of a request reject with a message. * * @hide diff --git a/telecomm/java/android/telecom/ConnectionRequest.java b/telecomm/java/android/telecom/ConnectionRequest.java index 6863214..2e8f8fd 100644 --- a/telecomm/java/android/telecom/ConnectionRequest.java +++ b/telecomm/java/android/telecom/ConnectionRequest.java @@ -28,7 +28,7 @@ import android.os.Parcelable; public final class ConnectionRequest implements Parcelable { // TODO: Token to limit recursive invocations - private final PhoneAccountHandle mAccountHandle; + private PhoneAccountHandle mAccountHandle; private final Uri mAddress; private final Bundle mExtras; private final int mVideoState; @@ -74,6 +74,9 @@ public final class ConnectionRequest implements Parcelable { */ public PhoneAccountHandle getAccountHandle() { return mAccountHandle; } + /** {@hide} */ + public void setAccountHandle(PhoneAccountHandle acc) { mAccountHandle = acc; } + /** * The handle (e.g., phone number) to which the {@link Connection} is to connect. */ diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index ceaa1bf..f64fc99 100644 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -103,6 +103,10 @@ public abstract class ConnectionService extends Service { private static final int MSG_SWAP_CONFERENCE = 19; private static final int MSG_REJECT_WITH_MESSAGE = 20; private static final int MSG_SILENCE = 21; + private static final int MSG_SET_LOCAL_HOLD = 22; + private static final int MSG_EXPLICIT_TRANSFER = 23; + //Proprietary values starts after this. + private static final int MSG_ADD_PARTICIPANT_WITH_CONFERENCE = 30; private static Connection sNullConnection; @@ -214,6 +218,14 @@ public abstract class ConnectionService extends Service { } @Override + public void setLocalCallHold(String callId, boolean lchState) { + SomeArgs args = SomeArgs.obtain(); + args.arg1 = callId; + args.argi1 = lchState ? 1 : 0; + mHandler.obtainMessage(MSG_SET_LOCAL_HOLD, args).sendToTarget(); + } + + @Override public void conference(String callId1, String callId2) { SomeArgs args = SomeArgs.obtain(); args.arg1 = callId1; @@ -227,6 +239,14 @@ public abstract class ConnectionService extends Service { } @Override + public void addParticipantWithConference(String callId, String participant) { + SomeArgs args = SomeArgs.obtain(); + args.arg1 = callId; + args.arg2 = participant; + mHandler.obtainMessage(MSG_ADD_PARTICIPANT_WITH_CONFERENCE, args).sendToTarget(); + } + + @Override public void mergeConference(String callId) { mHandler.obtainMessage(MSG_MERGE_CONFERENCE, callId).sendToTarget(); } @@ -243,6 +263,11 @@ public abstract class ConnectionService extends Service { args.argi1 = proceed ? 1 : 0; mHandler.obtainMessage(MSG_ON_POST_DIAL_CONTINUE, args).sendToTarget(); } + + @Override + public void explicitTransfer(String callId) { + mHandler.obtainMessage(MSG_EXPLICIT_TRANSFER, callId).sendToTarget(); + } }; private final Handler mHandler = new Handler(Looper.getMainLooper()) { @@ -349,6 +374,17 @@ public abstract class ConnectionService extends Service { case MSG_STOP_DTMF_TONE: stopDtmfTone((String) msg.obj); break; + case MSG_SET_LOCAL_HOLD: { + SomeArgs args = (SomeArgs) msg.obj; + try { + String callId = (String) args.arg1; + boolean lchStatus = (args.argi1 == 1); + setLocalCallHold(callId, lchStatus); + } finally { + args.recycle(); + } + break; + } case MSG_CONFERENCE: { SomeArgs args = (SomeArgs) msg.obj; try { @@ -363,6 +399,17 @@ public abstract class ConnectionService extends Service { case MSG_SPLIT_FROM_CONFERENCE: splitFromConference((String) msg.obj); break; + case MSG_ADD_PARTICIPANT_WITH_CONFERENCE: { + SomeArgs args = (SomeArgs) msg.obj; + try { + String callId = (String) args.arg1; + String participant = (String) args.arg2; + addParticipantWithConference(callId, participant); + } finally { + args.recycle(); + } + break; + } case MSG_MERGE_CONFERENCE: mergeConference((String) msg.obj); break; @@ -380,6 +427,9 @@ public abstract class ConnectionService extends Service { } break; } + case MSG_EXPLICIT_TRANSFER: + transfer((String) msg.obj); + break; default: break; } @@ -441,6 +491,16 @@ public abstract class ConnectionService extends Service { } @Override + public void onConnectionPropertiesChanged( + Conference conference, + int connectionProperties) { + String id = mIdByConference.get(conference); + Log.d(this, "call properties: conference: %s", + Connection.propertiesToString(connectionProperties)); + mAdapter.setConnectionProperties(id, connectionProperties); + } + + @Override public void onVideoStateChanged(Conference c, int videoState) { String id = mIdByConference.get(c); Log.d(this, "onVideoStateChanged set video state %d", videoState); @@ -557,6 +617,14 @@ public abstract class ConnectionService extends Service { } @Override + public void onConnectionPropertiesChanged(Connection c, int properties) { + String id = mIdByConnection.get(c); + Log.d(this, "properties: parcelableconnection: %s", + Connection.propertiesToString(properties)); + mAdapter.setConnectionProperties(id, properties); + } + + @Override public void onVideoProviderChanged(Connection c, Connection.VideoProvider videoProvider) { String id = mIdByConnection.get(c); Log.d(this, "onVideoProviderChanged: Connection: %s, VideoProvider: %s", c, @@ -611,6 +679,12 @@ public abstract class ConnectionService extends Service { mAdapter.setExtras(id, extras); } } + + @Override + public void onCdmaConnectionTimeReset(Connection c) { + String id = mIdByConnection.get(c); + mAdapter.resetCdmaConnectionTime(id); + } }; /** {@inheritDoc} */ @@ -656,10 +730,11 @@ public abstract class ConnectionService extends Service { Uri address = connection.getAddress(); String number = address == null ? "null" : address.getSchemeSpecificPart(); - Log.v(this, "createConnection, number: %s, state: %s, capabilities: %s", + Log.v(this, "createConnection, number: %s, state: %s, capabilities: %s, properties: %s", Connection.toLogSafePhoneNumber(number), Connection.stateToString(connection.getState()), - Connection.capabilitiesToString(connection.getConnectionCapabilities())); + Connection.capabilitiesToString(connection.getConnectionCapabilities()), + Connection.propertiesToString(connection.getConnectionProperties())); Log.d(this, "createConnection, calling handleCreateConnectionSuccessful %s", callId); mAdapter.handleCreateConnectionComplete( @@ -669,6 +744,7 @@ public abstract class ConnectionService extends Service { request.getAccountHandle(), connection.getState(), connection.getConnectionCapabilities(), + connection.getConnectionProperties(), connection.getAddress(), connection.getAddressPresentation(), connection.getCallerDisplayName(), @@ -736,6 +812,11 @@ public abstract class ConnectionService extends Service { } } + private void transfer(String callId) { + Log.d(this, "transfer %s", callId); + findConnectionForAction(callId, "transfer").onTransfer(); + } + private void unhold(String callId) { Log.d(this, "unhold %s", callId); if (mConnectionById.containsKey(callId)) { @@ -774,6 +855,11 @@ public abstract class ConnectionService extends Service { } } + private void setLocalCallHold(String callId, boolean lchStatus) { + Log.d(this, "setLocalCallHold %s", callId); + findConnectionForAction(callId, "setLocalCallHold").setLocalCallHold(lchStatus); + } + private void conference(String callId1, String callId2) { Log.d(this, "conference %s, %s", callId1, callId2); @@ -836,6 +922,17 @@ public abstract class ConnectionService extends Service { } } + private void addParticipantWithConference(String callId, String participant) { + Log.d(this, "ConnectionService addParticipantWithConference(%s, %s)", participant, callId); + Conference conference = findConferenceForAction(callId, "addParticipantWithConference"); + Connection connection = findConnectionForAction(callId, "addParticipantWithConnection"); + if (connection != getNullConnection()) { + onAddParticipant(connection, participant); + } else if (conference != getNullConference()) { + conference.onAddParticipant(participant); + } + } + private void mergeConference(String callId) { Log.d(this, "mergeConference(%s)", callId); Conference conference = findConferenceForAction(callId, "mergeConference"); @@ -971,6 +1068,7 @@ public abstract class ConnectionService extends Service { conference.getPhoneAccountHandle(), conference.getState(), conference.getConnectionCapabilities(), + conference.getConnectionProperties(), connectionIds, conference.getVideoProvider() == null ? null : conference.getVideoProvider().getInterface(), @@ -1011,6 +1109,7 @@ public abstract class ConnectionService extends Service { phoneAccountHandle, connection.getState(), connection.getConnectionCapabilities(), + connection.getConnectionProperties(), connection.getAddress(), connection.getAddressPresentation(), connection.getCallerDisplayName(), @@ -1122,6 +1221,19 @@ public abstract class ConnectionService extends Service { public void onConference(Connection connection1, Connection connection2) {} /** + * Add participant with connection. Invoked when user has made a request to add + * participant with specified connection. In response, the participant should add with + * the connection. + * + * @param connection A connection where participant need to add. + * @param participant Address of participant which will be added. + * @return + * + * @hide + */ + public void onAddParticipant(Connection connection, String participant) {} + + /** * Indicates that a remote conference has been created for existing {@link RemoteConnection}s. * When this method is invoked, this {@link ConnectionService} should create its own * representation of the conference call and send it to telecom using {@link #addConference}. diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapter.java b/telecomm/java/android/telecom/ConnectionServiceAdapter.java index 4562514..f4bf835 100644 --- a/telecomm/java/android/telecom/ConnectionServiceAdapter.java +++ b/telecomm/java/android/telecom/ConnectionServiceAdapter.java @@ -196,6 +196,15 @@ final class ConnectionServiceAdapter implements DeathRecipient { } } + void setConnectionProperties(String callId, int properties) { + for (IConnectionServiceAdapter adapter : mAdapters) { + try { + adapter.setConnectionProperties(callId, properties); + } catch (RemoteException ignored) { + } + } + } + /** * Indicates whether or not the specified call is currently conferenced into the specified * conference call. @@ -230,6 +239,18 @@ final class ConnectionServiceAdapter implements DeathRecipient { } /** + * Resets the cdma connection time. + */ + void resetCdmaConnectionTime(String callId) { + for (IConnectionServiceAdapter adapter : mAdapters) { + try { + adapter.resetCdmaConnectionTime(callId); + } catch (RemoteException e) { + } + } + } + + /** * Indicates that the call no longer exists. Can be used with either a call or a conference * call. * diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java index 293dc11..f167fc1 100644 --- a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java +++ b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java @@ -62,6 +62,7 @@ final class ConnectionServiceAdapterServant { private static final int MSG_ON_POST_DIAL_CHAR = 22; private static final int MSG_SET_CONFERENCE_MERGE_FAILED = 23; private static final int MSG_SET_EXTRAS = 24; + private static final int MSG_SET_CONNECTION_PROPERTIES = 25; private final IConnectionServiceAdapter mDelegate; @@ -116,6 +117,9 @@ final class ConnectionServiceAdapterServant { case MSG_SET_CONNECTION_CAPABILITIES: mDelegate.setConnectionCapabilities((String) msg.obj, msg.arg1); break; + case MSG_SET_CONNECTION_PROPERTIES: + mDelegate.setConnectionProperties((String) msg.obj, msg.arg1); + break; case MSG_SET_IS_CONFERENCED: { SomeArgs args = (SomeArgs) msg.obj; try { @@ -300,6 +304,13 @@ final class ConnectionServiceAdapterServant { } @Override + public void setConnectionProperties(String connectionId, int connectionProperties) { + mHandler.obtainMessage( + MSG_SET_CONNECTION_PROPERTIES, connectionProperties, 0, connectionId) + .sendToTarget(); + } + + @Override public void setConferenceMergeFailed(String callId) { SomeArgs args = SomeArgs.obtain(); args.arg1 = callId; @@ -419,6 +430,10 @@ final class ConnectionServiceAdapterServant { args.arg2 = extras; mHandler.obtainMessage(MSG_SET_EXTRAS, args).sendToTarget(); } + + @Override + public void resetCdmaConnectionTime(String callId) { + } }; public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) { diff --git a/telecomm/java/android/telecom/InCallAdapter.java b/telecomm/java/android/telecom/InCallAdapter.java index 0cf7212..8eb62ec 100644 --- a/telecomm/java/android/telecom/InCallAdapter.java +++ b/telecomm/java/android/telecom/InCallAdapter.java @@ -240,6 +240,13 @@ public final class InCallAdapter { } } + public void transferCall(String callId) { + try { + mAdapter.transferCall(callId); + } catch (RemoteException ignored) { + } + } + /** * Instructs Telecom to swap the child calls of the specified conference call. */ @@ -273,4 +280,17 @@ public final class InCallAdapter { } catch (RemoteException ignored) { } } + + /** + * Instructs Telecomm to switch to other active subscripion + * + * @param subid switch to subscription denoted by subId + * {@hide} + */ + public void switchToOtherActiveSub(String subId) { + try { + mAdapter.switchToOtherActiveSub(subId); + } catch (RemoteException e) { + } + } } diff --git a/telecomm/java/android/telecom/InCallService.java b/telecomm/java/android/telecom/InCallService.java index 19c613d..1b6a98f 100644 --- a/telecomm/java/android/telecom/InCallService.java +++ b/telecomm/java/android/telecom/InCallService.java @@ -73,6 +73,7 @@ public abstract class InCallService extends Service { private static final int MSG_ON_CALL_AUDIO_STATE_CHANGED = 5; private static final int MSG_BRING_TO_FOREGROUND = 6; private static final int MSG_ON_CAN_ADD_CALL_CHANGED = 7; + private static final int MSG_ON_MERGE_FAILED = 8; /** Default Handler used to consolidate binder method calls onto a single thread. */ private final Handler mHandler = new Handler(Looper.getMainLooper()) { @@ -91,6 +92,9 @@ public abstract class InCallService extends Service { case MSG_ADD_CALL: mPhone.internalAddCall((ParcelableCall) msg.obj); break; + case MSG_ON_MERGE_FAILED: + mPhone.onMergeFailed((ParcelableCall) msg.obj); + break; case MSG_UPDATE_CALL: mPhone.internalUpdateCall((ParcelableCall) msg.obj); break; @@ -156,6 +160,11 @@ public abstract class InCallService extends Service { } @Override + public void onMergeFailed(ParcelableCall call) { + mHandler.obtainMessage(MSG_ON_MERGE_FAILED, call).sendToTarget(); + } + + @Override public void bringToForeground(boolean showDialpad) { mHandler.obtainMessage(MSG_BRING_TO_FOREGROUND, showDialpad ? 1 : 0, 0).sendToTarget(); } @@ -301,6 +310,18 @@ public abstract class InCallService extends Service { } /** + * Instructs Telecomm to switch to other active subscripion + * + * @param subId switch to this subscription + * @hide + */ + public void switchToOtherActiveSub(String subId) { + if (mPhone != null) { + mPhone.switchToOtherActiveSub(subId); + } + } + + /** * Sets the audio route (speaker, bluetooth, etc...). When this request is honored, there will * be change to the {@link #getCallAudioState()}. * diff --git a/telecomm/java/android/telecom/ParcelableCall.java b/telecomm/java/android/telecom/ParcelableCall.java index 8cf4aeb..5b343e6 100644 --- a/telecomm/java/android/telecom/ParcelableCall.java +++ b/telecomm/java/android/telecom/ParcelableCall.java @@ -39,6 +39,7 @@ public final class ParcelableCall implements Parcelable { private final List<String> mCannedSmsResponses; private final int mCapabilities; private final int mProperties; + private final long mCreateTimeMillis; private final long mConnectTimeMillis; private final Uri mHandle; private final int mHandlePresentation; @@ -56,6 +57,7 @@ public final class ParcelableCall implements Parcelable { private final List<String> mConferenceableCallIds; private final Bundle mIntentExtras; private final Bundle mExtras; + private final boolean mIsActiveSub; public ParcelableCall( String id, @@ -64,6 +66,7 @@ public final class ParcelableCall implements Parcelable { List<String> cannedSmsResponses, int capabilities, int properties, + long createTimeMillis, long connectTimeMillis, Uri handle, int handlePresentation, @@ -79,13 +82,15 @@ public final class ParcelableCall implements Parcelable { int videoState, List<String> conferenceableCallIds, Bundle intentExtras, - Bundle extras) { + Bundle extras, + boolean isActiveSub) { mId = id; mState = state; mDisconnectCause = disconnectCause; mCannedSmsResponses = cannedSmsResponses; mCapabilities = capabilities; mProperties = properties; + mCreateTimeMillis = createTimeMillis; mConnectTimeMillis = connectTimeMillis; mHandle = handle; mHandlePresentation = handlePresentation; @@ -102,6 +107,7 @@ public final class ParcelableCall implements Parcelable { mConferenceableCallIds = Collections.unmodifiableList(conferenceableCallIds); mIntentExtras = intentExtras; mExtras = extras; + mIsActiveSub = isActiveSub; } /** The unique ID of the call. */ @@ -137,6 +143,11 @@ public final class ParcelableCall implements Parcelable { /** Bitmask of properties of the call. */ public int getProperties() { return mProperties; } + /** The time that the call object was created */ + public long getCreateTimeMillis() { + return mCreateTimeMillis; + } + /** The time that the call switched to the active state. */ public long getConnectTimeMillis() { return mConnectTimeMillis; @@ -259,6 +270,13 @@ public final class ParcelableCall implements Parcelable { return mIsVideoCallProviderChanged; } + /** + * return if this call object belongs to active subscription. + */ + public boolean isActive() { + return mIsActiveSub; + } + /** Responsible for creating ParcelableCall objects for deserialized Parcels. */ public static final Parcelable.Creator<ParcelableCall> CREATOR = new Parcelable.Creator<ParcelableCall> () { @@ -272,6 +290,7 @@ public final class ParcelableCall implements Parcelable { source.readList(cannedSmsResponses, classLoader); int capabilities = source.readInt(); int properties = source.readInt(); + long createTimeMillis = source.readLong(); long connectTimeMillis = source.readLong(); Uri handle = source.readParcelable(classLoader); int handlePresentation = source.readInt(); @@ -291,6 +310,7 @@ public final class ParcelableCall implements Parcelable { source.readList(conferenceableCallIds, classLoader); Bundle intentExtras = source.readBundle(classLoader); Bundle extras = source.readBundle(classLoader); + boolean isActiveSub = (source.readInt() == 1) ? true : false; return new ParcelableCall( id, state, @@ -298,6 +318,7 @@ public final class ParcelableCall implements Parcelable { cannedSmsResponses, capabilities, properties, + createTimeMillis, connectTimeMillis, handle, handlePresentation, @@ -313,7 +334,8 @@ public final class ParcelableCall implements Parcelable { videoState, conferenceableCallIds, intentExtras, - extras); + extras, + isActiveSub); } @Override @@ -337,6 +359,7 @@ public final class ParcelableCall implements Parcelable { destination.writeList(mCannedSmsResponses); destination.writeInt(mCapabilities); destination.writeInt(mProperties); + destination.writeLong(mCreateTimeMillis); destination.writeLong(mConnectTimeMillis); destination.writeParcelable(mHandle, 0); destination.writeInt(mHandlePresentation); @@ -354,6 +377,7 @@ public final class ParcelableCall implements Parcelable { destination.writeList(mConferenceableCallIds); destination.writeBundle(mIntentExtras); destination.writeBundle(mExtras); + destination.writeInt(mIsActiveSub ? 1 : 0); } @Override diff --git a/telecomm/java/android/telecom/ParcelableConference.java b/telecomm/java/android/telecom/ParcelableConference.java index 870f5ee..8da5734 100644 --- a/telecomm/java/android/telecom/ParcelableConference.java +++ b/telecomm/java/android/telecom/ParcelableConference.java @@ -34,6 +34,7 @@ public final class ParcelableConference implements Parcelable { private PhoneAccountHandle mPhoneAccount; private int mState; private int mConnectionCapabilities; + private int mConnectionProperties; private List<String> mConnectionIds; private long mConnectTimeMillis = Conference.CONNECT_TIME_NOT_SPECIFIED; private final IVideoProvider mVideoProvider; @@ -45,6 +46,7 @@ public final class ParcelableConference implements Parcelable { PhoneAccountHandle phoneAccount, int state, int connectionCapabilities, + int connectionProperties, List<String> connectionIds, IVideoProvider videoProvider, int videoState, @@ -54,6 +56,7 @@ public final class ParcelableConference implements Parcelable { mPhoneAccount = phoneAccount; mState = state; mConnectionCapabilities = connectionCapabilities; + mConnectionProperties = connectionProperties; mConnectionIds = connectionIds; mConnectTimeMillis = Conference.CONNECT_TIME_NOT_SPECIFIED; mVideoProvider = videoProvider; @@ -72,6 +75,8 @@ public final class ParcelableConference implements Parcelable { .append(Connection.stateToString(mState)) .append(", capabilities: ") .append(Connection.capabilitiesToString(mConnectionCapabilities)) + .append(", properties: ") + .append(Connection.propertiesToString(mConnectionProperties)) .append(", connectTime: ") .append(mConnectTimeMillis) .append(", children: ") @@ -95,6 +100,10 @@ public final class ParcelableConference implements Parcelable { return mConnectionCapabilities; } + public int getConnectionProperties() { + return mConnectionProperties; + } + public List<String> getConnectionIds() { return mConnectionIds; } @@ -126,6 +135,7 @@ public final class ParcelableConference implements Parcelable { PhoneAccountHandle phoneAccount = source.readParcelable(classLoader); int state = source.readInt(); int capabilities = source.readInt(); + int properties = source.readInt(); List<String> connectionIds = new ArrayList<>(2); source.readList(connectionIds, classLoader); long connectTimeMillis = source.readLong(); @@ -135,8 +145,9 @@ public final class ParcelableConference implements Parcelable { StatusHints statusHints = source.readParcelable(classLoader); Bundle extras = source.readBundle(classLoader); - return new ParcelableConference(phoneAccount, state, capabilities, connectionIds, - videoCallProvider, videoState, connectTimeMillis, statusHints, extras); + return new ParcelableConference(phoneAccount, state, capabilities, properties, + connectionIds, videoCallProvider, videoState, + connectTimeMillis, statusHints, extras); } @Override @@ -157,6 +168,7 @@ public final class ParcelableConference implements Parcelable { destination.writeParcelable(mPhoneAccount, 0); destination.writeInt(mState); destination.writeInt(mConnectionCapabilities); + destination.writeInt(mConnectionProperties); destination.writeList(mConnectionIds); destination.writeLong(mConnectTimeMillis); destination.writeStrongBinder( diff --git a/telecomm/java/android/telecom/ParcelableConnection.java b/telecomm/java/android/telecom/ParcelableConnection.java index fe0a4d8..eca06af 100644 --- a/telecomm/java/android/telecom/ParcelableConnection.java +++ b/telecomm/java/android/telecom/ParcelableConnection.java @@ -36,6 +36,7 @@ public final class ParcelableConnection implements Parcelable { private final PhoneAccountHandle mPhoneAccount; private final int mState; private final int mConnectionCapabilities; + private final int mConnectionProperties; private final Uri mAddress; private final int mAddressPresentation; private final String mCallerDisplayName; @@ -55,6 +56,7 @@ public final class ParcelableConnection implements Parcelable { PhoneAccountHandle phoneAccount, int state, int capabilities, + int properties, Uri address, int addressPresentation, String callerDisplayName, @@ -71,6 +73,7 @@ public final class ParcelableConnection implements Parcelable { mPhoneAccount = phoneAccount; mState = state; mConnectionCapabilities = capabilities; + mConnectionProperties = properties; mAddress = address; mAddressPresentation = addressPresentation; mCallerDisplayName = callerDisplayName; @@ -99,6 +102,10 @@ public final class ParcelableConnection implements Parcelable { return mConnectionCapabilities; } + public int getConnectionProperties() { + return mConnectionProperties; + } + public Uri getHandle() { return mAddress; } @@ -160,6 +167,8 @@ public final class ParcelableConnection implements Parcelable { .append(mState) .append(", capabilities:") .append(Connection.capabilitiesToString(mConnectionCapabilities)) + .append(", properties:") + .append(Connection.propertiesToString(mConnectionProperties)) .append(", extras:") .append(mExtras) .toString(); @@ -174,6 +183,7 @@ public final class ParcelableConnection implements Parcelable { PhoneAccountHandle phoneAccount = source.readParcelable(classLoader); int state = source.readInt(); int capabilities = source.readInt(); + int properties = source.readInt(); Uri address = source.readParcelable(classLoader); int addressPresentation = source.readInt(); String callerDisplayName = source.readString(); @@ -194,6 +204,7 @@ public final class ParcelableConnection implements Parcelable { phoneAccount, state, capabilities, + properties, address, addressPresentation, callerDisplayName, @@ -227,6 +238,7 @@ public final class ParcelableConnection implements Parcelable { destination.writeParcelable(mPhoneAccount, 0); destination.writeInt(mState); destination.writeInt(mConnectionCapabilities); + destination.writeInt(mConnectionProperties); destination.writeParcelable(mAddress, 0); destination.writeInt(mAddressPresentation); destination.writeString(mCallerDisplayName); diff --git a/telecomm/java/android/telecom/Phone.java b/telecomm/java/android/telecom/Phone.java index 47154da..0fd124d 100644 --- a/telecomm/java/android/telecom/Phone.java +++ b/telecomm/java/android/telecom/Phone.java @@ -123,7 +123,7 @@ public final class Phone { final void internalAddCall(ParcelableCall parcelableCall) { Call call = new Call(this, parcelableCall.getId(), mInCallAdapter, - parcelableCall.getState()); + parcelableCall.getState(), parcelableCall.isActive()); mCallByTelecomCallId.put(parcelableCall.getId(), call); mCalls.add(call); checkCallTree(parcelableCall); @@ -179,6 +179,12 @@ public final class Phone { } } + final void onMergeFailed(ParcelableCall parcelableCall) { + Call call = mCallByTelecomCallId.get(parcelableCall.getId()); + if (call != null) { + call.onMergeFailed(); + } + } /** * Called to destroy the phone and cleanup any lingering calls. */ @@ -280,6 +286,16 @@ public final class Phone { } /** + * Instructs Telecomm to switch to other active subscripion + * + * @param subId switch to this subscription + * {@hide} + */ + public void switchToOtherActiveSub(String subId) { + mInCallAdapter.switchToOtherActiveSub(subId); + } + + /** * Obtains the current phone call audio state of the {@code Phone}. * * @return An object encapsulating the audio state. diff --git a/telecomm/java/android/telecom/PhoneAccount.java b/telecomm/java/android/telecom/PhoneAccount.java index b64043c..635a48b 100644 --- a/telecomm/java/android/telecom/PhoneAccount.java +++ b/telecomm/java/android/telecom/PhoneAccount.java @@ -34,6 +34,7 @@ import android.text.TextUtils; import java.lang.String; import java.util.ArrayList; +import java.util.BitSet; import java.util.Collections; import java.util.List; import java.util.MissingResourceException; @@ -374,6 +375,43 @@ public final class PhoneAccount implements Parcelable { } /** + * Contains information related to + * LCH and ACTIVE. + */ + private BitSet callsStatus = new BitSet(); + + /** + * {@hide} + */ + public static final int LCH = 1; + + /** + * {@hide} + */ + public static final int ACTIVE = 2; + + /** + * {@hide} + */ + public void setBit(int bit) { + callsStatus.set(bit); + } + + /** + * {@hide} + */ + public void unSetBit(int bit) { + callsStatus.set(bit, false); + } + + /** + * {@hide} + */ + public boolean isSet(int bit) { + return callsStatus.get(bit); + } + + /** * Returns a builder initialized with the current {@link PhoneAccount} instance. * * @return The builder. diff --git a/telecomm/java/android/telecom/RemoteConference.java b/telecomm/java/android/telecom/RemoteConference.java index ae5cd46..8136c7d 100644 --- a/telecomm/java/android/telecom/RemoteConference.java +++ b/telecomm/java/android/telecom/RemoteConference.java @@ -92,6 +92,18 @@ public final class RemoteConference { int connectionCapabilities) {} /** + * Indicates that the call properties of this {@code RemoteConference} have changed. + * See {@link #getConnectionProperties()}. + * + * @param conference The {@code RemoteConference} invoking this method. + * @param connectionProperties The new properties of the {@code RemoteConference}. + * @hide + */ + public void onConnectionPropertiesChanged( + RemoteConference conference, + int connectionProperties) {} + + /** * Invoked when the set of {@link RemoteConnection}s which can be added to this conference * call have changed. * @@ -133,6 +145,7 @@ public final class RemoteConference { private int mState = Connection.STATE_NEW; private DisconnectCause mDisconnectCause; private int mConnectionCapabilities; + private int mConnectionProperties; private Bundle mExtras; /** @hide */ @@ -243,6 +256,24 @@ public final class RemoteConference { } } + /** {@hide} */ + void setConnectionProperties(final int connectionProperties) { + if (mConnectionProperties != connectionProperties) { + mConnectionProperties = connectionProperties; + for (CallbackRecord<Callback> record : mCallbackRecords) { + final RemoteConference conference = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onConnectionPropertiesChanged( + conference, mConnectionProperties); + } + }); + } + } + } + /** @hide */ void setConferenceableConnections(List<RemoteConnection> conferenceableConnections) { mConferenceableConnections.clear(); @@ -322,6 +353,17 @@ public final class RemoteConference { } /** + * Returns the properties of the conference. See {@code PROPERTY_*} constants in class + * {@link Connection} for valid values. + * + * @return A bitmask of the properties of the conference call. + * @hide + */ + public final int getConnectionProperties() { + return mConnectionProperties; + } + + /** * Obtain the extras associated with this {@code RemoteConnection}. * * @return The extras for this connection. diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java index f960959..4371367 100644 --- a/telecomm/java/android/telecom/RemoteConnection.java +++ b/telecomm/java/android/telecom/RemoteConnection.java @@ -90,6 +90,18 @@ public final class RemoteConnection { int connectionCapabilities) {} /** + * Indicates that the call properties of this {@code RemoteConnection} have changed. + * See {@link #getConnectionProperties()}. + * + * @param connection The {@code RemoteConnection} invoking this method. + * @param connectionProperties The new properties of the {@code RemoteConnection}. + * @hide + */ + public void onConnectionPropertiesChanged( + RemoteConnection connection, + int connectionProperties) {} + + /** * Invoked when the post-dial sequence in the outgoing {@code Connection} has reached a * pause character. This causes the post-dial signals to stop pending user confirmation. An * implementation should present this choice to the user and invoke @@ -577,6 +589,7 @@ public final class RemoteConnection { private boolean mRingbackRequested; private boolean mConnected; private int mConnectionCapabilities; + private int mConnectionProperties; private int mVideoState; private VideoProvider mVideoProvider; private boolean mIsVoipAudioMode; @@ -613,6 +626,7 @@ public final class RemoteConnection { mDisconnectCause = connection.getDisconnectCause(); mRingbackRequested = connection.isRingbackRequested(); mConnectionCapabilities = connection.getConnectionCapabilities(); + mConnectionProperties = connection.getConnectionProperties(); mVideoState = connection.getVideoState(); mVideoProvider = new RemoteConnection.VideoProvider(connection.getVideoProvider()); mIsVoipAudioMode = connection.getIsVoipAudioMode(); @@ -708,6 +722,15 @@ public final class RemoteConnection { } /** + * @return A bitmask of the properties of the {@code RemoteConnection}, as defined in + * the {@code PROPERTY_*} constants in class {@link Connection}. + * @hide + */ + public int getConnectionProperties() { + return mConnectionProperties; + } + + /** * Determines if the audio mode of this {@code RemoteConnection} is VOIP. * * @return {@code true} if the {@code RemoteConnection}'s current audio mode is VOIP. @@ -1089,6 +1112,23 @@ public final class RemoteConnection { /** * @hide */ + void setConnectionProperties(final int connectionProperties) { + mConnectionProperties = connectionProperties; + for (CallbackRecord record : mCallbackRecords) { + final RemoteConnection connection = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onConnectionPropertiesChanged(connection, connectionProperties); + } + }); + } + } + + /** + * @hide + */ void setDestroyed() { if (!mCallbackRecords.isEmpty()) { // Make sure that the callbacks are notified that the call is destroyed first. diff --git a/telecomm/java/android/telecom/RemoteConnectionService.java b/telecomm/java/android/telecom/RemoteConnectionService.java index dc0de0c..0045915 100644 --- a/telecomm/java/android/telecom/RemoteConnectionService.java +++ b/telecomm/java/android/telecom/RemoteConnectionService.java @@ -61,6 +61,7 @@ final class RemoteConnectionService { mPendingConnections.remove(connection); // Unconditionally initialize the connection ... connection.setConnectionCapabilities(parcel.getConnectionCapabilities()); + connection.setConnectionProperties(parcel.getConnectionProperties()); if (parcel.getHandle() != null || parcel.getState() != Connection.STATE_DISCONNECTED) { connection.setAddress(parcel.getHandle(), parcel.getHandlePresentation()); @@ -156,6 +157,17 @@ final class RemoteConnectionService { } @Override + public void setConnectionProperties(String callId, int connectionProperties) { + if (mConnectionById.containsKey(callId)) { + findConnectionForAction(callId, "setConnectionProperties") + .setConnectionProperties(connectionProperties); + } else { + findConferenceForAction(callId, "setConnectionProperties") + .setConnectionProperties(connectionProperties); + } + } + + @Override public void setIsConferenced(String callId, String conferenceCallId) { // Note: callId should not be null; conferenceCallId may be null RemoteConnection connection = @@ -206,6 +218,7 @@ final class RemoteConnectionService { conference.setState(parcel.getState()); conference.setConnectionCapabilities(parcel.getConnectionCapabilities()); + conference.setConnectionProperties(parcel.getConnectionProperties()); mConferenceById.put(callId, conference); conference.registerCallback(new RemoteConference.Callback() { @Override @@ -330,6 +343,10 @@ final class RemoteConnectionService { .setExtras(extras); } } + + @Override + public void resetCdmaConnectionTime(String callId) { + } }; private final ConnectionServiceAdapterServant mServant = diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index b07b018..ae7c18e 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -22,6 +22,7 @@ import android.net.Uri; import android.os.Bundle; import android.os.RemoteException; import android.os.ServiceManager; +import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.Log; @@ -1090,6 +1091,37 @@ public class TelecomManager { } /** + * Returns current active subscription. + * Active subscription is the one from which calls are displayed to user when there are actve + * calls on both subscriptions. + * @hide + */ + public int getActiveSubscription() { + try { + if (isServiceConnected()) { + return getTelecomService().getActiveSubscription(); + } + } catch (RemoteException e) { + Log.e(TAG, "RemoteException attempting to get the active subsription.", e); + } + return SubscriptionManager.INVALID_SUBSCRIPTION_ID; + } + + /** + * switches to other active subscription. + * @hide + */ + public void switchToOtherActiveSub(int subId) { + try { + if (isServiceConnected()) { + getTelecomService().switchToOtherActiveSub(subId); + } + } catch (RemoteException e) { + Log.e(TAG, "RemoteException attempting to switchToOtherActiveSub.", e); + } + } + + /** * Registers a new incoming call. A {@link ConnectionService} should invoke this method when it * has an incoming call. The specified {@link PhoneAccountHandle} must have been registered * with {@link #registerPhoneAccount}. Once invoked, this method will cause the system to bind diff --git a/telecomm/java/android/telecom/VideoCallImpl.java b/telecomm/java/android/telecom/VideoCallImpl.java index c8072d1..93484cd 100644 --- a/telecomm/java/android/telecom/VideoCallImpl.java +++ b/telecomm/java/android/telecom/VideoCallImpl.java @@ -57,13 +57,20 @@ public class VideoCallImpl extends VideoCall { private final class VideoCallListenerBinder extends IVideoCallback.Stub { @Override public void receiveSessionModifyRequest(VideoProfile videoProfile) { + if (mHandler == null) { + return; + } mHandler.obtainMessage(MessageHandler.MSG_RECEIVE_SESSION_MODIFY_REQUEST, videoProfile).sendToTarget(); + } @Override public void receiveSessionModifyResponse(int status, VideoProfile requestProfile, VideoProfile responseProfile) { + if (mHandler == null) { + return; + } SomeArgs args = SomeArgs.obtain(); args.arg1 = status; args.arg2 = requestProfile; @@ -74,12 +81,18 @@ public class VideoCallImpl extends VideoCall { @Override public void handleCallSessionEvent(int event) { + if (mHandler == null) { + return; + } mHandler.obtainMessage(MessageHandler.MSG_HANDLE_CALL_SESSION_EVENT, event) .sendToTarget(); } @Override public void changePeerDimensions(int width, int height) { + if (mHandler == null) { + return; + } SomeArgs args = SomeArgs.obtain(); args.arg1 = width; args.arg2 = height; @@ -88,18 +101,27 @@ public class VideoCallImpl extends VideoCall { @Override public void changeVideoQuality(int videoQuality) { + if (mHandler == null) { + return; + } mHandler.obtainMessage(MessageHandler.MSG_CHANGE_VIDEO_QUALITY, videoQuality, 0) .sendToTarget(); } @Override public void changeCallDataUsage(long dataUsage) { + if (mHandler == null) { + return; + } mHandler.obtainMessage(MessageHandler.MSG_CHANGE_CALL_DATA_USAGE, dataUsage) .sendToTarget(); } @Override public void changeCameraCapabilities(VideoProfile.CameraCapabilities cameraCapabilities) { + if (mHandler == null) { + return; + } mHandler.obtainMessage(MessageHandler.MSG_CHANGE_CAMERA_CAPABILITIES, cameraCapabilities).sendToTarget(); } diff --git a/telecomm/java/com/android/internal/telecom/IConnectionService.aidl b/telecomm/java/com/android/internal/telecom/IConnectionService.aidl index 8a54add..398d2e1 100644 --- a/telecomm/java/com/android/internal/telecom/IConnectionService.aidl +++ b/telecomm/java/com/android/internal/telecom/IConnectionService.aidl @@ -75,4 +75,10 @@ oneway interface IConnectionService { void swapConference(String conferenceCallId); void onPostDialContinue(String callId, boolean proceed); + + void setLocalCallHold(String callId, boolean lchState); + + void addParticipantWithConference(String callId, String recipients); + + void explicitTransfer(String callId); } diff --git a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl index 7647444..1853f5a 100644 --- a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl +++ b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl @@ -55,6 +55,8 @@ oneway interface IConnectionServiceAdapter { void setConnectionCapabilities(String callId, int connectionCapabilities); + void setConnectionProperties(String callId, int connectionProperties); + void setIsConferenced(String callId, String conferenceCallId); void setConferenceMergeFailed(String callId); @@ -86,4 +88,6 @@ oneway interface IConnectionServiceAdapter { void addExistingConnection(String callId, in ParcelableConnection connection); void setExtras(String callId, in Bundle extras); + + void resetCdmaConnectionTime(String callId); } diff --git a/telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl b/telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl index 863fff2..6ef8eda 100644 --- a/telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl +++ b/telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl @@ -60,4 +60,8 @@ oneway interface IInCallAdapter { void turnOnProximitySensor(); void turnOffProximitySensor(boolean screenOnImmediately); + + void switchToOtherActiveSub(String subId); + + void transferCall(String callId); } diff --git a/telecomm/java/com/android/internal/telecom/IInCallService.aidl b/telecomm/java/com/android/internal/telecom/IInCallService.aidl index ded47d5..f4ba9a0 100644 --- a/telecomm/java/com/android/internal/telecom/IInCallService.aidl +++ b/telecomm/java/com/android/internal/telecom/IInCallService.aidl @@ -45,4 +45,6 @@ oneway interface IInCallService { void bringToForeground(boolean showDialpad); void onCanAddCallChanged(boolean canAddCall); + + void onMergeFailed(in ParcelableCall call); } diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl index 2e07759..cad8c5d 100644 --- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl +++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl @@ -232,4 +232,14 @@ interface ITelecomService { * @see TelecomServiceImpl#setDefaultDialer */ boolean setDefaultDialer(in String packageName); + + /** + * @see TelecommManager#getActiveSubscription + */ + int getActiveSubscription(); + + /** + * @see TelecommManager#switchToOtherActiveSub + */ + void switchToOtherActiveSub(int subId); } |