Loading src/com/android/server/telecom/Call.java +16 −2 Original line number Diff line number Diff line Loading @@ -65,6 +65,8 @@ import java.util.concurrent.ConcurrentHashMap; */ @VisibleForTesting public class Call implements CreateConnectionResponse { public final static String CALL_ID_UNKNOWN = "-1"; /** * Listener for events on the call. */ Loading Loading @@ -320,6 +322,7 @@ public class Call implements CreateConnectionResponse { private final CallsManager mCallsManager; private final TelecomSystem.SyncRoot mLock; private final CallerInfoAsyncQueryFactory mCallerInfoAsyncQueryFactory; private final String mId; private boolean mWasConferencePreviouslyMerged = false; Loading @@ -346,6 +349,7 @@ public class Call implements CreateConnectionResponse { * @param isIncoming True if this is an incoming call. */ public Call( String callId, Context context, CallsManager callsManager, TelecomSystem.SyncRoot lock, Loading @@ -358,6 +362,7 @@ public class Call implements CreateConnectionResponse { PhoneAccountHandle targetPhoneAccountHandle, boolean isIncoming, boolean isConference) { mId = callId; mState = isConference ? CallState.ACTIVE : CallState.NEW; mContext = context; mCallsManager = callsManager; Loading Loading @@ -392,6 +397,7 @@ public class Call implements CreateConnectionResponse { * @param connectTimeMillis The connection time of the call. */ Call( String callId, Context context, CallsManager callsManager, TelecomSystem.SyncRoot lock, Loading @@ -405,7 +411,7 @@ public class Call implements CreateConnectionResponse { boolean isIncoming, boolean isConference, long connectTimeMillis) { this(context, callsManager, lock, repository, contactsAsyncHelper, this(callId, context, callsManager, lock, repository, contactsAsyncHelper, callerInfoAsyncQueryFactory, handle, gatewayInfo, connectionManagerPhoneAccountHandle, targetPhoneAccountHandle, isIncoming, isConference); Loading Loading @@ -438,7 +444,7 @@ public class Call implements CreateConnectionResponse { return String.format(Locale.US, "[%s, %s, %s, %s, %s, childs(%d), has_parent(%b), [%s]]", System.identityHashCode(this), mId, CallState.toString(mState), component, Log.piiHandle(mHandle), Loading Loading @@ -502,6 +508,14 @@ public class Call implements CreateConnectionResponse { mCreateConnectionProcessor.isCallTimedOut(); } /** * Returns the unique ID for this call as it exists in Telecom. * @return The call ID. */ public String getId() { return mId; } /** * 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 src/com/android/server/telecom/CallIdMapper.java +3 −26 Original line number Diff line number Diff line Loading @@ -75,12 +75,6 @@ class CallIdMapper { } private final BiMap<String, Call> mCalls = new BiMap<>(); private final String mCallIdPrefix; private static int sIdCount; CallIdMapper(String callIdPrefix) { mCallIdPrefix = callIdPrefix + "@"; } void replaceCall(Call newCall, Call callToReplace) { // Use the old call's ID for the new call. Loading @@ -96,7 +90,7 @@ class CallIdMapper { } void addCall(Call call) { addCall(call, getNewId()); addCall(call, call.getId()); } void removeCall(Call call) { Loading @@ -111,10 +105,10 @@ class CallIdMapper { } String getCallId(Call call) { if (call == null) { if (call == null || mCalls.getKey(call) == null) { return null; } return mCalls.getKey(call); return call.getId(); } Call getCall(Object objId) { Loading @@ -122,9 +116,6 @@ class CallIdMapper { if (objId instanceof String) { callId = (String) objId; } if (!isValidCallId(callId) && !isValidConferenceId(callId)) { return null; } return mCalls.getValue(callId); } Loading @@ -132,18 +123,4 @@ class CallIdMapper { void clear() { mCalls.clear(); } boolean isValidCallId(String callId) { // Note, no need for thread check, this method is thread safe. return callId != null && callId.startsWith(mCallIdPrefix); } boolean isValidConferenceId(String callId) { return callId != null; } String getNewId() { sIdCount++; return mCallIdPrefix + sIdCount; } } src/com/android/server/telecom/CallsManager.java +23 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,7 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx private static final int[] LIVE_CALL_STATES = {CallState.CONNECTING, CallState.SELECT_PHONE_ACCOUNT, CallState.DIALING, CallState.ACTIVE}; public static final String TELECOM_CALL_ID_PREFIX = "TC@"; /** * The main call repository. Keeps an instance of all live calls. New incoming and outgoing Loading @@ -109,6 +110,13 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx private final Set<Call> mCalls = Collections.newSetFromMap( new ConcurrentHashMap<Call, Boolean>(8, 0.9f, 1)); /** * The current telecom call ID. Used when creating new instances of {@link Call}. Should * only be accessed using the {@link #getNextCallId()} method which synchronizes on the * {@link #mLock} sync root. */ private int mCallId = 0; private final ConnectionServiceRepository mConnectionServiceRepository; private final DtmfLocalTonePlayer mDtmfLocalTonePlayer; private final InCallController mInCallController; Loading Loading @@ -492,6 +500,7 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx handle = extras.getParcelable(TelephonyManager.EXTRA_INCOMING_NUMBER); } Call call = new Call( getNextCallId(), mContext, this, mLock, Loading @@ -515,6 +524,7 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx Uri handle = extras.getParcelable(TelecomManager.EXTRA_UNKNOWN_CALL_HANDLE); Log.i(this, "addNewUnknownCall with handle: %s", Log.pii(handle)); Call call = new Call( getNextCallId(), mContext, this, mLock, Loading Loading @@ -570,6 +580,7 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx // Create a call with original handle. The handle may be changed when the call is attached // to a connection service, but in most cases will remain the same. return new Call( getNextCallId(), mContext, this, mLock, Loading Loading @@ -1178,6 +1189,7 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx } Call createConferenceCall( String callId, PhoneAccountHandle phoneAccount, ParcelableConference parcelableConference) { Loading @@ -1189,6 +1201,7 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx parcelableConference.getConnectTimeMillis(); Call call = new Call( callId, mContext, this, mLock, Loading Loading @@ -1597,6 +1610,7 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx */ Call createCallForExistingConnection(String callId, ParcelableConnection connection) { Call call = new Call( getNextCallId(), mContext, this, mLock, Loading @@ -1623,6 +1637,15 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx return call; } /** * @return A new unique telecom call Id. */ private String getNextCallId() { synchronized(mLock) { return TELECOM_CALL_ID_PREFIX + (++mCallId); } } /** * Dumps the state of the {@link CallsManager}. * Loading src/com/android/server/telecom/ConnectionServiceWrapper.java +106 −156 Original line number Diff line number Diff line Loading @@ -70,11 +70,9 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("handleCreateConnectionComplete %s", callId); if (mCallIdMapper.isValidCallId(callId)) { ConnectionServiceWrapper.this .handleCreateConnectionComplete(callId, request, connection); } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -86,8 +84,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setActive %s", callId); if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper .isValidConferenceId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { mCallsManager.markCallAsActive(call); Loading @@ -95,7 +91,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { // Log.w(this, "setActive, unknown call id: %s", msg.obj); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -107,7 +102,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setRinging %s", callId); if (mCallIdMapper.isValidCallId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { mCallsManager.markCallAsRinging(call); Loading @@ -115,7 +109,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { // Log.w(this, "setRinging, unknown call id: %s", msg.obj); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -127,14 +120,11 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setVideoProvider %s", callId); if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper.isValidConferenceId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.setVideoProvider(videoProvider); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -146,7 +136,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setDialing %s", callId); if (mCallIdMapper.isValidCallId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { mCallsManager.markCallAsDialing(call); Loading @@ -154,7 +143,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { // Log.w(this, "setDialing, unknown call id: %s", msg.obj); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -166,8 +154,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setDisconnected %s %s", callId, disconnectCause); if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper .isValidConferenceId(callId)) { Call call = mCallIdMapper.getCall(callId); Log.d(this, "disconnect call %s %s", disconnectCause, call); if (call != null) { Loading @@ -176,7 +162,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { // Log.w(this, "setDisconnected, unknown call id: %s", args.arg1); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -188,8 +173,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setOnHold %s", callId); if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper .isValidConferenceId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { mCallsManager.markCallAsOnHold(call); Loading @@ -197,7 +180,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { // Log.w(this, "setOnHold, unknown call id: %s", msg.obj); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -209,7 +191,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setRingbackRequested %s %b", callId, ringback); if (mCallIdMapper.isValidCallId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.setRingbackRequested(ringback); Loading @@ -217,7 +198,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { // Log.w(this, "setRingback, unknown call id: %s", args.arg1); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -229,8 +209,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("removeCall %s", callId); if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper .isValidConferenceId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { if (call.isAlive()) { Loading @@ -241,7 +219,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { } } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -253,8 +230,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setConnectionCapabilities %s %d", callId, connectionCapabilities); if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper .isValidConferenceId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.setConnectionCapabilities(connectionCapabilities); Loading @@ -263,7 +238,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { // "setConnectionCapabilities, unknown call id: %s", msg.obj); } } } } finally { Binder.restoreCallingIdentity(token); } Loading Loading @@ -299,7 +273,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setConferenceMergeFailed %s", callId); if (mCallIdMapper.isValidCallId(callId)) { // TODO: we should move the UI for indication a merge failure here // from CallNotifier.onSuppServiceFailed(). This way the InCallUI can // deliver the message anyway that they want. b/20530631. Loading @@ -318,8 +291,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { Log.w(this, "setConferenceMergeFailed, unknown call id: %s", callId); } } } } finally { Binder.restoreCallingIdentity(token); } Loading Loading @@ -358,7 +329,7 @@ final class ConnectionServiceWrapper extends ServiceBinder { parcelableConference.getPhoneAccount() != null) { phAcc = parcelableConference.getPhoneAccount(); } Call conferenceCall = mCallsManager.createConferenceCall( Call conferenceCall = mCallsManager.createConferenceCall(callId, phAcc, parcelableConference); mCallIdMapper.addCall(conferenceCall, callId); conferenceCall.setConnectionService(ConnectionServiceWrapper.this); Loading @@ -384,7 +355,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("onPostDialWait %s %s", callId, remaining); if (mCallIdMapper.isValidCallId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.onPostDialWait(remaining); Loading @@ -392,7 +362,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { // Log.w(this, "onPostDialWait, unknown call id: %s", args.arg1); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -404,7 +373,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("onPostDialChar %s %s", callId, nextChar); if (mCallIdMapper.isValidCallId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.onPostDialChar(nextChar); Loading @@ -412,7 +380,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { // Log.w(this, "onPostDialChar, unknown call id: %s", args.arg1); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -437,14 +404,11 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setVideoState %s %d", callId, videoState); if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper.isValidConferenceId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.setVideoState(videoState); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -456,13 +420,11 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setIsVoipAudioMode %s %b", callId, isVoip); if (mCallIdMapper.isValidCallId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.setIsVoipAudioMode(isVoip); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -474,14 +436,11 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setStatusHints %s %s", callId, statusHints); if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper.isValidConferenceId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.setStatusHints(statusHints); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -493,14 +452,11 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized(mLock) { logIncoming("setExtras %s %s", callId, extras); if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper.isValidConferenceId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.setExtras(extras); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -512,13 +468,11 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setAddress %s %s %d", callId, address, presentation); if (mCallIdMapper.isValidCallId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.setHandle(address, presentation); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -532,13 +486,11 @@ final class ConnectionServiceWrapper extends ServiceBinder { synchronized (mLock) { logIncoming("setCallerDisplayName %s %s %d", callId, callerDisplayName, presentation); if (mCallIdMapper.isValidCallId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.setCallerDisplayName(callerDisplayName, presentation); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -552,8 +504,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { synchronized (mLock) { logIncoming("setConferenceableConnections %s %s", callId, conferenceableCallIds); if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper.isValidConferenceId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { List<Call> conferenceableCalls = Loading @@ -567,7 +517,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { call.setConferenceableCalls(conferenceableCalls); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -591,7 +540,7 @@ final class ConnectionServiceWrapper extends ServiceBinder { } private final Adapter mAdapter = new Adapter(); private final CallIdMapper mCallIdMapper = new CallIdMapper("ConnectionService"); private final CallIdMapper mCallIdMapper = new CallIdMapper(); private final Map<String, CreateConnectionResponse> mPendingResponses = new HashMap<>(); private Binder2 mBinder = new Binder2(); Loading Loading @@ -672,7 +621,8 @@ final class ConnectionServiceWrapper extends ServiceBinder { call.getTargetPhoneAccount(), call.getHandle(), extras, call.getVideoState()), call.getVideoState(), callId), call.isIncoming(), call.isUnknown()); } catch (RemoteException e) { Loading src/com/android/server/telecom/InCallAdapter.java +66 −94 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
src/com/android/server/telecom/Call.java +16 −2 Original line number Diff line number Diff line Loading @@ -65,6 +65,8 @@ import java.util.concurrent.ConcurrentHashMap; */ @VisibleForTesting public class Call implements CreateConnectionResponse { public final static String CALL_ID_UNKNOWN = "-1"; /** * Listener for events on the call. */ Loading Loading @@ -320,6 +322,7 @@ public class Call implements CreateConnectionResponse { private final CallsManager mCallsManager; private final TelecomSystem.SyncRoot mLock; private final CallerInfoAsyncQueryFactory mCallerInfoAsyncQueryFactory; private final String mId; private boolean mWasConferencePreviouslyMerged = false; Loading @@ -346,6 +349,7 @@ public class Call implements CreateConnectionResponse { * @param isIncoming True if this is an incoming call. */ public Call( String callId, Context context, CallsManager callsManager, TelecomSystem.SyncRoot lock, Loading @@ -358,6 +362,7 @@ public class Call implements CreateConnectionResponse { PhoneAccountHandle targetPhoneAccountHandle, boolean isIncoming, boolean isConference) { mId = callId; mState = isConference ? CallState.ACTIVE : CallState.NEW; mContext = context; mCallsManager = callsManager; Loading Loading @@ -392,6 +397,7 @@ public class Call implements CreateConnectionResponse { * @param connectTimeMillis The connection time of the call. */ Call( String callId, Context context, CallsManager callsManager, TelecomSystem.SyncRoot lock, Loading @@ -405,7 +411,7 @@ public class Call implements CreateConnectionResponse { boolean isIncoming, boolean isConference, long connectTimeMillis) { this(context, callsManager, lock, repository, contactsAsyncHelper, this(callId, context, callsManager, lock, repository, contactsAsyncHelper, callerInfoAsyncQueryFactory, handle, gatewayInfo, connectionManagerPhoneAccountHandle, targetPhoneAccountHandle, isIncoming, isConference); Loading Loading @@ -438,7 +444,7 @@ public class Call implements CreateConnectionResponse { return String.format(Locale.US, "[%s, %s, %s, %s, %s, childs(%d), has_parent(%b), [%s]]", System.identityHashCode(this), mId, CallState.toString(mState), component, Log.piiHandle(mHandle), Loading Loading @@ -502,6 +508,14 @@ public class Call implements CreateConnectionResponse { mCreateConnectionProcessor.isCallTimedOut(); } /** * Returns the unique ID for this call as it exists in Telecom. * @return The call ID. */ public String getId() { return mId; } /** * 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
src/com/android/server/telecom/CallIdMapper.java +3 −26 Original line number Diff line number Diff line Loading @@ -75,12 +75,6 @@ class CallIdMapper { } private final BiMap<String, Call> mCalls = new BiMap<>(); private final String mCallIdPrefix; private static int sIdCount; CallIdMapper(String callIdPrefix) { mCallIdPrefix = callIdPrefix + "@"; } void replaceCall(Call newCall, Call callToReplace) { // Use the old call's ID for the new call. Loading @@ -96,7 +90,7 @@ class CallIdMapper { } void addCall(Call call) { addCall(call, getNewId()); addCall(call, call.getId()); } void removeCall(Call call) { Loading @@ -111,10 +105,10 @@ class CallIdMapper { } String getCallId(Call call) { if (call == null) { if (call == null || mCalls.getKey(call) == null) { return null; } return mCalls.getKey(call); return call.getId(); } Call getCall(Object objId) { Loading @@ -122,9 +116,6 @@ class CallIdMapper { if (objId instanceof String) { callId = (String) objId; } if (!isValidCallId(callId) && !isValidConferenceId(callId)) { return null; } return mCalls.getValue(callId); } Loading @@ -132,18 +123,4 @@ class CallIdMapper { void clear() { mCalls.clear(); } boolean isValidCallId(String callId) { // Note, no need for thread check, this method is thread safe. return callId != null && callId.startsWith(mCallIdPrefix); } boolean isValidConferenceId(String callId) { return callId != null; } String getNewId() { sIdCount++; return mCallIdPrefix + sIdCount; } }
src/com/android/server/telecom/CallsManager.java +23 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,7 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx private static final int[] LIVE_CALL_STATES = {CallState.CONNECTING, CallState.SELECT_PHONE_ACCOUNT, CallState.DIALING, CallState.ACTIVE}; public static final String TELECOM_CALL_ID_PREFIX = "TC@"; /** * The main call repository. Keeps an instance of all live calls. New incoming and outgoing Loading @@ -109,6 +110,13 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx private final Set<Call> mCalls = Collections.newSetFromMap( new ConcurrentHashMap<Call, Boolean>(8, 0.9f, 1)); /** * The current telecom call ID. Used when creating new instances of {@link Call}. Should * only be accessed using the {@link #getNextCallId()} method which synchronizes on the * {@link #mLock} sync root. */ private int mCallId = 0; private final ConnectionServiceRepository mConnectionServiceRepository; private final DtmfLocalTonePlayer mDtmfLocalTonePlayer; private final InCallController mInCallController; Loading Loading @@ -492,6 +500,7 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx handle = extras.getParcelable(TelephonyManager.EXTRA_INCOMING_NUMBER); } Call call = new Call( getNextCallId(), mContext, this, mLock, Loading @@ -515,6 +524,7 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx Uri handle = extras.getParcelable(TelecomManager.EXTRA_UNKNOWN_CALL_HANDLE); Log.i(this, "addNewUnknownCall with handle: %s", Log.pii(handle)); Call call = new Call( getNextCallId(), mContext, this, mLock, Loading Loading @@ -570,6 +580,7 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx // Create a call with original handle. The handle may be changed when the call is attached // to a connection service, but in most cases will remain the same. return new Call( getNextCallId(), mContext, this, mLock, Loading Loading @@ -1178,6 +1189,7 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx } Call createConferenceCall( String callId, PhoneAccountHandle phoneAccount, ParcelableConference parcelableConference) { Loading @@ -1189,6 +1201,7 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx parcelableConference.getConnectTimeMillis(); Call call = new Call( callId, mContext, this, mLock, Loading Loading @@ -1597,6 +1610,7 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx */ Call createCallForExistingConnection(String callId, ParcelableConnection connection) { Call call = new Call( getNextCallId(), mContext, this, mLock, Loading @@ -1623,6 +1637,15 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx return call; } /** * @return A new unique telecom call Id. */ private String getNextCallId() { synchronized(mLock) { return TELECOM_CALL_ID_PREFIX + (++mCallId); } } /** * Dumps the state of the {@link CallsManager}. * Loading
src/com/android/server/telecom/ConnectionServiceWrapper.java +106 −156 Original line number Diff line number Diff line Loading @@ -70,11 +70,9 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("handleCreateConnectionComplete %s", callId); if (mCallIdMapper.isValidCallId(callId)) { ConnectionServiceWrapper.this .handleCreateConnectionComplete(callId, request, connection); } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -86,8 +84,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setActive %s", callId); if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper .isValidConferenceId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { mCallsManager.markCallAsActive(call); Loading @@ -95,7 +91,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { // Log.w(this, "setActive, unknown call id: %s", msg.obj); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -107,7 +102,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setRinging %s", callId); if (mCallIdMapper.isValidCallId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { mCallsManager.markCallAsRinging(call); Loading @@ -115,7 +109,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { // Log.w(this, "setRinging, unknown call id: %s", msg.obj); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -127,14 +120,11 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setVideoProvider %s", callId); if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper.isValidConferenceId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.setVideoProvider(videoProvider); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -146,7 +136,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setDialing %s", callId); if (mCallIdMapper.isValidCallId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { mCallsManager.markCallAsDialing(call); Loading @@ -154,7 +143,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { // Log.w(this, "setDialing, unknown call id: %s", msg.obj); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -166,8 +154,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setDisconnected %s %s", callId, disconnectCause); if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper .isValidConferenceId(callId)) { Call call = mCallIdMapper.getCall(callId); Log.d(this, "disconnect call %s %s", disconnectCause, call); if (call != null) { Loading @@ -176,7 +162,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { // Log.w(this, "setDisconnected, unknown call id: %s", args.arg1); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -188,8 +173,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setOnHold %s", callId); if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper .isValidConferenceId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { mCallsManager.markCallAsOnHold(call); Loading @@ -197,7 +180,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { // Log.w(this, "setOnHold, unknown call id: %s", msg.obj); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -209,7 +191,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setRingbackRequested %s %b", callId, ringback); if (mCallIdMapper.isValidCallId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.setRingbackRequested(ringback); Loading @@ -217,7 +198,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { // Log.w(this, "setRingback, unknown call id: %s", args.arg1); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -229,8 +209,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("removeCall %s", callId); if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper .isValidConferenceId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { if (call.isAlive()) { Loading @@ -241,7 +219,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { } } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -253,8 +230,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setConnectionCapabilities %s %d", callId, connectionCapabilities); if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper .isValidConferenceId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.setConnectionCapabilities(connectionCapabilities); Loading @@ -263,7 +238,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { // "setConnectionCapabilities, unknown call id: %s", msg.obj); } } } } finally { Binder.restoreCallingIdentity(token); } Loading Loading @@ -299,7 +273,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setConferenceMergeFailed %s", callId); if (mCallIdMapper.isValidCallId(callId)) { // TODO: we should move the UI for indication a merge failure here // from CallNotifier.onSuppServiceFailed(). This way the InCallUI can // deliver the message anyway that they want. b/20530631. Loading @@ -318,8 +291,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { Log.w(this, "setConferenceMergeFailed, unknown call id: %s", callId); } } } } finally { Binder.restoreCallingIdentity(token); } Loading Loading @@ -358,7 +329,7 @@ final class ConnectionServiceWrapper extends ServiceBinder { parcelableConference.getPhoneAccount() != null) { phAcc = parcelableConference.getPhoneAccount(); } Call conferenceCall = mCallsManager.createConferenceCall( Call conferenceCall = mCallsManager.createConferenceCall(callId, phAcc, parcelableConference); mCallIdMapper.addCall(conferenceCall, callId); conferenceCall.setConnectionService(ConnectionServiceWrapper.this); Loading @@ -384,7 +355,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("onPostDialWait %s %s", callId, remaining); if (mCallIdMapper.isValidCallId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.onPostDialWait(remaining); Loading @@ -392,7 +362,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { // Log.w(this, "onPostDialWait, unknown call id: %s", args.arg1); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -404,7 +373,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("onPostDialChar %s %s", callId, nextChar); if (mCallIdMapper.isValidCallId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.onPostDialChar(nextChar); Loading @@ -412,7 +380,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { // Log.w(this, "onPostDialChar, unknown call id: %s", args.arg1); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -437,14 +404,11 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setVideoState %s %d", callId, videoState); if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper.isValidConferenceId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.setVideoState(videoState); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -456,13 +420,11 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setIsVoipAudioMode %s %b", callId, isVoip); if (mCallIdMapper.isValidCallId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.setIsVoipAudioMode(isVoip); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -474,14 +436,11 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setStatusHints %s %s", callId, statusHints); if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper.isValidConferenceId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.setStatusHints(statusHints); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -493,14 +452,11 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized(mLock) { logIncoming("setExtras %s %s", callId, extras); if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper.isValidConferenceId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.setExtras(extras); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -512,13 +468,11 @@ final class ConnectionServiceWrapper extends ServiceBinder { try { synchronized (mLock) { logIncoming("setAddress %s %s %d", callId, address, presentation); if (mCallIdMapper.isValidCallId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.setHandle(address, presentation); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -532,13 +486,11 @@ final class ConnectionServiceWrapper extends ServiceBinder { synchronized (mLock) { logIncoming("setCallerDisplayName %s %s %d", callId, callerDisplayName, presentation); if (mCallIdMapper.isValidCallId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.setCallerDisplayName(callerDisplayName, presentation); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -552,8 +504,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { synchronized (mLock) { logIncoming("setConferenceableConnections %s %s", callId, conferenceableCallIds); if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper.isValidConferenceId(callId)) { Call call = mCallIdMapper.getCall(callId); if (call != null) { List<Call> conferenceableCalls = Loading @@ -567,7 +517,6 @@ final class ConnectionServiceWrapper extends ServiceBinder { call.setConferenceableCalls(conferenceableCalls); } } } } finally { Binder.restoreCallingIdentity(token); } Loading @@ -591,7 +540,7 @@ final class ConnectionServiceWrapper extends ServiceBinder { } private final Adapter mAdapter = new Adapter(); private final CallIdMapper mCallIdMapper = new CallIdMapper("ConnectionService"); private final CallIdMapper mCallIdMapper = new CallIdMapper(); private final Map<String, CreateConnectionResponse> mPendingResponses = new HashMap<>(); private Binder2 mBinder = new Binder2(); Loading Loading @@ -672,7 +621,8 @@ final class ConnectionServiceWrapper extends ServiceBinder { call.getTargetPhoneAccount(), call.getHandle(), extras, call.getVideoState()), call.getVideoState(), callId), call.isIncoming(), call.isUnknown()); } catch (RemoteException e) { Loading
src/com/android/server/telecom/InCallAdapter.java +66 −94 File changed.Preview size limit exceeded, changes collapsed. Show changes