diff options
author | Tyler Gunn <tgunn@google.com> | 2017-05-12 10:04:49 -0700 |
---|---|---|
committer | Tyler Gunn <tgunn@google.com> | 2017-05-15 11:38:18 -0700 |
commit | d104a4f7f67ad6ca098bef0dc3824c5c47e7bcaf (patch) | |
tree | d64dce36992d09692f5e9723bba7718b4acb741d /telecomm/java/android/telecom/ConnectionService.java | |
parent | 6c97781468d3e373baad74ea5f8063e185e9e455 (diff) |
Add ConnectionService callback invoked when connection creation complete.
Adding a new @hide callback in ConnectionService which a CS implementation
can implement. A callback from Telecom is responsible for invoking this
method.
Test: Manual
Bug: 33272455
Change-Id: Id17cf0fd8fd491b7677f9b7a7b52c76270b1c8c9
Diffstat (limited to 'telecomm/java/android/telecom/ConnectionService.java')
-rw-r--r-- | telecomm/java/android/telecom/ConnectionService.java | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index bf8f8e4e723e..1ffc83fef55d 100644 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -100,6 +100,7 @@ public abstract class ConnectionService extends Service { private static final String SESSION_ADD_CS_ADAPTER = "CS.aCSA"; private static final String SESSION_REMOVE_CS_ADAPTER = "CS.rCSA"; private static final String SESSION_CREATE_CONN = "CS.crCo"; + private static final String SESSION_CREATE_CONN_COMPLETE = "CS.crCoC"; private static final String SESSION_CREATE_CONN_FAILED = "CS.crCoF"; private static final String SESSION_ABORT = "CS.ab"; private static final String SESSION_ANSWER = "CS.an"; @@ -152,6 +153,7 @@ public abstract class ConnectionService extends Service { private static final int MSG_ON_START_RTT = 26; private static final int MSG_ON_STOP_RTT = 27; private static final int MSG_RTT_UPGRADE_RESPONSE = 28; + private static final int MSG_CREATE_CONNECTION_COMPLETE = 29; private static Connection sNullConnection; @@ -221,6 +223,19 @@ public abstract class ConnectionService extends Service { } @Override + public void createConnectionComplete(String id, Session.Info sessionInfo) { + Log.startSession(sessionInfo, SESSION_CREATE_CONN_COMPLETE); + try { + SomeArgs args = SomeArgs.obtain(); + args.arg1 = id; + args.arg2 = Log.createSubsession(); + mHandler.obtainMessage(MSG_CREATE_CONNECTION_COMPLETE, args).sendToTarget(); + } finally { + Log.endSession(); + } + } + + @Override public void createConnectionFailed( PhoneAccountHandle connectionManagerPhoneAccount, String callId, @@ -630,6 +645,33 @@ public abstract class ConnectionService extends Service { } break; } + case MSG_CREATE_CONNECTION_COMPLETE: { + SomeArgs args = (SomeArgs) msg.obj; + Log.continueSession((Session) args.arg2, + SESSION_HANDLER + SESSION_CREATE_CONN_COMPLETE); + try { + final String id = (String) args.arg1; + if (!mAreAccountsInitialized) { + Log.d(this, "Enqueueing pre-init request %s", id); + mPreInitializationConnectionRequests.add( + new android.telecom.Logging.Runnable( + SESSION_HANDLER + SESSION_CREATE_CONN_COMPLETE + + ".pICR", + null /*lock*/) { + @Override + public void loggedRun() { + notifyCreateConnectionComplete(id); + } + }.prepare()); + } else { + notifyCreateConnectionComplete(id); + } + } finally { + args.recycle(); + Log.endSession(); + } + break; + } case MSG_CREATE_CONNECTION_FAILED: { SomeArgs args = (SomeArgs) msg.obj; Log.continueSession((Session) args.arg3, SESSION_HANDLER + @@ -1373,6 +1415,17 @@ public abstract class ConnectionService extends Service { } } + /** + * Called by Telecom when the creation of a new Connection has completed and it is now added + * to Telecom. + * @param callId The ID of the connection. + */ + private void notifyCreateConnectionComplete(final String callId) { + Log.i(this, "notifyCreateConnectionComplete %s", callId); + onCreateConnectionComplete(findConnectionForAction(callId, + "notifyCreateConnectionComplete")); + } + private void abort(String callId) { Log.d(this, "abort %s", callId); findConnectionForAction(callId, "abort").onAbort(); @@ -1836,6 +1889,18 @@ public abstract class ConnectionService extends Service { } /** + * Called after the {@link Connection} returned by + * {@link #onCreateIncomingConnection(PhoneAccountHandle, ConnectionRequest)} + * or {@link #onCreateOutgoingConnection(PhoneAccountHandle, ConnectionRequest)} has been + * added to the {@link ConnectionService} and sent to Telecom. + * + * @param connection the {@link Connection}. + * @hide + */ + public void onCreateConnectionComplete(Connection connection) { + } + + /** * Called by Telecom to inform the {@link ConnectionService} that its request to create a new * incoming {@link Connection} was denied. * <p> |