diff options
author | Tyler Gunn <tgunn@google.com> | 2017-08-14 21:24:18 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-08-14 21:24:18 +0000 |
commit | 58b77aa4aa0637e73fac17fb07e60b4286d5e850 (patch) | |
tree | 1fddfd50890287a04bfa3bb89b2288a82cb376ff | |
parent | 4a41744919476cf9f88e355863af18b014437b68 (diff) | |
parent | a649df1fe18c0867647d5d18627e5a10e8a6eb1e (diff) | |
download | base-58b77aa4aa0637e73fac17fb07e60b4286d5e850.tar.gz |
Merge "Add ConnectionService callback invoked when connection creation complete."
-rw-r--r-- | telecomm/java/android/telecom/ConnectionService.java | 65 | ||||
-rw-r--r-- | telecomm/java/com/android/internal/telecom/IConnectionService.aidl | 2 |
2 files changed, 67 insertions, 0 deletions
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index 7401ddac3ef5..79064bf8494c 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(); @@ -1837,6 +1890,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> diff --git a/telecomm/java/com/android/internal/telecom/IConnectionService.aidl b/telecomm/java/com/android/internal/telecom/IConnectionService.aidl index c631d085f6e7..e428286ad1e3 100644 --- a/telecomm/java/com/android/internal/telecom/IConnectionService.aidl +++ b/telecomm/java/com/android/internal/telecom/IConnectionService.aidl @@ -47,6 +47,8 @@ oneway interface IConnectionService { boolean isUnknown, in Session.Info sessionInfo); + void createConnectionComplete(String callId, in Session.Info sessionInfo); + void createConnectionFailed(in PhoneAccountHandle connectionManagerPhoneAccount, String callId, in ConnectionRequest request, boolean isIncoming, in Session.Info sessionInfo); |