diff options
Diffstat (limited to 'telecomm/java/android/telecom/ConnectionService.java')
-rw-r--r-- | telecomm/java/android/telecom/ConnectionService.java | 116 |
1 files changed, 114 insertions, 2 deletions
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}. |