am d29e0754: Merge "Add uri field to SipManager.ListenerRelay" into gingerbread

Merge commit 'd29e0754183e4b3945eb7cabae91cd3df47ae4d6' into gingerbread-plus-aosp

* commit 'd29e0754183e4b3945eb7cabae91cd3df47ae4d6':
  Add uri field to SipManager.ListenerRelay
This commit is contained in:
Hung-ying Tyan
2010-09-30 10:10:52 -07:00
committed by Android Git Automerger

View File

@ -173,7 +173,7 @@ public class SipManager {
SipRegistrationListener listener) throws SipException { SipRegistrationListener listener) throws SipException {
try { try {
mSipService.open3(localProfile, incomingCallBroadcastAction, mSipService.open3(localProfile, incomingCallBroadcastAction,
createRelay(listener)); createRelay(listener, localProfile.getUriString()));
} catch (RemoteException e) { } catch (RemoteException e) {
throw new SipException("open()", e); throw new SipException("open()", e);
} }
@ -191,7 +191,7 @@ public class SipManager {
SipRegistrationListener listener) throws SipException { SipRegistrationListener listener) throws SipException {
try { try {
mSipService.setRegistrationListener( mSipService.setRegistrationListener(
localProfileUri, createRelay(listener)); localProfileUri, createRelay(listener, localProfileUri));
} catch (RemoteException e) { } catch (RemoteException e) {
throw new SipException("setRegistrationListener()", e); throw new SipException("setRegistrationListener()", e);
} }
@ -425,8 +425,8 @@ public class SipManager {
public void register(SipProfile localProfile, int expiryTime, public void register(SipProfile localProfile, int expiryTime,
SipRegistrationListener listener) throws SipException { SipRegistrationListener listener) throws SipException {
try { try {
ISipSession session = mSipService.createSession( ISipSession session = mSipService.createSession(localProfile,
localProfile, createRelay(listener)); createRelay(listener, localProfile.getUriString()));
session.register(expiryTime); session.register(expiryTime);
} catch (RemoteException e) { } catch (RemoteException e) {
throw new SipException("register()", e); throw new SipException("register()", e);
@ -446,8 +446,8 @@ public class SipManager {
public void unregister(SipProfile localProfile, public void unregister(SipProfile localProfile,
SipRegistrationListener listener) throws SipException { SipRegistrationListener listener) throws SipException {
try { try {
ISipSession session = mSipService.createSession( ISipSession session = mSipService.createSession(localProfile,
localProfile, createRelay(listener)); createRelay(listener, localProfile.getUriString()));
session.unregister(); session.unregister();
} catch (RemoteException e) { } catch (RemoteException e) {
throw new SipException("unregister()", e); throw new SipException("unregister()", e);
@ -475,8 +475,8 @@ public class SipManager {
} }
private static ISipSessionListener createRelay( private static ISipSessionListener createRelay(
SipRegistrationListener listener) { SipRegistrationListener listener, String uri) {
return ((listener == null) ? null : new ListenerRelay(listener)); return ((listener == null) ? null : new ListenerRelay(listener, uri));
} }
/** /**
@ -512,16 +512,18 @@ public class SipManager {
private static class ListenerRelay extends SipSessionAdapter { private static class ListenerRelay extends SipSessionAdapter {
private SipRegistrationListener mListener; private SipRegistrationListener mListener;
private String mUri;
// listener must not be null // listener must not be null
public ListenerRelay(SipRegistrationListener listener) { public ListenerRelay(SipRegistrationListener listener, String uri) {
mListener = listener; mListener = listener;
mUri = uri;
} }
private String getUri(ISipSession session) { private String getUri(ISipSession session) {
try { try {
return ((session == null) return ((session == null)
? "no session" ? mUri
: session.getLocalProfile().getUriString()); : session.getLocalProfile().getUriString());
} catch (RemoteException e) { } catch (RemoteException e) {
throw new RuntimeException(e); throw new RuntimeException(e);