diff options
3 files changed, 68 insertions, 0 deletions
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index d0ccd55eb3c5..6e100298da35 100644 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -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; @@ -211,6 +213,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); try { @@ -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(); diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index ba7b6a174a32..96070b88a1a6 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -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 { diff --git a/telecomm/java/com/android/internal/telecom/IConnectionService.aidl b/telecomm/java/com/android/internal/telecom/IConnectionService.aidl index 8a27675e08ab..20feba78f5c9 100644 --- a/telecomm/java/com/android/internal/telecom/IConnectionService.aidl +++ b/telecomm/java/com/android/internal/telecom/IConnectionService.aidl @@ -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); |