Loading src/com/android/server/telecom/Call.java +27 −4 Original line number Diff line number Diff line Loading @@ -343,6 +343,7 @@ public class Call implements CreateConnectionResponse { private final CallsManager mCallsManager; private final TelecomSystem.SyncRoot mLock; private final String mId; private String mConnectionId; private Analytics.CallInfo mAnalytics; private boolean mWasConferencePreviouslyMerged = false; Loading Loading @@ -379,6 +380,8 @@ public class Call implements CreateConnectionResponse { */ private boolean mIsVideoCallingSupported = false; private PhoneNumberUtilsAdapter mPhoneNumberUtilsAdapter; /** * Persists the specified parameters and initializes the new instance. * Loading @@ -404,6 +407,7 @@ public class Call implements CreateConnectionResponse { ConnectionServiceRepository repository, ContactsAsyncHelper contactsAsyncHelper, CallerInfoAsyncQueryFactory callerInfoAsyncQueryFactory, PhoneNumberUtilsAdapter phoneNumberUtilsAdapter, Uri handle, GatewayInfo gatewayInfo, PhoneAccountHandle connectionManagerPhoneAccountHandle, Loading @@ -412,11 +416,13 @@ public class Call implements CreateConnectionResponse { boolean shouldAttachToExistingConnection, boolean isConference) { mId = callId; mConnectionId = callId; mState = isConference ? CallState.ACTIVE : CallState.NEW; mContext = context; mCallsManager = callsManager; mLock = lock; mRepository = repository; mPhoneNumberUtilsAdapter = phoneNumberUtilsAdapter; setHandle(handle); mPostDialDigits = handle != null ? PhoneNumberUtils.extractPostDialPortion(handle.getSchemeSpecificPart()) : ""; Loading Loading @@ -458,6 +464,7 @@ public class Call implements CreateConnectionResponse { ConnectionServiceRepository repository, ContactsAsyncHelper contactsAsyncHelper, CallerInfoAsyncQueryFactory callerInfoAsyncQueryFactory, PhoneNumberUtilsAdapter phoneNumberUtilsAdapter, Uri handle, GatewayInfo gatewayInfo, PhoneAccountHandle connectionManagerPhoneAccountHandle, Loading @@ -467,7 +474,7 @@ public class Call implements CreateConnectionResponse { boolean isConference, long connectTimeMillis) { this(callId, context, callsManager, lock, repository, contactsAsyncHelper, callerInfoAsyncQueryFactory, handle, gatewayInfo, callerInfoAsyncQueryFactory, phoneNumberUtilsAdapter, handle, gatewayInfo, connectionManagerPhoneAccountHandle, targetPhoneAccountHandle, callDirection, shouldAttachToExistingConnection, isConference); Loading Loading @@ -594,6 +601,21 @@ public class Call implements CreateConnectionResponse { return mId; } /** * Returns the unique ID for this call (see {@link #getId}) along with an attempt indicator that * iterates based on attempts to establish a {@link Connection} using createConnectionProcessor. * @return The call ID with an appended attempt id. */ public String getConnectionId() { if(mCreateConnectionProcessor != null) { mConnectionId = mId + "_" + String.valueOf(mCreateConnectionProcessor.getConnectionAttempt()); return mConnectionId; } else { return mConnectionId; } } /** * Sets the call state. Although there exists the notion of appropriate state transitions * (see {@link CallState}), in practice those expectations break down when cellular systems Loading Loading @@ -747,8 +769,9 @@ public class Call implements CreateConnectionResponse { // Let's not allow resetting of the emergency flag. Once a call becomes an emergency // call, it will remain so for the rest of it's lifetime. if (!mIsEmergencyCall) { mIsEmergencyCall = mHandle != null && PhoneNumberUtils.isLocalEmergencyNumber( mContext, mHandle.getSchemeSpecificPart()); mIsEmergencyCall = mHandle != null && mPhoneNumberUtilsAdapter.isLocalEmergencyNumber(mContext, mHandle.getSchemeSpecificPart()); } startCallerInfoLookup(); for (Listener l : mListeners) { Loading Loading @@ -1671,7 +1694,7 @@ public class Call implements CreateConnectionResponse { return false; } if (PhoneNumberUtils.isUriNumber(getHandle().toString())) { if (mPhoneNumberUtilsAdapter.isUriNumber(getHandle().toString())) { // The incoming number is actually a URI (i.e. a SIP address), // not a regular PSTN phone number, and we can't send SMSes to // SIP addresses. Loading src/com/android/server/telecom/CallIdMapper.java +11 −2 Original line number Diff line number Diff line Loading @@ -77,7 +77,16 @@ public class CallIdMapper { } } public interface ICallInfo { String getCallId(Call call); } private final BiMap<String, Call> mCalls = new BiMap<>(); private ICallInfo mCallInfo; public CallIdMapper(ICallInfo callInfo) { mCallInfo = callInfo; } void replaceCall(Call newCall, Call callToReplace) { // Use the old call's ID for the new call. Loading @@ -93,7 +102,7 @@ public class CallIdMapper { } void addCall(Call call) { addCall(call, call.getId()); addCall(call, mCallInfo.getCallId(call)); } void removeCall(Call call) { Loading @@ -111,7 +120,7 @@ public class CallIdMapper { if (call == null || mCalls.getKey(call) == null) { return null; } return call.getId(); return mCallInfo.getCallId(call); } Call getCall(Object objId) { Loading src/com/android/server/telecom/CallIntentProcessor.java +1 −1 Original line number Diff line number Diff line Loading @@ -148,7 +148,7 @@ public class CallIntentProcessor { // process will be running throughout the duration of the phone call and should never // be killed. NewOutgoingCallIntentBroadcaster broadcaster = new NewOutgoingCallIntentBroadcaster( context, callsManager, call, intent, new PhoneNumberUtilsAdapterImpl(), context, callsManager, call, intent, callsManager.getPhoneNumberUtilsAdapter(), isPrivilegedDialer); final int result = broadcaster.processIntent(); final boolean success = result == DisconnectCause.NOT_DISCONNECTED; Loading src/com/android/server/telecom/CallsManager.java +14 −1 Original line number Diff line number Diff line Loading @@ -189,6 +189,7 @@ public class CallsManager extends Call.ListenerBase private final CallerInfoLookupHelper mCallerInfoLookupHelper; private final DefaultDialerManagerAdapter mDefaultDialerManagerAdapter; private final Timeouts.Adapter mTimeoutsAdapter; private final PhoneNumberUtilsAdapter mPhoneNumberUtilsAdapter; private final Set<Call> mLocallyDisconnectingCalls = new HashSet<>(); private final Set<Call> mPendingCallsToDisconnect = new HashSet<>(); /* Handler tied to thread in which CallManager was initialized. */ Loading Loading @@ -219,9 +220,11 @@ public class CallsManager extends Call.ListenerBase SystemStateProvider systemStateProvider, DefaultDialerManagerAdapter defaultDialerAdapter, Timeouts.Adapter timeoutsAdapter, AsyncRingtonePlayer asyncRingtonePlayer) { AsyncRingtonePlayer asyncRingtonePlayer, PhoneNumberUtilsAdapter phoneNumberUtilsAdapter) { mContext = context; mLock = lock; mPhoneNumberUtilsAdapter = phoneNumberUtilsAdapter; mContactsAsyncHelper = contactsAsyncHelper; mCallerInfoAsyncQueryFactory = callerInfoAsyncQueryFactory; mPhoneAccountRegistrar = phoneAccountRegistrar; Loading Loading @@ -667,6 +670,7 @@ public class CallsManager extends Call.ListenerBase mConnectionServiceRepository, mContactsAsyncHelper, mCallerInfoAsyncQueryFactory, mPhoneNumberUtilsAdapter, handle, null /* gatewayInfo */, null /* connectionManagerPhoneAccount */, Loading Loading @@ -699,6 +703,7 @@ public class CallsManager extends Call.ListenerBase mConnectionServiceRepository, mContactsAsyncHelper, mCallerInfoAsyncQueryFactory, mPhoneNumberUtilsAdapter, handle, null /* gatewayInfo */, null /* connectionManagerPhoneAccount */, Loading Loading @@ -771,6 +776,7 @@ public class CallsManager extends Call.ListenerBase mConnectionServiceRepository, mContactsAsyncHelper, mCallerInfoAsyncQueryFactory, mPhoneNumberUtilsAdapter, handle, null /* gatewayInfo */, null /* connectionManagerPhoneAccount */, Loading Loading @@ -1537,6 +1543,11 @@ public class CallsManager extends Call.ListenerBase return getFirstCallWithState(null, states); } @VisibleForTesting public PhoneNumberUtilsAdapter getPhoneNumberUtilsAdapter() { return mPhoneNumberUtilsAdapter; } /** * Returns the first call that it finds with the given states. The states are treated as having * priority order so that any call with the first state will be returned before any call with Loading Loading @@ -1594,6 +1605,7 @@ public class CallsManager extends Call.ListenerBase mConnectionServiceRepository, mContactsAsyncHelper, mCallerInfoAsyncQueryFactory, mPhoneNumberUtilsAdapter, null /* handle */, null /* gatewayInfo */, null /* connectionManagerPhoneAccount */, Loading Loading @@ -1984,6 +1996,7 @@ public class CallsManager extends Call.ListenerBase mConnectionServiceRepository, mContactsAsyncHelper, mCallerInfoAsyncQueryFactory, mPhoneNumberUtilsAdapter, connection.getHandle() /* handle */, null /* gatewayInfo */, null /* connectionManagerPhoneAccount */, Loading src/com/android/server/telecom/ConnectionServiceWrapper.java +29 −13 Original line number Diff line number Diff line Loading @@ -663,7 +663,7 @@ public class ConnectionServiceWrapper extends ServiceBinder { } private final Adapter mAdapter = new Adapter(); private final CallIdMapper mCallIdMapper = new CallIdMapper(); private final CallIdMapper mCallIdMapper = new CallIdMapper(Call::getConnectionId); private final Map<String, CreateConnectionResponse> mPendingResponses = new HashMap<>(); private Binder2 mBinder = new Binder2(); Loading Loading @@ -713,6 +713,17 @@ public class ConnectionServiceWrapper extends ServiceBinder { } } /** See {@link IConnectionService#removeConnectionServiceAdapter}. */ private void removeConnectionServiceAdapter(IConnectionServiceAdapter adapter) { if (isServiceValid("removeConnectionServiceAdapter")) { try { logOutgoing("removeConnectionServiceAdapter %s", adapter); mServiceInterface.removeConnectionServiceAdapter(adapter); } catch (RemoteException e) { } } } /** * Creates a new connection for a new outgoing call or to attach to an existing incoming call. */ Loading Loading @@ -1032,7 +1043,16 @@ public class ConnectionServiceWrapper extends ServiceBinder { /** {@inheritDoc} */ @Override protected void setServiceInterface(IBinder binder) { if (binder == null) { mServiceInterface = IConnectionService.Stub.asInterface(binder); Log.v(this, "Adding Connection Service Adapter."); addConnectionServiceAdapter(mAdapter); } /** {@inheritDoc} */ @Override protected void removeServiceInterface() { Log.v(this, "Removing Connection Service Adapter."); removeConnectionServiceAdapter(mAdapter); // We have lost our service connection. Notify the world that this service is done. // We must notify the adapter before CallsManager. The adapter will force any pending // outgoing calls to try the next service. This needs to happen before CallsManager Loading @@ -1040,10 +1060,6 @@ public class ConnectionServiceWrapper extends ServiceBinder { handleConnectionServiceDeath(); mCallsManager.handleConnectionServiceDeath(this); mServiceInterface = null; } else { mServiceInterface = IConnectionService.Stub.asInterface(binder); addConnectionServiceAdapter(mAdapter); } } private void handleCreateConnectionComplete( Loading Loading
src/com/android/server/telecom/Call.java +27 −4 Original line number Diff line number Diff line Loading @@ -343,6 +343,7 @@ public class Call implements CreateConnectionResponse { private final CallsManager mCallsManager; private final TelecomSystem.SyncRoot mLock; private final String mId; private String mConnectionId; private Analytics.CallInfo mAnalytics; private boolean mWasConferencePreviouslyMerged = false; Loading Loading @@ -379,6 +380,8 @@ public class Call implements CreateConnectionResponse { */ private boolean mIsVideoCallingSupported = false; private PhoneNumberUtilsAdapter mPhoneNumberUtilsAdapter; /** * Persists the specified parameters and initializes the new instance. * Loading @@ -404,6 +407,7 @@ public class Call implements CreateConnectionResponse { ConnectionServiceRepository repository, ContactsAsyncHelper contactsAsyncHelper, CallerInfoAsyncQueryFactory callerInfoAsyncQueryFactory, PhoneNumberUtilsAdapter phoneNumberUtilsAdapter, Uri handle, GatewayInfo gatewayInfo, PhoneAccountHandle connectionManagerPhoneAccountHandle, Loading @@ -412,11 +416,13 @@ public class Call implements CreateConnectionResponse { boolean shouldAttachToExistingConnection, boolean isConference) { mId = callId; mConnectionId = callId; mState = isConference ? CallState.ACTIVE : CallState.NEW; mContext = context; mCallsManager = callsManager; mLock = lock; mRepository = repository; mPhoneNumberUtilsAdapter = phoneNumberUtilsAdapter; setHandle(handle); mPostDialDigits = handle != null ? PhoneNumberUtils.extractPostDialPortion(handle.getSchemeSpecificPart()) : ""; Loading Loading @@ -458,6 +464,7 @@ public class Call implements CreateConnectionResponse { ConnectionServiceRepository repository, ContactsAsyncHelper contactsAsyncHelper, CallerInfoAsyncQueryFactory callerInfoAsyncQueryFactory, PhoneNumberUtilsAdapter phoneNumberUtilsAdapter, Uri handle, GatewayInfo gatewayInfo, PhoneAccountHandle connectionManagerPhoneAccountHandle, Loading @@ -467,7 +474,7 @@ public class Call implements CreateConnectionResponse { boolean isConference, long connectTimeMillis) { this(callId, context, callsManager, lock, repository, contactsAsyncHelper, callerInfoAsyncQueryFactory, handle, gatewayInfo, callerInfoAsyncQueryFactory, phoneNumberUtilsAdapter, handle, gatewayInfo, connectionManagerPhoneAccountHandle, targetPhoneAccountHandle, callDirection, shouldAttachToExistingConnection, isConference); Loading Loading @@ -594,6 +601,21 @@ public class Call implements CreateConnectionResponse { return mId; } /** * Returns the unique ID for this call (see {@link #getId}) along with an attempt indicator that * iterates based on attempts to establish a {@link Connection} using createConnectionProcessor. * @return The call ID with an appended attempt id. */ public String getConnectionId() { if(mCreateConnectionProcessor != null) { mConnectionId = mId + "_" + String.valueOf(mCreateConnectionProcessor.getConnectionAttempt()); return mConnectionId; } else { return mConnectionId; } } /** * Sets the call state. Although there exists the notion of appropriate state transitions * (see {@link CallState}), in practice those expectations break down when cellular systems Loading Loading @@ -747,8 +769,9 @@ public class Call implements CreateConnectionResponse { // Let's not allow resetting of the emergency flag. Once a call becomes an emergency // call, it will remain so for the rest of it's lifetime. if (!mIsEmergencyCall) { mIsEmergencyCall = mHandle != null && PhoneNumberUtils.isLocalEmergencyNumber( mContext, mHandle.getSchemeSpecificPart()); mIsEmergencyCall = mHandle != null && mPhoneNumberUtilsAdapter.isLocalEmergencyNumber(mContext, mHandle.getSchemeSpecificPart()); } startCallerInfoLookup(); for (Listener l : mListeners) { Loading Loading @@ -1671,7 +1694,7 @@ public class Call implements CreateConnectionResponse { return false; } if (PhoneNumberUtils.isUriNumber(getHandle().toString())) { if (mPhoneNumberUtilsAdapter.isUriNumber(getHandle().toString())) { // The incoming number is actually a URI (i.e. a SIP address), // not a regular PSTN phone number, and we can't send SMSes to // SIP addresses. Loading
src/com/android/server/telecom/CallIdMapper.java +11 −2 Original line number Diff line number Diff line Loading @@ -77,7 +77,16 @@ public class CallIdMapper { } } public interface ICallInfo { String getCallId(Call call); } private final BiMap<String, Call> mCalls = new BiMap<>(); private ICallInfo mCallInfo; public CallIdMapper(ICallInfo callInfo) { mCallInfo = callInfo; } void replaceCall(Call newCall, Call callToReplace) { // Use the old call's ID for the new call. Loading @@ -93,7 +102,7 @@ public class CallIdMapper { } void addCall(Call call) { addCall(call, call.getId()); addCall(call, mCallInfo.getCallId(call)); } void removeCall(Call call) { Loading @@ -111,7 +120,7 @@ public class CallIdMapper { if (call == null || mCalls.getKey(call) == null) { return null; } return call.getId(); return mCallInfo.getCallId(call); } Call getCall(Object objId) { Loading
src/com/android/server/telecom/CallIntentProcessor.java +1 −1 Original line number Diff line number Diff line Loading @@ -148,7 +148,7 @@ public class CallIntentProcessor { // process will be running throughout the duration of the phone call and should never // be killed. NewOutgoingCallIntentBroadcaster broadcaster = new NewOutgoingCallIntentBroadcaster( context, callsManager, call, intent, new PhoneNumberUtilsAdapterImpl(), context, callsManager, call, intent, callsManager.getPhoneNumberUtilsAdapter(), isPrivilegedDialer); final int result = broadcaster.processIntent(); final boolean success = result == DisconnectCause.NOT_DISCONNECTED; Loading
src/com/android/server/telecom/CallsManager.java +14 −1 Original line number Diff line number Diff line Loading @@ -189,6 +189,7 @@ public class CallsManager extends Call.ListenerBase private final CallerInfoLookupHelper mCallerInfoLookupHelper; private final DefaultDialerManagerAdapter mDefaultDialerManagerAdapter; private final Timeouts.Adapter mTimeoutsAdapter; private final PhoneNumberUtilsAdapter mPhoneNumberUtilsAdapter; private final Set<Call> mLocallyDisconnectingCalls = new HashSet<>(); private final Set<Call> mPendingCallsToDisconnect = new HashSet<>(); /* Handler tied to thread in which CallManager was initialized. */ Loading Loading @@ -219,9 +220,11 @@ public class CallsManager extends Call.ListenerBase SystemStateProvider systemStateProvider, DefaultDialerManagerAdapter defaultDialerAdapter, Timeouts.Adapter timeoutsAdapter, AsyncRingtonePlayer asyncRingtonePlayer) { AsyncRingtonePlayer asyncRingtonePlayer, PhoneNumberUtilsAdapter phoneNumberUtilsAdapter) { mContext = context; mLock = lock; mPhoneNumberUtilsAdapter = phoneNumberUtilsAdapter; mContactsAsyncHelper = contactsAsyncHelper; mCallerInfoAsyncQueryFactory = callerInfoAsyncQueryFactory; mPhoneAccountRegistrar = phoneAccountRegistrar; Loading Loading @@ -667,6 +670,7 @@ public class CallsManager extends Call.ListenerBase mConnectionServiceRepository, mContactsAsyncHelper, mCallerInfoAsyncQueryFactory, mPhoneNumberUtilsAdapter, handle, null /* gatewayInfo */, null /* connectionManagerPhoneAccount */, Loading Loading @@ -699,6 +703,7 @@ public class CallsManager extends Call.ListenerBase mConnectionServiceRepository, mContactsAsyncHelper, mCallerInfoAsyncQueryFactory, mPhoneNumberUtilsAdapter, handle, null /* gatewayInfo */, null /* connectionManagerPhoneAccount */, Loading Loading @@ -771,6 +776,7 @@ public class CallsManager extends Call.ListenerBase mConnectionServiceRepository, mContactsAsyncHelper, mCallerInfoAsyncQueryFactory, mPhoneNumberUtilsAdapter, handle, null /* gatewayInfo */, null /* connectionManagerPhoneAccount */, Loading Loading @@ -1537,6 +1543,11 @@ public class CallsManager extends Call.ListenerBase return getFirstCallWithState(null, states); } @VisibleForTesting public PhoneNumberUtilsAdapter getPhoneNumberUtilsAdapter() { return mPhoneNumberUtilsAdapter; } /** * Returns the first call that it finds with the given states. The states are treated as having * priority order so that any call with the first state will be returned before any call with Loading Loading @@ -1594,6 +1605,7 @@ public class CallsManager extends Call.ListenerBase mConnectionServiceRepository, mContactsAsyncHelper, mCallerInfoAsyncQueryFactory, mPhoneNumberUtilsAdapter, null /* handle */, null /* gatewayInfo */, null /* connectionManagerPhoneAccount */, Loading Loading @@ -1984,6 +1996,7 @@ public class CallsManager extends Call.ListenerBase mConnectionServiceRepository, mContactsAsyncHelper, mCallerInfoAsyncQueryFactory, mPhoneNumberUtilsAdapter, connection.getHandle() /* handle */, null /* gatewayInfo */, null /* connectionManagerPhoneAccount */, Loading
src/com/android/server/telecom/ConnectionServiceWrapper.java +29 −13 Original line number Diff line number Diff line Loading @@ -663,7 +663,7 @@ public class ConnectionServiceWrapper extends ServiceBinder { } private final Adapter mAdapter = new Adapter(); private final CallIdMapper mCallIdMapper = new CallIdMapper(); private final CallIdMapper mCallIdMapper = new CallIdMapper(Call::getConnectionId); private final Map<String, CreateConnectionResponse> mPendingResponses = new HashMap<>(); private Binder2 mBinder = new Binder2(); Loading Loading @@ -713,6 +713,17 @@ public class ConnectionServiceWrapper extends ServiceBinder { } } /** See {@link IConnectionService#removeConnectionServiceAdapter}. */ private void removeConnectionServiceAdapter(IConnectionServiceAdapter adapter) { if (isServiceValid("removeConnectionServiceAdapter")) { try { logOutgoing("removeConnectionServiceAdapter %s", adapter); mServiceInterface.removeConnectionServiceAdapter(adapter); } catch (RemoteException e) { } } } /** * Creates a new connection for a new outgoing call or to attach to an existing incoming call. */ Loading Loading @@ -1032,7 +1043,16 @@ public class ConnectionServiceWrapper extends ServiceBinder { /** {@inheritDoc} */ @Override protected void setServiceInterface(IBinder binder) { if (binder == null) { mServiceInterface = IConnectionService.Stub.asInterface(binder); Log.v(this, "Adding Connection Service Adapter."); addConnectionServiceAdapter(mAdapter); } /** {@inheritDoc} */ @Override protected void removeServiceInterface() { Log.v(this, "Removing Connection Service Adapter."); removeConnectionServiceAdapter(mAdapter); // We have lost our service connection. Notify the world that this service is done. // We must notify the adapter before CallsManager. The adapter will force any pending // outgoing calls to try the next service. This needs to happen before CallsManager Loading @@ -1040,10 +1060,6 @@ public class ConnectionServiceWrapper extends ServiceBinder { handleConnectionServiceDeath(); mCallsManager.handleConnectionServiceDeath(this); mServiceInterface = null; } else { mServiceInterface = IConnectionService.Stub.asInterface(binder); addConnectionServiceAdapter(mAdapter); } } private void handleCreateConnectionComplete( Loading