aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2014-11-13 14:30:37 +0100
committerMichael Bestas <mikeioannina@gmail.com>2017-01-07 01:41:40 +0200
commitbacd53495307688a61e8e9b986a8c71d735ee9a4 (patch)
tree5bc51d26a69fcfc2c8527fd6e5d85ca72cb3303c
parent611fdb80c0a26b0693c4a9e76288a3a107ad4420 (diff)
downloadandroid_frameworks_opt_telephony-bacd53495307688a61e8e9b986a8c71d735ee9a4.tar.gz
android_frameworks_opt_telephony-bacd53495307688a61e8e9b986a8c71d735ee9a4.tar.bz2
android_frameworks_opt_telephony-bacd53495307688a61e8e9b986a8c71d735ee9a4.zip
Proper supplementary service notification handling (2/5).
Allow registering SSN listeners, and add missing constants. Change-Id: I339a395fda5cca7617e7619cfc93312a1282f60e
-rw-r--r--src/java/com/android/internal/telephony/CallManager.java40
-rw-r--r--src/java/com/android/internal/telephony/gsm/SuppServiceNotification.java5
2 files changed, 44 insertions, 1 deletions
diff --git a/src/java/com/android/internal/telephony/CallManager.java b/src/java/com/android/internal/telephony/CallManager.java
index 77edde9c3..9714ab07b 100644
--- a/src/java/com/android/internal/telephony/CallManager.java
+++ b/src/java/com/android/internal/telephony/CallManager.java
@@ -85,6 +85,7 @@ public class CallManager {
// FIXME Taken from klp-sprout-dev but setAudioMode was removed in L.
//private static final int EVENT_RADIO_OFF_OR_NOT_AVAILABLE = 121;
private static final int EVENT_TTY_MODE_RECEIVED = 122;
+ private static final int EVENT_SUPP_SERVICE_NOTIFY = 123;
// Singleton instance
private static final CallManager INSTANCE = new CallManager();
@@ -174,6 +175,9 @@ public class CallManager {
protected final RegistrantList mSubscriptionInfoReadyRegistrants
= new RegistrantList();
+ protected final RegistrantList mSuppServiceNotifyRegistrants
+ = new RegistrantList();
+
protected final RegistrantList mSuppServiceFailedRegistrants
= new RegistrantList();
@@ -607,6 +611,11 @@ public class CallManager {
// FIXME Taken from klp-sprout-dev but setAudioMode was removed in L.
//phone.registerForRadioOffOrNotAvailable(handler, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
+ // for events supported only by GSM phone
+ if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM) {
+ phone.registerForSuppServiceNotification(handler, EVENT_SUPP_SERVICE_NOTIFY, null);
+ }
+
// for events supported only by GSM, CDMA and IMS phone
phone.setOnPostDialCharacter(handler, EVENT_POST_DIAL_CHARACTER, null);
@@ -651,6 +660,11 @@ public class CallManager {
// FIXME Taken from klp-sprout-dev but setAudioMode was removed in L.
//phone.unregisterForRadioOffOrNotAvailable(handler);
+ // for events supported only by GSM phone
+ if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM) {
+ phone.unregisterForSuppServiceNotification(handler);
+ }
+
// for events supported only by GSM, CDMA and IMS phone
phone.setOnPostDialCharacter(null, EVENT_POST_DIAL_CHARACTER, null);
@@ -1540,6 +1554,28 @@ public class CallManager {
}
/**
+ * Register for supplementary service notifications.
+ * Message.obj will contain an AsyncResult.
+ *
+ * @param h Handler that receives the notification message.
+ * @param what User-defined message code.
+ * @param obj User object.
+ */
+ public void registerForSuppServiceNotification(Handler h, int what, Object obj) {
+ mSuppServiceNotifyRegistrants.addUnique(h, what, obj);
+ }
+
+ /**
+ * Unregister for supplementary service notifications.
+ * Extraneous calls are tolerated silently
+ *
+ * @param h Handler to be removed from the registrant list.
+ */
+ public void unregisterForSuppServiceNotification(Handler h) {
+ mSuppServiceNotifyRegistrants.remove(h);
+ }
+
+ /**
* Register for notifications when a supplementary service attempt fails.
* Message.obj will contain an AsyncResult.
*
@@ -2329,6 +2365,10 @@ public class CallManager {
if (VDBG) Rlog.d(LOG_TAG, " handleMessage (EVENT_SUBSCRIPTION_INFO_READY)");
mSubscriptionInfoReadyRegistrants.notifyRegistrants((AsyncResult) msg.obj);
break;
+ case EVENT_SUPP_SERVICE_NOTIFY:
+ if (VDBG) Rlog.d(LOG_TAG, " handleMessage (EVENT_SUPP_SERVICE_NOTIFY)");
+ mSuppServiceNotifyRegistrants.notifyRegistrants((AsyncResult) msg.obj);
+ break;
case EVENT_SUPP_SERVICE_FAILED:
if (VDBG) Rlog.d(LOG_TAG, " handleMessage (EVENT_SUPP_SERVICE_FAILED)");
mSuppServiceFailedRegistrants.notifyRegistrants((AsyncResult) msg.obj);
diff --git a/src/java/com/android/internal/telephony/gsm/SuppServiceNotification.java b/src/java/com/android/internal/telephony/gsm/SuppServiceNotification.java
index 8b64ade9b..7eba636e0 100644
--- a/src/java/com/android/internal/telephony/gsm/SuppServiceNotification.java
+++ b/src/java/com/android/internal/telephony/gsm/SuppServiceNotification.java
@@ -38,6 +38,9 @@ public class SuppServiceNotification {
/** List of forwarded numbers, if any */
public String[] history;
+ static public final int NOTIFICATION_TYPE_MO = 0;
+ static public final int NOTIFICATION_TYPE_MT = 1;
+
static public final int MO_CODE_UNCONDITIONAL_CF_ACTIVE = 0;
static public final int MO_CODE_SOME_CF_ACTIVE = 1;
static public final int MO_CODE_CALL_FORWARDED = 2;
@@ -64,7 +67,7 @@ public class SuppServiceNotification {
public String toString()
{
return super.toString() + " mobile"
- + (notificationType == 0 ? " originated " : " terminated ")
+ + (notificationType == NOTIFICATION_TYPE_MO ? " originated " : " terminated ")
+ " code: " + code
+ " index: " + index
+ " history: " + history