Loading api/current.xml +1950 −0 File changed.Preview size limit exceeded, changes collapsed. Show changes core/res/AndroidManifest.xml +7 −0 Original line number Diff line number Diff line Loading @@ -364,6 +364,13 @@ android:description="@string/permdesc_nfcLlcp" android:label="@string/permlab_nfcLlcp" /> <!-- Allows an application to use SIP service --> <permission android:name="android.permission.USE_SIP" android:permissionGroup="android.permission-group.NETWORK" android:protectionLevel="dangerous" android:description="@string/permdesc_use_sip" android:label="@string/permlab_use_sip" /> <!-- Allows applications to call into AccountAuthenticators. Only the system can get this permission. --> <permission android:name="android.permission.ACCOUNT_MANAGER" Loading core/res/res/values/strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -1240,6 +1240,11 @@ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permdesc_cache_filesystem">Allows an application to read and write the cache filesystem.</string> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permlab_use_sip">make/receive Internet calls</string> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permdesc_use_sip">Allows an application to use the SIP service to make/receive Internet calls.</string> <!-- Policy administration --> <!-- Title of policy access to limiting the user's password choices --> Loading voip/java/android/net/sip/SipAudioCall.java +166 −113 Original line number Diff line number Diff line Loading @@ -43,9 +43,11 @@ import java.util.List; import java.util.Map; /** * Class that handles an audio call over SIP. * Class that handles an Internet audio call over SIP. {@link SipManager} * facilitates instantiating a {@code SipAudioCall} object for making/receiving * calls. See {@link SipManager#makeAudioCall} and * {@link SipManager#takeAudioCall}. */ /** @hide */ public class SipAudioCall { private static final String TAG = SipAudioCall.class.getSimpleName(); private static final boolean RELEASE_SOCKET = true; Loading @@ -56,7 +58,7 @@ public class SipAudioCall { public static class Listener { /** * Called when the call object is ready to make another call. * The default implementation calls {@link #onChange}. * The default implementation calls {@link #onChanged}. * * @param call the call object that is ready to make another call */ Loading @@ -66,7 +68,7 @@ public class SipAudioCall { /** * Called when a request is sent out to initiate a new call. * The default implementation calls {@link #onChange}. * The default implementation calls {@link #onChanged}. * * @param call the call object that carries out the audio call */ Loading @@ -76,7 +78,7 @@ public class SipAudioCall { /** * Called when a new call comes in. * The default implementation calls {@link #onChange}. * The default implementation calls {@link #onChanged}. * * @param call the call object that carries out the audio call * @param caller the SIP profile of the caller Loading @@ -87,7 +89,7 @@ public class SipAudioCall { /** * Called when a RINGING response is received for the INVITE request * sent. The default implementation calls {@link #onChange}. * sent. The default implementation calls {@link #onChanged}. * * @param call the call object that carries out the audio call */ Loading @@ -97,7 +99,7 @@ public class SipAudioCall { /** * Called when the session is established. * The default implementation calls {@link #onChange}. * The default implementation calls {@link #onChanged}. * * @param call the call object that carries out the audio call */ Loading @@ -107,7 +109,7 @@ public class SipAudioCall { /** * Called when the session is terminated. * The default implementation calls {@link #onChange}. * The default implementation calls {@link #onChanged}. * * @param call the call object that carries out the audio call */ Loading @@ -117,7 +119,7 @@ public class SipAudioCall { /** * Called when the peer is busy during session initialization. * The default implementation calls {@link #onChange}. * The default implementation calls {@link #onChanged}. * * @param call the call object that carries out the audio call */ Loading @@ -127,7 +129,7 @@ public class SipAudioCall { /** * Called when the call is on hold. * The default implementation calls {@link #onChange}. * The default implementation calls {@link #onChanged}. * * @param call the call object that carries out the audio call */ Loading Loading @@ -257,18 +259,22 @@ public class SipAudioCall { * * @return true if the call is established */ public synchronized boolean isInCall() { public boolean isInCall() { synchronized (this) { return mInCall; } } /** * Checks if the call is on hold. * * @return true if the call is on hold */ public synchronized boolean isOnHold() { public boolean isOnHold() { synchronized (this) { return mHold; } } /** * Closes this object. This object is not usable after being closed. Loading Loading @@ -299,18 +305,22 @@ public class SipAudioCall { * * @return the local SIP profile */ public synchronized SipProfile getLocalProfile() { public SipProfile getLocalProfile() { synchronized (this) { return mLocalProfile; } } /** * Gets the peer's SIP profile. * * @return the peer's SIP profile */ public synchronized SipProfile getPeerProfile() { public SipProfile getPeerProfile() { synchronized (this) { return (mSipSession == null) ? null : mSipSession.getPeerProfile(); } } /** * Gets the state of the {@link SipSession} that carries this call. Loading @@ -318,10 +328,12 @@ public class SipAudioCall { * * @return the session state */ public synchronized int getState() { public int getState() { synchronized (this) { if (mSipSession == null) return SipSession.State.READY_TO_CALL; return mSipSession.getState(); } } /** Loading @@ -330,9 +342,11 @@ public class SipAudioCall { * @return the session object that carries this call * @hide */ public synchronized SipSession getSipSession() { public SipSession getSipSession() { synchronized (this) { return mSipSession; } } private SipSession.Listener createListener() { return new SipSession.Listener() { Loading Loading @@ -364,10 +378,12 @@ public class SipAudioCall { } @Override public synchronized void onRinging(SipSession session, public void onRinging(SipSession session, SipProfile peerProfile, String sessionDescription) { synchronized (SipAudioCall.this) { if ((mSipSession == null) || !mInCall || !session.getCallId().equals(mSipSession.getCallId())) { || !session.getCallId().equals( mSipSession.getCallId())) { // should not happen session.endCall(); return; Loading @@ -382,6 +398,7 @@ public class SipAudioCall { session.endCall(); } } } @Override public void onCallEstablished(SipSession session, Loading Loading @@ -508,20 +525,24 @@ public class SipAudioCall { * @throws SipException if the SIP service fails to attach this object to * the session */ public synchronized void attachCall(SipSession session, String sessionDescription) throws SipException { public void attachCall(SipSession session, String sessionDescription) throws SipException { synchronized (this) { mSipSession = session; mPeerSd = sessionDescription; Log.v(TAG, "attachCall()" + mPeerSd); try { session.setListener(createListener()); if (getState() == SipSession.State.INCOMING_CALL) startRinging(); if (getState() == SipSession.State.INCOMING_CALL) { startRinging(); } } catch (Throwable e) { Log.e(TAG, "attachCall()", e); throwSipException(e); } } } /** * Initiates an audio call to the specified profile. The attempt will be Loading @@ -529,7 +550,7 @@ public class SipAudioCall { * and {@code Listener.onError(SipAudioCall, SipErrorCode.TIME_OUT, String)} * will be called. * * @param callee the SIP profile to make the call to * @param peerProfile the SIP profile to make the call to * @param sipSession the {@link SipSession} for carrying out the call * @param timeout the timeout value in seconds. Default value (defined by * SIP protocol) is used if {@code timeout} is zero or negative. Loading @@ -537,23 +558,28 @@ public class SipAudioCall { * @throws SipException if the SIP service fails to create a session for the * call */ public synchronized void makeCall(SipProfile peerProfile, SipSession sipSession, int timeout) throws SipException { public void makeCall(SipProfile peerProfile, SipSession sipSession, int timeout) throws SipException { synchronized (this) { mSipSession = sipSession; try { mAudioStream = new AudioStream(InetAddress.getByName(getLocalIp())); mAudioStream = new AudioStream(InetAddress.getByName( getLocalIp())); sipSession.setListener(createListener()); sipSession.makeCall(peerProfile, createOffer().encode(), timeout); sipSession.makeCall(peerProfile, createOffer().encode(), timeout); } catch (IOException e) { throw new SipException("makeCall()", e); } } } /** * Ends a call. * @throws SipException if the SIP service fails to end the call */ public synchronized void endCall() throws SipException { public void endCall() throws SipException { synchronized (this) { stopRinging(); stopCall(RELEASE_SOCKET); mInCall = false; Loading @@ -561,6 +587,7 @@ public class SipAudioCall { // perform the above local ops first and then network op if (mSipSession != null) mSipSession.endCall(); } } /** * Puts a call on hold. When succeeds, {@link Listener#onCallHeld} is Loading @@ -574,7 +601,8 @@ public class SipAudioCall { * @see Listener.onError * @throws SipException if the SIP service fails to hold the call */ public synchronized void holdCall(int timeout) throws SipException { public void holdCall(int timeout) throws SipException { synchronized (this) { if (mHold) return; mSipSession.changeCall(createHoldOffer().encode(), timeout); mHold = true; Loading @@ -582,6 +610,7 @@ public class SipAudioCall { AudioGroup audioGroup = getAudioGroup(); if (audioGroup != null) audioGroup.setMode(AudioGroup.MODE_ON_HOLD); } } /** * Answers a call. The attempt will be timed out if the call is not Loading @@ -594,15 +623,18 @@ public class SipAudioCall { * @see Listener.onError * @throws SipException if the SIP service fails to answer the call */ public synchronized void answerCall(int timeout) throws SipException { public void answerCall(int timeout) throws SipException { synchronized (this) { stopRinging(); try { mAudioStream = new AudioStream(InetAddress.getByName(getLocalIp())); mAudioStream = new AudioStream(InetAddress.getByName( getLocalIp())); mSipSession.answerCall(createAnswer(mPeerSd).encode(), timeout); } catch (IOException e) { throw new SipException("answerCall()", e); } } } /** * Continues a call that's on hold. When succeeds, Loading @@ -616,13 +648,15 @@ public class SipAudioCall { * @see Listener.onError * @throws SipException if the SIP service fails to unhold the call */ public synchronized void continueCall(int timeout) throws SipException { public void continueCall(int timeout) throws SipException { synchronized (this) { if (!mHold) return; mSipSession.changeCall(createContinueOffer().encode(), timeout); mHold = false; AudioGroup audioGroup = getAudioGroup(); if (audioGroup != null) audioGroup.setMode(AudioGroup.MODE_NORMAL); } } private SimpleSessionDescription createOffer() { SimpleSessionDescription offer = Loading Loading @@ -739,29 +773,36 @@ public class SipAudioCall { } /** Toggles mute. */ public synchronized void toggleMute() { public void toggleMute() { synchronized (this) { AudioGroup audioGroup = getAudioGroup(); if (audioGroup != null) { audioGroup.setMode( mMuted ? AudioGroup.MODE_NORMAL : AudioGroup.MODE_MUTED); audioGroup.setMode(mMuted ? AudioGroup.MODE_NORMAL : AudioGroup.MODE_MUTED); mMuted = !mMuted; } } } /** * Checks if the call is muted. * * @return true if the call is muted */ public synchronized boolean isMuted() { public boolean isMuted() { synchronized (this) { return mMuted; } } /** Puts the device to speaker mode. */ public synchronized void setSpeakerMode(boolean speakerMode) { public void setSpeakerMode(boolean speakerMode) { synchronized (this) { ((AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE)) .setSpeakerphoneOn(speakerMode); } } /** * Sends a DTMF code. According to RFC2833, event 0--9 maps to decimal Loading @@ -785,7 +826,8 @@ public class SipAudioCall { * inputs. * @param result the result message to send when done */ public synchronized void sendDtmf(int code, Message result) { public void sendDtmf(int code, Message result) { synchronized (this) { AudioGroup audioGroup = getAudioGroup(); if ((audioGroup != null) && (mSipSession != null) && (SipSession.State.IN_CALL == getState())) { Loading @@ -794,6 +836,7 @@ public class SipAudioCall { } if (result != null) result.sendToTarget(); } } /** * Gets the {@link AudioStream} object used in this call. The object Loading @@ -806,9 +849,11 @@ public class SipAudioCall { * yet been set up * @hide */ public synchronized AudioStream getAudioStream() { public AudioStream getAudioStream() { synchronized (this) { return mAudioStream; } } /** * Gets the {@link AudioGroup} object which the {@link AudioStream} object Loading @@ -824,10 +869,12 @@ public class SipAudioCall { * @see #getAudioStream * @hide */ public synchronized AudioGroup getAudioGroup() { public AudioGroup getAudioGroup() { synchronized (this) { if (mAudioGroup != null) return mAudioGroup; return ((mAudioStream == null) ? null : mAudioStream.getGroup()); } } /** * Sets the {@link AudioGroup} object which the {@link AudioStream} object Loading @@ -837,12 +884,14 @@ public class SipAudioCall { * @see #getAudioStream * @hide */ public synchronized void setAudioGroup(AudioGroup group) { public void setAudioGroup(AudioGroup group) { synchronized (this) { if ((mAudioStream != null) && (mAudioStream.getGroup() != null)) { mAudioStream.join(group); } mAudioGroup = group; } } /** * Starts the audio for the established call. This method should be called Loading Loading @@ -981,18 +1030,22 @@ public class SipAudioCall { * * @param enabled true to enable; false to disable */ public synchronized void setRingbackToneEnabled(boolean enabled) { public void setRingbackToneEnabled(boolean enabled) { synchronized (this) { mRingbackToneEnabled = enabled; } } /** * Enables/disables the ring tone. * * @param enabled true to enable; false to disable */ public synchronized void setRingtoneEnabled(boolean enabled) { public void setRingtoneEnabled(boolean enabled) { synchronized (this) { mRingtoneEnabled = enabled; } } private void startRingbackTone() { if (!mRingbackToneEnabled) return; Loading voip/java/android/net/sip/SipErrorCode.java +3 −4 Original line number Diff line number Diff line Loading @@ -19,10 +19,9 @@ package android.net.sip; /** * Defines error code returned in * {@link SipRegistrationListener#onRegistrationFailed}, * {@link ISipSessionListener#onError}, * {@link ISipSessionListener#onCallChangeFailed} and * {@link ISipSessionListener#onRegistrationFailed}. * @hide * {@link SipSession.Listener#onError}, * {@link SipSession.Listener#onCallChangeFailed} and * {@link SipSession.Listener#onRegistrationFailed}. */ public class SipErrorCode { /** Not an error. */ Loading Loading
core/res/AndroidManifest.xml +7 −0 Original line number Diff line number Diff line Loading @@ -364,6 +364,13 @@ android:description="@string/permdesc_nfcLlcp" android:label="@string/permlab_nfcLlcp" /> <!-- Allows an application to use SIP service --> <permission android:name="android.permission.USE_SIP" android:permissionGroup="android.permission-group.NETWORK" android:protectionLevel="dangerous" android:description="@string/permdesc_use_sip" android:label="@string/permlab_use_sip" /> <!-- Allows applications to call into AccountAuthenticators. Only the system can get this permission. --> <permission android:name="android.permission.ACCOUNT_MANAGER" Loading
core/res/res/values/strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -1240,6 +1240,11 @@ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permdesc_cache_filesystem">Allows an application to read and write the cache filesystem.</string> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permlab_use_sip">make/receive Internet calls</string> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permdesc_use_sip">Allows an application to use the SIP service to make/receive Internet calls.</string> <!-- Policy administration --> <!-- Title of policy access to limiting the user's password choices --> Loading
voip/java/android/net/sip/SipAudioCall.java +166 −113 Original line number Diff line number Diff line Loading @@ -43,9 +43,11 @@ import java.util.List; import java.util.Map; /** * Class that handles an audio call over SIP. * Class that handles an Internet audio call over SIP. {@link SipManager} * facilitates instantiating a {@code SipAudioCall} object for making/receiving * calls. See {@link SipManager#makeAudioCall} and * {@link SipManager#takeAudioCall}. */ /** @hide */ public class SipAudioCall { private static final String TAG = SipAudioCall.class.getSimpleName(); private static final boolean RELEASE_SOCKET = true; Loading @@ -56,7 +58,7 @@ public class SipAudioCall { public static class Listener { /** * Called when the call object is ready to make another call. * The default implementation calls {@link #onChange}. * The default implementation calls {@link #onChanged}. * * @param call the call object that is ready to make another call */ Loading @@ -66,7 +68,7 @@ public class SipAudioCall { /** * Called when a request is sent out to initiate a new call. * The default implementation calls {@link #onChange}. * The default implementation calls {@link #onChanged}. * * @param call the call object that carries out the audio call */ Loading @@ -76,7 +78,7 @@ public class SipAudioCall { /** * Called when a new call comes in. * The default implementation calls {@link #onChange}. * The default implementation calls {@link #onChanged}. * * @param call the call object that carries out the audio call * @param caller the SIP profile of the caller Loading @@ -87,7 +89,7 @@ public class SipAudioCall { /** * Called when a RINGING response is received for the INVITE request * sent. The default implementation calls {@link #onChange}. * sent. The default implementation calls {@link #onChanged}. * * @param call the call object that carries out the audio call */ Loading @@ -97,7 +99,7 @@ public class SipAudioCall { /** * Called when the session is established. * The default implementation calls {@link #onChange}. * The default implementation calls {@link #onChanged}. * * @param call the call object that carries out the audio call */ Loading @@ -107,7 +109,7 @@ public class SipAudioCall { /** * Called when the session is terminated. * The default implementation calls {@link #onChange}. * The default implementation calls {@link #onChanged}. * * @param call the call object that carries out the audio call */ Loading @@ -117,7 +119,7 @@ public class SipAudioCall { /** * Called when the peer is busy during session initialization. * The default implementation calls {@link #onChange}. * The default implementation calls {@link #onChanged}. * * @param call the call object that carries out the audio call */ Loading @@ -127,7 +129,7 @@ public class SipAudioCall { /** * Called when the call is on hold. * The default implementation calls {@link #onChange}. * The default implementation calls {@link #onChanged}. * * @param call the call object that carries out the audio call */ Loading Loading @@ -257,18 +259,22 @@ public class SipAudioCall { * * @return true if the call is established */ public synchronized boolean isInCall() { public boolean isInCall() { synchronized (this) { return mInCall; } } /** * Checks if the call is on hold. * * @return true if the call is on hold */ public synchronized boolean isOnHold() { public boolean isOnHold() { synchronized (this) { return mHold; } } /** * Closes this object. This object is not usable after being closed. Loading Loading @@ -299,18 +305,22 @@ public class SipAudioCall { * * @return the local SIP profile */ public synchronized SipProfile getLocalProfile() { public SipProfile getLocalProfile() { synchronized (this) { return mLocalProfile; } } /** * Gets the peer's SIP profile. * * @return the peer's SIP profile */ public synchronized SipProfile getPeerProfile() { public SipProfile getPeerProfile() { synchronized (this) { return (mSipSession == null) ? null : mSipSession.getPeerProfile(); } } /** * Gets the state of the {@link SipSession} that carries this call. Loading @@ -318,10 +328,12 @@ public class SipAudioCall { * * @return the session state */ public synchronized int getState() { public int getState() { synchronized (this) { if (mSipSession == null) return SipSession.State.READY_TO_CALL; return mSipSession.getState(); } } /** Loading @@ -330,9 +342,11 @@ public class SipAudioCall { * @return the session object that carries this call * @hide */ public synchronized SipSession getSipSession() { public SipSession getSipSession() { synchronized (this) { return mSipSession; } } private SipSession.Listener createListener() { return new SipSession.Listener() { Loading Loading @@ -364,10 +378,12 @@ public class SipAudioCall { } @Override public synchronized void onRinging(SipSession session, public void onRinging(SipSession session, SipProfile peerProfile, String sessionDescription) { synchronized (SipAudioCall.this) { if ((mSipSession == null) || !mInCall || !session.getCallId().equals(mSipSession.getCallId())) { || !session.getCallId().equals( mSipSession.getCallId())) { // should not happen session.endCall(); return; Loading @@ -382,6 +398,7 @@ public class SipAudioCall { session.endCall(); } } } @Override public void onCallEstablished(SipSession session, Loading Loading @@ -508,20 +525,24 @@ public class SipAudioCall { * @throws SipException if the SIP service fails to attach this object to * the session */ public synchronized void attachCall(SipSession session, String sessionDescription) throws SipException { public void attachCall(SipSession session, String sessionDescription) throws SipException { synchronized (this) { mSipSession = session; mPeerSd = sessionDescription; Log.v(TAG, "attachCall()" + mPeerSd); try { session.setListener(createListener()); if (getState() == SipSession.State.INCOMING_CALL) startRinging(); if (getState() == SipSession.State.INCOMING_CALL) { startRinging(); } } catch (Throwable e) { Log.e(TAG, "attachCall()", e); throwSipException(e); } } } /** * Initiates an audio call to the specified profile. The attempt will be Loading @@ -529,7 +550,7 @@ public class SipAudioCall { * and {@code Listener.onError(SipAudioCall, SipErrorCode.TIME_OUT, String)} * will be called. * * @param callee the SIP profile to make the call to * @param peerProfile the SIP profile to make the call to * @param sipSession the {@link SipSession} for carrying out the call * @param timeout the timeout value in seconds. Default value (defined by * SIP protocol) is used if {@code timeout} is zero or negative. Loading @@ -537,23 +558,28 @@ public class SipAudioCall { * @throws SipException if the SIP service fails to create a session for the * call */ public synchronized void makeCall(SipProfile peerProfile, SipSession sipSession, int timeout) throws SipException { public void makeCall(SipProfile peerProfile, SipSession sipSession, int timeout) throws SipException { synchronized (this) { mSipSession = sipSession; try { mAudioStream = new AudioStream(InetAddress.getByName(getLocalIp())); mAudioStream = new AudioStream(InetAddress.getByName( getLocalIp())); sipSession.setListener(createListener()); sipSession.makeCall(peerProfile, createOffer().encode(), timeout); sipSession.makeCall(peerProfile, createOffer().encode(), timeout); } catch (IOException e) { throw new SipException("makeCall()", e); } } } /** * Ends a call. * @throws SipException if the SIP service fails to end the call */ public synchronized void endCall() throws SipException { public void endCall() throws SipException { synchronized (this) { stopRinging(); stopCall(RELEASE_SOCKET); mInCall = false; Loading @@ -561,6 +587,7 @@ public class SipAudioCall { // perform the above local ops first and then network op if (mSipSession != null) mSipSession.endCall(); } } /** * Puts a call on hold. When succeeds, {@link Listener#onCallHeld} is Loading @@ -574,7 +601,8 @@ public class SipAudioCall { * @see Listener.onError * @throws SipException if the SIP service fails to hold the call */ public synchronized void holdCall(int timeout) throws SipException { public void holdCall(int timeout) throws SipException { synchronized (this) { if (mHold) return; mSipSession.changeCall(createHoldOffer().encode(), timeout); mHold = true; Loading @@ -582,6 +610,7 @@ public class SipAudioCall { AudioGroup audioGroup = getAudioGroup(); if (audioGroup != null) audioGroup.setMode(AudioGroup.MODE_ON_HOLD); } } /** * Answers a call. The attempt will be timed out if the call is not Loading @@ -594,15 +623,18 @@ public class SipAudioCall { * @see Listener.onError * @throws SipException if the SIP service fails to answer the call */ public synchronized void answerCall(int timeout) throws SipException { public void answerCall(int timeout) throws SipException { synchronized (this) { stopRinging(); try { mAudioStream = new AudioStream(InetAddress.getByName(getLocalIp())); mAudioStream = new AudioStream(InetAddress.getByName( getLocalIp())); mSipSession.answerCall(createAnswer(mPeerSd).encode(), timeout); } catch (IOException e) { throw new SipException("answerCall()", e); } } } /** * Continues a call that's on hold. When succeeds, Loading @@ -616,13 +648,15 @@ public class SipAudioCall { * @see Listener.onError * @throws SipException if the SIP service fails to unhold the call */ public synchronized void continueCall(int timeout) throws SipException { public void continueCall(int timeout) throws SipException { synchronized (this) { if (!mHold) return; mSipSession.changeCall(createContinueOffer().encode(), timeout); mHold = false; AudioGroup audioGroup = getAudioGroup(); if (audioGroup != null) audioGroup.setMode(AudioGroup.MODE_NORMAL); } } private SimpleSessionDescription createOffer() { SimpleSessionDescription offer = Loading Loading @@ -739,29 +773,36 @@ public class SipAudioCall { } /** Toggles mute. */ public synchronized void toggleMute() { public void toggleMute() { synchronized (this) { AudioGroup audioGroup = getAudioGroup(); if (audioGroup != null) { audioGroup.setMode( mMuted ? AudioGroup.MODE_NORMAL : AudioGroup.MODE_MUTED); audioGroup.setMode(mMuted ? AudioGroup.MODE_NORMAL : AudioGroup.MODE_MUTED); mMuted = !mMuted; } } } /** * Checks if the call is muted. * * @return true if the call is muted */ public synchronized boolean isMuted() { public boolean isMuted() { synchronized (this) { return mMuted; } } /** Puts the device to speaker mode. */ public synchronized void setSpeakerMode(boolean speakerMode) { public void setSpeakerMode(boolean speakerMode) { synchronized (this) { ((AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE)) .setSpeakerphoneOn(speakerMode); } } /** * Sends a DTMF code. According to RFC2833, event 0--9 maps to decimal Loading @@ -785,7 +826,8 @@ public class SipAudioCall { * inputs. * @param result the result message to send when done */ public synchronized void sendDtmf(int code, Message result) { public void sendDtmf(int code, Message result) { synchronized (this) { AudioGroup audioGroup = getAudioGroup(); if ((audioGroup != null) && (mSipSession != null) && (SipSession.State.IN_CALL == getState())) { Loading @@ -794,6 +836,7 @@ public class SipAudioCall { } if (result != null) result.sendToTarget(); } } /** * Gets the {@link AudioStream} object used in this call. The object Loading @@ -806,9 +849,11 @@ public class SipAudioCall { * yet been set up * @hide */ public synchronized AudioStream getAudioStream() { public AudioStream getAudioStream() { synchronized (this) { return mAudioStream; } } /** * Gets the {@link AudioGroup} object which the {@link AudioStream} object Loading @@ -824,10 +869,12 @@ public class SipAudioCall { * @see #getAudioStream * @hide */ public synchronized AudioGroup getAudioGroup() { public AudioGroup getAudioGroup() { synchronized (this) { if (mAudioGroup != null) return mAudioGroup; return ((mAudioStream == null) ? null : mAudioStream.getGroup()); } } /** * Sets the {@link AudioGroup} object which the {@link AudioStream} object Loading @@ -837,12 +884,14 @@ public class SipAudioCall { * @see #getAudioStream * @hide */ public synchronized void setAudioGroup(AudioGroup group) { public void setAudioGroup(AudioGroup group) { synchronized (this) { if ((mAudioStream != null) && (mAudioStream.getGroup() != null)) { mAudioStream.join(group); } mAudioGroup = group; } } /** * Starts the audio for the established call. This method should be called Loading Loading @@ -981,18 +1030,22 @@ public class SipAudioCall { * * @param enabled true to enable; false to disable */ public synchronized void setRingbackToneEnabled(boolean enabled) { public void setRingbackToneEnabled(boolean enabled) { synchronized (this) { mRingbackToneEnabled = enabled; } } /** * Enables/disables the ring tone. * * @param enabled true to enable; false to disable */ public synchronized void setRingtoneEnabled(boolean enabled) { public void setRingtoneEnabled(boolean enabled) { synchronized (this) { mRingtoneEnabled = enabled; } } private void startRingbackTone() { if (!mRingbackToneEnabled) return; Loading
voip/java/android/net/sip/SipErrorCode.java +3 −4 Original line number Diff line number Diff line Loading @@ -19,10 +19,9 @@ package android.net.sip; /** * Defines error code returned in * {@link SipRegistrationListener#onRegistrationFailed}, * {@link ISipSessionListener#onError}, * {@link ISipSessionListener#onCallChangeFailed} and * {@link ISipSessionListener#onRegistrationFailed}. * @hide * {@link SipSession.Listener#onError}, * {@link SipSession.Listener#onCallChangeFailed} and * {@link SipSession.Listener#onRegistrationFailed}. */ public class SipErrorCode { /** Not an error. */ Loading