diff options
author | Danny Baumann <dannybaumann@web.de> | 2012-12-21 10:21:13 +0100 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.cyanogenmod.com> | 2012-12-24 00:08:59 -0800 |
commit | 04c728ab5919289423193a9dd7decc76545aa0fe (patch) | |
tree | 4c60d36e3f922e42097cf756de0f55829df6b446 /src/java/com/android/internal/telephony/CallManager.java | |
parent | 2c3b1a8628776dffeeb2129d0d7c330dd56b2ecb (diff) | |
download | frameworks_opt_telephony-04c728ab5919289423193a9dd7decc76545aa0fe.zip frameworks_opt_telephony-04c728ab5919289423193a9dd7decc76545aa0fe.tar.gz frameworks_opt_telephony-04c728ab5919289423193a9dd7decc76545aa0fe.tar.bz2 |
Allow registering for supplementary service notifications.
Change-Id: Id40d320cb6935ddf4cceefa8ddb42f9229b66efa
Diffstat (limited to 'src/java/com/android/internal/telephony/CallManager.java')
-rw-r--r-- | src/java/com/android/internal/telephony/CallManager.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/java/com/android/internal/telephony/CallManager.java b/src/java/com/android/internal/telephony/CallManager.java index b87ea50..3538987 100644 --- a/src/java/com/android/internal/telephony/CallManager.java +++ b/src/java/com/android/internal/telephony/CallManager.java @@ -78,6 +78,7 @@ public final class CallManager { private static final int EVENT_SUPP_SERVICE_FAILED = 117; private static final int EVENT_SERVICE_STATE_CHANGED = 118; private static final int EVENT_POST_DIAL_CHARACTER = 119; + private static final int EVENT_SUPP_SERVICE_NOTIFY = 120; // Singleton instance private static final CallManager INSTANCE = new CallManager(); @@ -158,6 +159,9 @@ public final class CallManager { protected final RegistrantList mSuppServiceFailedRegistrants = new RegistrantList(); + protected final RegistrantList mSuppServiceNotificationRegistrants + = new RegistrantList(); + protected final RegistrantList mServiceStateChangedRegistrants = new RegistrantList(); @@ -448,6 +452,11 @@ public final class CallManager { phone.setOnPostDialCharacter(mHandler, EVENT_POST_DIAL_CHARACTER, null); } + // for events supported only by GSM phone + if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM) { + phone.registerForSuppServiceNotification(mHandler, EVENT_SUPP_SERVICE_NOTIFY, null); + } + // for events supported only by CDMA phone if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA ){ phone.registerForCdmaOtaStatusChange(mHandler, EVENT_CDMA_OTA_STATUS_CHANGE, null); @@ -481,6 +490,11 @@ public final class CallManager { phone.setOnPostDialCharacter(null, EVENT_POST_DIAL_CHARACTER, null); } + // for events supported only by GSM phone + if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM) { + phone.unregisterForSuppServiceNotification(mHandler); + } + // for events supported only by CDMA phone if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA ){ phone.unregisterForCdmaOtaStatusChange(mHandler); @@ -1290,6 +1304,27 @@ public final 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){ + mSuppServiceNotificationRegistrants.addUnique(h, what, obj); + } + + /** + * Unregister for supplementary service notifications. + * + * @param h Handler to be removed from the registrant list. + */ + public void unregisterForSuppServiceNotification(Handler h){ + mSuppServiceNotificationRegistrants.remove(h); + } + + /** * Register for notifications when a sInCall VoicePrivacy is enabled * * @param h Handler that receives the notification message. @@ -1798,6 +1833,10 @@ public final class CallManager { if (VDBG) Log.d(LOG_TAG, " handleMessage (EVENT_SUPP_SERVICE_FAILED)"); mSuppServiceFailedRegistrants.notifyRegistrants((AsyncResult) msg.obj); break; + case EVENT_SUPP_SERVICE_NOTIFY: + if (VDBG) Log.d(LOG_TAG, " handleMessage (EVENT_SUPP_SERVICE_NOTIFICATION)"); + mSuppServiceNotificationRegistrants.notifyRegistrants((AsyncResult) msg.obj); + break; case EVENT_SERVICE_STATE_CHANGED: if (VDBG) Log.d(LOG_TAG, " handleMessage (EVENT_SERVICE_STATE_CHANGED)"); mServiceStateChangedRegistrants.notifyRegistrants((AsyncResult) msg.obj); |