Merge "Clean up pending sessions on incoming call in SipService" into gingerbread
This commit is contained in:
committed by
Android (Google) Code Review
commit
1257d330dc
@ -441,13 +441,26 @@ public final class SipService extends ISipService.Stub {
|
|||||||
|
|
||||||
private synchronized void addPendingSession(ISipSession session) {
|
private synchronized void addPendingSession(ISipSession session) {
|
||||||
try {
|
try {
|
||||||
|
cleanUpPendingSessions();
|
||||||
mPendingSessions.put(session.getCallId(), session);
|
mPendingSessions.put(session.getCallId(), session);
|
||||||
|
if (DEBUG) Log.d(TAG, "#pending sess=" + mPendingSessions.size());
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
// should not happen with a local call
|
// should not happen with a local call
|
||||||
Log.e(TAG, "addPendingSession()", e);
|
Log.e(TAG, "addPendingSession()", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void cleanUpPendingSessions() throws RemoteException {
|
||||||
|
Map.Entry<String, ISipSession>[] entries =
|
||||||
|
mPendingSessions.entrySet().toArray(
|
||||||
|
new Map.Entry[mPendingSessions.size()]);
|
||||||
|
for (Map.Entry<String, ISipSession> entry : entries) {
|
||||||
|
if (entry.getValue().getState() != SipSession.State.INCOMING_CALL) {
|
||||||
|
mPendingSessions.remove(entry.getKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private synchronized boolean callingSelf(SipSessionGroupExt ringingGroup,
|
private synchronized boolean callingSelf(SipSessionGroupExt ringingGroup,
|
||||||
SipSessionGroup.SipSessionImpl ringingSession) {
|
SipSessionGroup.SipSessionImpl ringingSession) {
|
||||||
String callId = ringingSession.getCallId();
|
String callId = ringingSession.getCallId();
|
||||||
@ -1095,8 +1108,6 @@ public final class SipService extends ISipService.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: clean up pending SipSession(s) periodically
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timer that can schedule events to occur even when the device is in sleep.
|
* Timer that can schedule events to occur even when the device is in sleep.
|
||||||
* Only used internally in this package.
|
* Only used internally in this package.
|
||||||
|
Reference in New Issue
Block a user