Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5888e62 authored by Shruthi N.K's avatar Shruthi N.K Committed by Danny Baumann
Browse files

telephony: Display Supplementary Service Notifications.

telephony: Display Supplementary Service Notifications.

CallManager registers for supplementary service notifications
with Phone to notify Phone App.

Change-Id: I20c1c908200a9a2ced017e14821cb65249521708
parent 3836ca19
Loading
Loading
Loading
Loading
+33 −0
Original line number Original line Diff line number Diff line
@@ -78,6 +78,7 @@ public final class CallManager {
    private static final int EVENT_SUPP_SERVICE_FAILED = 117;
    private static final int EVENT_SUPP_SERVICE_FAILED = 117;
    private static final int EVENT_SERVICE_STATE_CHANGED = 118;
    private static final int EVENT_SERVICE_STATE_CHANGED = 118;
    private static final int EVENT_POST_DIAL_CHARACTER = 119;
    private static final int EVENT_POST_DIAL_CHARACTER = 119;
    private static final int EVENT_SUPP_SERVICE_NOTIFY = 120;


    // Singleton instance
    // Singleton instance
    private static final CallManager INSTANCE = new CallManager();
    private static final CallManager INSTANCE = new CallManager();
@@ -159,6 +160,9 @@ public final class CallManager {
    protected final RegistrantList mSuppServiceFailedRegistrants
    protected final RegistrantList mSuppServiceFailedRegistrants
    = new RegistrantList();
    = new RegistrantList();


    protected final RegistrantList mSuppServiceNotificationRegistrants
    = new RegistrantList();

    protected final RegistrantList mServiceStateChangedRegistrants
    protected final RegistrantList mServiceStateChangedRegistrants
    = new RegistrantList();
    = new RegistrantList();


@@ -428,6 +432,9 @@ public final class CallManager {
        phone.registerForMmiComplete(mHandler, EVENT_MMI_COMPLETE, null);
        phone.registerForMmiComplete(mHandler, EVENT_MMI_COMPLETE, null);
        phone.registerForSuppServiceFailed(mHandler, EVENT_SUPP_SERVICE_FAILED, null);
        phone.registerForSuppServiceFailed(mHandler, EVENT_SUPP_SERVICE_FAILED, null);
        phone.registerForServiceStateChanged(mHandler, EVENT_SERVICE_STATE_CHANGED, null);
        phone.registerForServiceStateChanged(mHandler, EVENT_SERVICE_STATE_CHANGED, null);
        if (phone.getPhoneType() == Phone.PHONE_TYPE_GSM) {
            phone.registerForSuppServiceNotification(mHandler, EVENT_SUPP_SERVICE_NOTIFY, null);
        }


        // for events supported only by GSM and CDMA phone
        // for events supported only by GSM and CDMA phone
        if (phone.getPhoneType() == Phone.PHONE_TYPE_GSM ||
        if (phone.getPhoneType() == Phone.PHONE_TYPE_GSM ||
@@ -460,6 +467,7 @@ public final class CallManager {
        phone.unregisterForMmiInitiate(mHandler);
        phone.unregisterForMmiInitiate(mHandler);
        phone.unregisterForMmiComplete(mHandler);
        phone.unregisterForMmiComplete(mHandler);
        phone.unregisterForSuppServiceFailed(mHandler);
        phone.unregisterForSuppServiceFailed(mHandler);
        phone.unregisterForSuppServiceNotification(mHandler);
        phone.unregisterForServiceStateChanged(mHandler);
        phone.unregisterForServiceStateChanged(mHandler);


        // for events supported only by GSM and CDMA phone
        // for events supported only by GSM and CDMA phone
@@ -1267,6 +1275,27 @@ public final class CallManager {
        mSuppServiceFailedRegistrants.remove(h);
        mSuppServiceFailedRegistrants.remove(h);
    }
    }


    /**
     * 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
     * Register for notifications when a sInCall VoicePrivacy is enabled
     *
     *
@@ -1776,6 +1805,10 @@ public final class CallManager {
                    if (VDBG) Log.d(LOG_TAG, " handleMessage (EVENT_SUPP_SERVICE_FAILED)");
                    if (VDBG) Log.d(LOG_TAG, " handleMessage (EVENT_SUPP_SERVICE_FAILED)");
                    mSuppServiceFailedRegistrants.notifyRegistrants((AsyncResult) msg.obj);
                    mSuppServiceFailedRegistrants.notifyRegistrants((AsyncResult) msg.obj);
                    break;
                    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:
                case EVENT_SERVICE_STATE_CHANGED:
                    if (VDBG) Log.d(LOG_TAG, " handleMessage (EVENT_SERVICE_STATE_CHANGED)");
                    if (VDBG) Log.d(LOG_TAG, " handleMessage (EVENT_SERVICE_STATE_CHANGED)");
                    mServiceStateChangedRegistrants.notifyRegistrants((AsyncResult) msg.obj);
                    mServiceStateChangedRegistrants.notifyRegistrants((AsyncResult) msg.obj);