FileDocCategorySizeDatePackage
SipSessionListenerProxy.javaAPI DocAndroid 5.1 API7974Thu Mar 12 22:22:52 GMT 2015com.android.server.sip

SipSessionListenerProxy

public class SipSessionListenerProxy extends ISipSessionListener.Stub
Class to help safely run a callback in a different thread.

Fields Summary
private static final String
TAG
private android.net.sip.ISipSessionListener
mListener
Constructors Summary
Methods Summary
public android.net.sip.ISipSessionListenergetListener()

        return mListener;
    
private voidhandle(java.lang.Throwable t, java.lang.String message)

        if (t instanceof DeadObjectException) {
            mListener = null;
            // This creates race but it's harmless. Just don't log the error
            // when it happens.
        } else if (mListener != null) {
            loge(message, t);
        }
    
private voidlog(java.lang.String s)

        Rlog.d(TAG, s);
    
private voidloge(java.lang.String s, java.lang.Throwable t)

        Rlog.e(TAG, s, t);
    
public voidonCallBusy(android.net.sip.ISipSession session)

        if (mListener == null) return;
        proxy(new Runnable() {
            @Override
            public void run() {
                try {
                    mListener.onCallBusy(session);
                } catch (Throwable t) {
                    handle(t, "onCallBusy()");
                }
            }
        });
    
public voidonCallChangeFailed(android.net.sip.ISipSession session, int errorCode, java.lang.String message)

        if (mListener == null) return;
        proxy(new Runnable() {
            @Override
            public void run() {
                try {
                    mListener.onCallChangeFailed(session, errorCode, message);
                } catch (Throwable t) {
                    handle(t, "onCallChangeFailed()");
                }
            }
        });
    
public voidonCallEnded(android.net.sip.ISipSession session)

        if (mListener == null) return;
        proxy(new Runnable() {
            @Override
            public void run() {
                try {
                    mListener.onCallEnded(session);
                } catch (Throwable t) {
                    handle(t, "onCallEnded()");
                }
            }
        });
    
public voidonCallEstablished(android.net.sip.ISipSession session, java.lang.String sessionDescription)

        if (mListener == null) return;
        proxy(new Runnable() {
            @Override
            public void run() {
                try {
                    mListener.onCallEstablished(session, sessionDescription);
                } catch (Throwable t) {
                    handle(t, "onCallEstablished()");
                }
            }
        });
    
public voidonCallTransferring(android.net.sip.ISipSession newSession, java.lang.String sessionDescription)

        if (mListener == null) return;
        proxy(new Runnable() {
            @Override
            public void run() {
                try {
                    mListener.onCallTransferring(newSession, sessionDescription);
                } catch (Throwable t) {
                    handle(t, "onCallTransferring()");
                }
            }
        });
    
public voidonCalling(android.net.sip.ISipSession session)

        if (mListener == null) return;
        proxy(new Runnable() {
            @Override
            public void run() {
                try {
                    mListener.onCalling(session);
                } catch (Throwable t) {
                    handle(t, "onCalling()");
                }
            }
        });
    
public voidonError(android.net.sip.ISipSession session, int errorCode, java.lang.String message)

        if (mListener == null) return;
        proxy(new Runnable() {
            @Override
            public void run() {
                try {
                    mListener.onError(session, errorCode, message);
                } catch (Throwable t) {
                    handle(t, "onError()");
                }
            }
        });
    
public voidonRegistering(android.net.sip.ISipSession session)

        if (mListener == null) return;
        proxy(new Runnable() {
            @Override
            public void run() {
                try {
                    mListener.onRegistering(session);
                } catch (Throwable t) {
                    handle(t, "onRegistering()");
                }
            }
        });
    
public voidonRegistrationDone(android.net.sip.ISipSession session, int duration)

        if (mListener == null) return;
        proxy(new Runnable() {
            @Override
            public void run() {
                try {
                    mListener.onRegistrationDone(session, duration);
                } catch (Throwable t) {
                    handle(t, "onRegistrationDone()");
                }
            }
        });
    
public voidonRegistrationFailed(android.net.sip.ISipSession session, int errorCode, java.lang.String message)

        if (mListener == null) return;
        proxy(new Runnable() {
            @Override
            public void run() {
                try {
                    mListener.onRegistrationFailed(session, errorCode, message);
                } catch (Throwable t) {
                    handle(t, "onRegistrationFailed()");
                }
            }
        });
    
public voidonRegistrationTimeout(android.net.sip.ISipSession session)

        if (mListener == null) return;
        proxy(new Runnable() {
            @Override
            public void run() {
                try {
                    mListener.onRegistrationTimeout(session);
                } catch (Throwable t) {
                    handle(t, "onRegistrationTimeout()");
                }
            }
        });
    
public voidonRinging(android.net.sip.ISipSession session, android.net.sip.SipProfile caller, java.lang.String sessionDescription)

        if (mListener == null) return;
        proxy(new Runnable() {
            @Override
            public void run() {
                try {
                    mListener.onRinging(session, caller, sessionDescription);
                } catch (Throwable t) {
                    handle(t, "onRinging()");
                }
            }
        });
    
public voidonRingingBack(android.net.sip.ISipSession session)

        if (mListener == null) return;
        proxy(new Runnable() {
            @Override
            public void run() {
                try {
                    mListener.onRingingBack(session);
                } catch (Throwable t) {
                    handle(t, "onRingingBack()");
                }
            }
        });
    
private voidproxy(java.lang.Runnable runnable)

        // One thread for each calling back.
        // Note: Guarantee ordering if the issue becomes important. Currently,
        // the chance of handling two callback events at a time is none.
        new Thread(runnable, "SipSessionCallbackThread").start();
    
public voidsetListener(android.net.sip.ISipSessionListener listener)


        
        mListener = listener;