summaryrefslogtreecommitdiffstats
path: root/voip/java
diff options
context:
space:
mode:
authorHung-ying Tyan <tyanh@google.com>2010-10-21 10:55:33 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-10-21 10:55:33 -0700
commit164cd438fb21e82d0aacc06da940041f0b7f6a2c (patch)
tree2d96f18584c7c773ce949e8d47192a45b24b767f /voip/java
parent4ef36afa3273bc15a59c3262e41e61d7ccba6c3e (diff)
parent5102856947595cffc1cceb11b9e4c5baf70b2e82 (diff)
downloadframeworks_base-164cd438fb21e82d0aacc06da940041f0b7f6a2c.zip
frameworks_base-164cd438fb21e82d0aacc06da940041f0b7f6a2c.tar.gz
frameworks_base-164cd438fb21e82d0aacc06da940041f0b7f6a2c.tar.bz2
am 51028569: am 1180f2a0: Merge "Remove ringtone API from SipAudioCall." into gingerbread
Merge commit '5102856947595cffc1cceb11b9e4c5baf70b2e82' * commit '5102856947595cffc1cceb11b9e4c5baf70b2e82': Remove ringtone API from SipAudioCall.
Diffstat (limited to 'voip/java')
-rw-r--r--voip/java/android/net/sip/SipAudioCall.java85
-rw-r--r--voip/java/android/net/sip/SipManager.java15
2 files changed, 1 insertions, 99 deletions
diff --git a/voip/java/android/net/sip/SipAudioCall.java b/voip/java/android/net/sip/SipAudioCall.java
index d859c4c..fbd3db8 100644
--- a/voip/java/android/net/sip/SipAudioCall.java
+++ b/voip/java/android/net/sip/SipAudioCall.java
@@ -18,10 +18,6 @@ package android.net.sip;
import android.content.Context;
import android.media.AudioManager;
-import android.media.Ringtone;
-import android.media.RingtoneManager;
-import android.media.ToneGenerator;
-import android.net.Uri;
import android.net.rtp.AudioCodec;
import android.net.rtp.AudioGroup;
import android.net.rtp.AudioStream;
@@ -30,8 +26,6 @@ import android.net.sip.SimpleSessionDescription.Media;
import android.net.wifi.WifiManager;
import android.os.Message;
import android.os.RemoteException;
-import android.os.Vibrator;
-import android.provider.Settings;
import android.util.Log;
import java.io.IOException;
@@ -175,11 +169,6 @@ public class SipAudioCall {
private boolean mMuted = false;
private boolean mHold = false;
- private boolean mRingbackToneEnabled = true;
- private boolean mRingtoneEnabled = true;
- private Ringtone mRingtone;
- private ToneGenerator mRingbackTone;
-
private SipProfile mPendingCallRequest;
private WifiManager mWm;
private WifiManager.WifiLock mWifiHighPerfLock;
@@ -285,8 +274,6 @@ public class SipAudioCall {
private synchronized void close(boolean closeRtp) {
if (closeRtp) stopCall(RELEASE_SOCKET);
- stopRingbackTone();
- stopRinging();
mInCall = false;
mHold = false;
@@ -366,7 +353,6 @@ public class SipAudioCall {
@Override
public void onRingingBack(SipSession session) {
Log.d(TAG, "sip call ringing back: " + session);
- if (!mInCall) startRingbackTone();
Listener listener = mListener;
if (listener != null) {
try {
@@ -403,8 +389,6 @@ public class SipAudioCall {
@Override
public void onCallEstablished(SipSession session,
String sessionDescription) {
- stopRingbackTone();
- stopRinging();
mPeerSd = sessionDescription;
Log.v(TAG, "onCallEstablished()" + mPeerSd);
@@ -533,10 +517,6 @@ public class SipAudioCall {
Log.v(TAG, "attachCall()" + mPeerSd);
try {
session.setListener(createListener());
-
- if (getState() == SipSession.State.INCOMING_CALL) {
- startRinging();
- }
} catch (Throwable e) {
Log.e(TAG, "attachCall()", e);
throwSipException(e);
@@ -580,7 +560,6 @@ public class SipAudioCall {
*/
public void endCall() throws SipException {
synchronized (this) {
- stopRinging();
stopCall(RELEASE_SOCKET);
mInCall = false;
@@ -625,7 +604,6 @@ public class SipAudioCall {
*/
public void answerCall(int timeout) throws SipException {
synchronized (this) {
- stopRinging();
try {
mAudioStream = new AudioStream(InetAddress.getByName(
getLocalIp()));
@@ -1026,69 +1004,6 @@ public class SipAudioCall {
return mSipSession.getLocalIp();
}
-
- /**
- * Enables/disables the ring-back tone.
- *
- * @param enabled true to enable; false to disable
- */
- public void setRingbackToneEnabled(boolean enabled) {
- synchronized (this) {
- mRingbackToneEnabled = enabled;
- }
- }
-
- /**
- * Enables/disables the ring tone.
- *
- * @param enabled true to enable; false to disable
- */
- public void setRingtoneEnabled(boolean enabled) {
- synchronized (this) {
- mRingtoneEnabled = enabled;
- }
- }
-
- private void startRingbackTone() {
- if (!mRingbackToneEnabled) return;
- if (mRingbackTone == null) {
- // The volume relative to other sounds in the stream
- int toneVolume = 80;
- mRingbackTone = new ToneGenerator(
- AudioManager.STREAM_VOICE_CALL, toneVolume);
- }
- mRingbackTone.startTone(ToneGenerator.TONE_CDMA_LOW_PBX_L);
- }
-
- private void stopRingbackTone() {
- if (mRingbackTone != null) {
- mRingbackTone.stopTone();
- mRingbackTone.release();
- mRingbackTone = null;
- }
- }
-
- private void startRinging() {
- if (!mRingtoneEnabled) return;
- ((Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE))
- .vibrate(new long[] {0, 1000, 1000}, 1);
- AudioManager am = (AudioManager)
- mContext.getSystemService(Context.AUDIO_SERVICE);
- if (am.getStreamVolume(AudioManager.STREAM_RING) > 0) {
- String ringtoneUri =
- Settings.System.DEFAULT_RINGTONE_URI.toString();
- mRingtone = RingtoneManager.getRingtone(mContext,
- Uri.parse(ringtoneUri));
- mRingtone.play();
- }
- }
-
- private void stopRinging() {
- ((Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE))
- .cancel();
- if (mRingtone != null) mRingtone.stop();
- }
-
private void throwSipException(Throwable throwable) throws SipException {
if (throwable instanceof SipException) {
throw (SipException) throwable;
diff --git a/voip/java/android/net/sip/SipManager.java b/voip/java/android/net/sip/SipManager.java
index 2f03e34..e1b1d10 100644
--- a/voip/java/android/net/sip/SipManager.java
+++ b/voip/java/android/net/sip/SipManager.java
@@ -351,17 +351,6 @@ public class SipManager {
}
/**
- * The method calls {@code takeAudioCall(incomingCallIntent,
- * listener, true}.
- *
- * @see #takeAudioCall(Intent, SipAudioCall.Listener, boolean)
- */
- public SipAudioCall takeAudioCall(Intent incomingCallIntent,
- SipAudioCall.Listener listener) throws SipException {
- return takeAudioCall(incomingCallIntent, listener, true);
- }
-
- /**
* Creates a {@link SipAudioCall} to take an incoming call. Before the call
* is returned, the listener will receive a
* {@link SipAudioCall.Listener#onRinging}
@@ -374,8 +363,7 @@ public class SipManager {
* @throws SipException if calling the SIP service results in an error
*/
public SipAudioCall takeAudioCall(Intent incomingCallIntent,
- SipAudioCall.Listener listener, boolean ringtoneEnabled)
- throws SipException {
+ SipAudioCall.Listener listener) throws SipException {
if (incomingCallIntent == null) return null;
String callId = getCallId(incomingCallIntent);
@@ -394,7 +382,6 @@ public class SipManager {
if (session == null) return null;
SipAudioCall call = new SipAudioCall(
mContext, session.getLocalProfile());
- call.setRingtoneEnabled(ringtoneEnabled);
call.attachCall(new SipSession(session), offerSd);
call.setListener(listener);
return call;