Merge "Add ConnectionService callback invoked when connection creation complete." into oc-dev
This commit is contained in:
@@ -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_ADD_CS_ADAPTER = "CS.aCSA";
|
||||||
private static final String SESSION_REMOVE_CS_ADAPTER = "CS.rCSA";
|
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 = "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_CREATE_CONN_FAILED = "CS.crCoF";
|
||||||
private static final String SESSION_ABORT = "CS.ab";
|
private static final String SESSION_ABORT = "CS.ab";
|
||||||
private static final String SESSION_ANSWER = "CS.an";
|
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_START_RTT = 26;
|
||||||
private static final int MSG_ON_STOP_RTT = 27;
|
private static final int MSG_ON_STOP_RTT = 27;
|
||||||
private static final int MSG_RTT_UPGRADE_RESPONSE = 28;
|
private static final int MSG_RTT_UPGRADE_RESPONSE = 28;
|
||||||
|
private static final int MSG_CREATE_CONNECTION_COMPLETE = 29;
|
||||||
|
|
||||||
private static Connection sNullConnection;
|
private static Connection sNullConnection;
|
||||||
|
|
||||||
@@ -220,6 +222,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
|
@Override
|
||||||
public void createConnectionFailed(
|
public void createConnectionFailed(
|
||||||
PhoneAccountHandle connectionManagerPhoneAccount,
|
PhoneAccountHandle connectionManagerPhoneAccount,
|
||||||
@@ -630,6 +645,33 @@ public abstract class ConnectionService extends Service {
|
|||||||
}
|
}
|
||||||
break;
|
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: {
|
case MSG_CREATE_CONNECTION_FAILED: {
|
||||||
SomeArgs args = (SomeArgs) msg.obj;
|
SomeArgs args = (SomeArgs) msg.obj;
|
||||||
Log.continueSession((Session) args.arg3, SESSION_HANDLER +
|
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) {
|
private void abort(String callId) {
|
||||||
Log.d(this, "abort %s", callId);
|
Log.d(this, "abort %s", callId);
|
||||||
findConnectionForAction(callId, "abort").onAbort();
|
findConnectionForAction(callId, "abort").onAbort();
|
||||||
@@ -1835,6 +1888,18 @@ public abstract class ConnectionService extends Service {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
* Called by Telecom to inform the {@link ConnectionService} that its request to create a new
|
||||||
* incoming {@link Connection} was denied.
|
* incoming {@link Connection} was denied.
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ oneway interface IConnectionService {
|
|||||||
boolean isUnknown,
|
boolean isUnknown,
|
||||||
in Session.Info sessionInfo);
|
in Session.Info sessionInfo);
|
||||||
|
|
||||||
|
void createConnectionComplete(String callId, in Session.Info sessionInfo);
|
||||||
|
|
||||||
void createConnectionFailed(in PhoneAccountHandle connectionManagerPhoneAccount, String callId,
|
void createConnectionFailed(in PhoneAccountHandle connectionManagerPhoneAccount, String callId,
|
||||||
in ConnectionRequest request, boolean isIncoming, in Session.Info sessionInfo);
|
in ConnectionRequest request, boolean isIncoming, in Session.Info sessionInfo);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user