summaryrefslogtreecommitdiffstats
path: root/telephony/java
diff options
context:
space:
mode:
authorJohn Wang <johnwang@google.com>2009-09-18 17:36:43 -0700
committerJohn Wang <johnwang@google.com>2009-09-20 13:40:38 -0700
commitbbd754b8fe7563234b5c4c8d1425a7417337f2f2 (patch)
tree96bf6f30467aa6e2b83c6398ed784526442af9a3 /telephony/java
parent0647b580aa7874311fc77b659e4f646750ddd74e (diff)
downloadframeworks_base-bbd754b8fe7563234b5c4c8d1425a7417337f2f2.zip
frameworks_base-bbd754b8fe7563234b5c4c8d1425a7417337f2f2.tar.gz
frameworks_base-bbd754b8fe7563234b5c4c8d1425a7417337f2f2.tar.bz2
Add ring back tone notification.
Some networks may not play ring back tone, RIL will send UNSOL ringback notification. Apps can register for ring back tone msg and play tone to user for receiving ALERTING message. The return value indicates to play or stop ring tone.
Diffstat (limited to 'telephony/java')
-rw-r--r--telephony/java/com/android/internal/telephony/BaseCommands.java10
-rw-r--r--telephony/java/com/android/internal/telephony/CommandsInterface.java11
-rw-r--r--telephony/java/com/android/internal/telephony/Phone.java17
-rw-r--r--telephony/java/com/android/internal/telephony/PhoneBase.java10
-rw-r--r--telephony/java/com/android/internal/telephony/PhoneProxy.java8
-rw-r--r--telephony/java/com/android/internal/telephony/RIL.java10
-rw-r--r--telephony/java/com/android/internal/telephony/RILConstants.java1
7 files changed, 67 insertions, 0 deletions
diff --git a/telephony/java/com/android/internal/telephony/BaseCommands.java b/telephony/java/com/android/internal/telephony/BaseCommands.java
index 3edca66..52f25f6 100644
--- a/telephony/java/com/android/internal/telephony/BaseCommands.java
+++ b/telephony/java/com/android/internal/telephony/BaseCommands.java
@@ -64,6 +64,7 @@ public abstract class BaseCommands implements CommandsInterface {
protected RegistrantList mLineControlInfoRegistrants = new RegistrantList();
protected RegistrantList mT53ClirInfoRegistrants = new RegistrantList();
protected RegistrantList mT53AudCntrlInfoRegistrants = new RegistrantList();
+ protected RegistrantList mRingbackToneRegistrants = new RegistrantList();
protected Registrant mSMSRegistrant;
protected Registrant mNITZTimeRegistrant;
@@ -569,6 +570,15 @@ public abstract class BaseCommands implements CommandsInterface {
mT53AudCntrlInfoRegistrants.remove(h);
}
+ public void registerForRingbackTone(Handler h, int what, Object obj) {
+ Registrant r = new Registrant (h, what, obj);
+ mRingbackToneRegistrants.add(r);
+ }
+
+ public void unregisterForRingbackTone(Handler h) {
+ mRingbackToneRegistrants.remove(h);
+ }
+
//***** Protected Methods
/**
* Store new RadioState and send notification based on the changes
diff --git a/telephony/java/com/android/internal/telephony/CommandsInterface.java b/telephony/java/com/android/internal/telephony/CommandsInterface.java
index 63bdc2c..9d83556 100644
--- a/telephony/java/com/android/internal/telephony/CommandsInterface.java
+++ b/telephony/java/com/android/internal/telephony/CommandsInterface.java
@@ -525,6 +525,17 @@ public interface CommandsInterface {
void registerForCdmaOtaProvision(Handler h,int what, Object obj);
void unregisterForCdmaOtaProvision(Handler h);
+ /**
+ * Registers the handler when out-band ringback tone is needed.<p>
+ *
+ * Messages received from this:
+ * Message.obj will be an AsyncResult
+ * AsyncResult.userObj = obj
+ * AsyncResult.result = boolean. <p>
+ */
+ void registerForRingbackTone(Handler h, int what, Object obj);
+ void unregisterForRingbackTone(Handler h);
+
/**
* Supply the ICC PIN to the ICC card
*
diff --git a/telephony/java/com/android/internal/telephony/Phone.java b/telephony/java/com/android/internal/telephony/Phone.java
index f32837f..fffd128 100644
--- a/telephony/java/com/android/internal/telephony/Phone.java
+++ b/telephony/java/com/android/internal/telephony/Phone.java
@@ -379,6 +379,23 @@ public interface Phone {
void unregisterForIncomingRing(Handler h);
+ /**
+ * Notifies when out-band ringback tone is needed.<p>
+ *
+ * Messages received from this:
+ * Message.obj will be an AsyncResult
+ * AsyncResult.userObj = obj
+ * AsyncResult.result = boolean, true to start play ringback tone
+ * and false to stop. <p>
+ */
+ void registerForRingbackTone(Handler h, int what, Object obj);
+
+ /**
+ * Unregisters for ringback tone notification.
+ */
+
+ void unregisterForRingbackTone(Handler h);
+
/**
* Notifies when a voice connection has disconnected, either due to local
diff --git a/telephony/java/com/android/internal/telephony/PhoneBase.java b/telephony/java/com/android/internal/telephony/PhoneBase.java
index e340f85..1c62a82 100644
--- a/telephony/java/com/android/internal/telephony/PhoneBase.java
+++ b/telephony/java/com/android/internal/telephony/PhoneBase.java
@@ -482,6 +482,16 @@ public abstract class PhoneBase extends Handler implements Phone {
mServiceStateRegistrants.remove(h);
}
+ // Inherited documentation suffices.
+ public void registerForRingbackTone(Handler h, int what, Object obj) {
+ mCM.registerForRingbackTone(h,what,obj);
+ }
+
+ // Inherited documentation suffices.
+ public void unregisterForRingbackTone(Handler h) {
+ mCM.unregisterForRingbackTone(h);
+ }
+
/**
* Subclasses of Phone probably want to replace this with a
* version scoped to their packages
diff --git a/telephony/java/com/android/internal/telephony/PhoneProxy.java b/telephony/java/com/android/internal/telephony/PhoneProxy.java
index 711a48c..c4f663a 100644
--- a/telephony/java/com/android/internal/telephony/PhoneProxy.java
+++ b/telephony/java/com/android/internal/telephony/PhoneProxy.java
@@ -331,6 +331,14 @@ public class PhoneProxy extends Handler implements Phone {
mActivePhone.unregisterForEcmTimerReset(h);
}
+ public void registerForRingbackTone(Handler h, int what, Object obj) {
+ mActivePhone.registerForRingbackTone(h,what,obj);
+ }
+
+ public void unregisterForRingbackTone(Handler h) {
+ mActivePhone.unregisterForRingbackTone(h);
+ }
+
public boolean getIccRecordsLoaded() {
return mActivePhone.getIccRecordsLoaded();
}
diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java
index cd6340e..d1b446b 100644
--- a/telephony/java/com/android/internal/telephony/RIL.java
+++ b/telephony/java/com/android/internal/telephony/RIL.java
@@ -2313,6 +2313,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
case RIL_UNSOL_CDMA_OTA_PROVISION_STATUS: ret = responseInts(p); break;
case RIL_UNSOL_CDMA_INFO_REC: ret = responseCdmaInformationRecord(p); break;
case RIL_UNSOL_OEM_HOOK_RAW: ret = responseRaw(p); break;
+ case RIL_UNSOL_RINGBACK_TONE: ret = responseInts(p); break;
default:
throw new RuntimeException("Unrecognized unsol response: " + response);
@@ -2597,6 +2598,14 @@ public final class RIL extends BaseCommands implements CommandsInterface {
mUnsolOemHookRawRegistrant.notifyRegistrant(new AsyncResult(null, ret, null));
}
break;
+
+ case RIL_UNSOL_RINGBACK_TONE:
+ if (RILJ_LOGD) unsljLogvRet(response, ret);
+ if (mRingbackToneRegistrants != null) {
+ boolean playtone = (((int[])ret)[0] == 1);
+ mRingbackToneRegistrants.notifyRegistrants(
+ new AsyncResult (null, playtone, null));
+ }
}
}
@@ -3209,6 +3218,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
case RIL_UNSOL_CDMA_OTA_PROVISION_STATUS: return "UNSOL_CDMA_OTA_PROVISION_STATUS";
case RIL_UNSOL_CDMA_INFO_REC: return "UNSOL_CDMA_INFO_REC";
case RIL_UNSOL_OEM_HOOK_RAW: return "UNSOL_OEM_HOOK_RAW";
+ case RIL_UNSOL_RINGBACK_TONE: return "UNSOL_RINGBACK_TONG";
default: return "<unknown reponse>";
}
}
diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java
index 90a82f9..3e9d8ad 100644
--- a/telephony/java/com/android/internal/telephony/RILConstants.java
+++ b/telephony/java/com/android/internal/telephony/RILConstants.java
@@ -258,4 +258,5 @@ cat include/telephony/ril.h | \
int RIL_UNSOL_CDMA_OTA_PROVISION_STATUS = 1026;
int RIL_UNSOL_CDMA_INFO_REC = 1027;
int RIL_UNSOL_OEM_HOOK_RAW = 1028;
+ int RIL_UNSOL_RINGBACK_TONE = 1029;
}