Merge "Self managed CS implementation." am: d736a6b2c2
am: 6bd991b3d2
am: 6a643c3a60
Change-Id: I43f59846ecc7601730aa3a15b106292d7ace0df0
This commit is contained in:
@ -98,6 +98,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_FAILED = "CS.crCoF";
|
||||
private static final String SESSION_ABORT = "CS.ab";
|
||||
private static final String SESSION_ANSWER = "CS.an";
|
||||
private static final String SESSION_ANSWER_VIDEO = "CS.anV";
|
||||
@ -142,6 +143,7 @@ public abstract class ConnectionService extends Service {
|
||||
private static final int MSG_PULL_EXTERNAL_CALL = 22;
|
||||
private static final int MSG_SEND_CALL_EVENT = 23;
|
||||
private static final int MSG_ON_EXTRAS_CHANGED = 24;
|
||||
private static final int MSG_CREATE_CONNECTION_FAILED = 25;
|
||||
|
||||
private static Connection sNullConnection;
|
||||
|
||||
@ -210,6 +212,25 @@ public abstract class ConnectionService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createConnectionFailed(
|
||||
String callId,
|
||||
ConnectionRequest request,
|
||||
boolean isIncoming,
|
||||
Session.Info sessionInfo) {
|
||||
Log.startSession(sessionInfo, SESSION_CREATE_CONN_FAILED);
|
||||
try {
|
||||
SomeArgs args = SomeArgs.obtain();
|
||||
args.arg1 = callId;
|
||||
args.arg2 = request;
|
||||
args.arg3 = Log.createSubsession();
|
||||
args.argi1 = isIncoming ? 1 : 0;
|
||||
mHandler.obtainMessage(MSG_CREATE_CONNECTION_FAILED, args).sendToTarget();
|
||||
} finally {
|
||||
Log.endSession();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void abort(String callId, Session.Info sessionInfo) {
|
||||
Log.startSession(sessionInfo, SESSION_ABORT);
|
||||
@ -552,6 +573,35 @@ public abstract class ConnectionService extends Service {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MSG_CREATE_CONNECTION_FAILED: {
|
||||
SomeArgs args = (SomeArgs) msg.obj;
|
||||
Log.continueSession((Session) args.arg3, SESSION_HANDLER +
|
||||
SESSION_CREATE_CONN_FAILED);
|
||||
try {
|
||||
final String id = (String) args.arg1;
|
||||
final ConnectionRequest request = (ConnectionRequest) args.arg2;
|
||||
final boolean isIncoming = args.argi1 == 1;
|
||||
if (!mAreAccountsInitialized) {
|
||||
Log.d(this, "Enqueueing pre-init request %s", id);
|
||||
mPreInitializationConnectionRequests.add(
|
||||
new android.telecom.Logging.Runnable(
|
||||
SESSION_HANDLER + SESSION_CREATE_CONN_FAILED + ".pICR",
|
||||
null /*lock*/) {
|
||||
@Override
|
||||
public void loggedRun() {
|
||||
createConnectionFailed(id, request, isIncoming);
|
||||
}
|
||||
}.prepare());
|
||||
} else {
|
||||
Log.i(this, "createConnectionFailed %s", id);
|
||||
createConnectionFailed(id, request, isIncoming);
|
||||
}
|
||||
} finally {
|
||||
args.recycle();
|
||||
Log.endSession();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MSG_ABORT: {
|
||||
SomeArgs args = (SomeArgs) msg.obj;
|
||||
Log.continueSession((Session) args.arg2, SESSION_HANDLER + SESSION_ABORT);
|
||||
@ -1175,6 +1225,17 @@ public abstract class ConnectionService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
private void createConnectionFailed(final String callId, final ConnectionRequest request,
|
||||
boolean isIncoming) {
|
||||
|
||||
Log.i(this, "createConnectionFailed %s", callId);
|
||||
if (isIncoming) {
|
||||
onCreateIncomingConnectionFailed(request);
|
||||
} else {
|
||||
onCreateOutgoingConnectionFailed(request);
|
||||
}
|
||||
}
|
||||
|
||||
private void abort(String callId) {
|
||||
Log.d(this, "abort %s", callId);
|
||||
findConnectionForAction(callId, "abort").onAbort();
|
||||
|
@ -1517,6 +1517,10 @@ public class TelecomManager {
|
||||
* otherwise.
|
||||
*/
|
||||
public boolean isIncomingCallPermitted(PhoneAccountHandle phoneAccountHandle) {
|
||||
if (phoneAccountHandle == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ITelecomService service = getTelecomService();
|
||||
if (service != null) {
|
||||
try {
|
||||
|
@ -46,6 +46,9 @@ oneway interface IConnectionService {
|
||||
boolean isUnknown,
|
||||
in Session.Info sessionInfo);
|
||||
|
||||
void createConnectionFailed(String callId, in ConnectionRequest request, boolean isIncoming,
|
||||
in Session.Info sessionInfo);
|
||||
|
||||
void abort(String callId, in Session.Info sessionInfo);
|
||||
|
||||
void answerVideo(String callId, int videoState, in Session.Info sessionInfo);
|
||||
|
Reference in New Issue
Block a user