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

Commit 2bc3175d authored by Suresh Kumar Sugguna's avatar Suresh Kumar Sugguna Committed by Linux Build Service Account
Browse files

IMS: Deflect call feature

Code changes to support IMS Deflect call feature.

Change-Id: Ia55ca100d87ab0bae1a61b9a4ce7f81f3519e1e3
CRs-Fixed: 713856
parent a38ffa63
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -95,4 +95,16 @@ oneway interface IQtiImsInterface {
     * @throws RemoteException if calling the IMS service results in an error.
     */
    void getPacketErrorCount(IQtiImsInterfaceListener listener);

   /**
     * sendCallDeflectRequest
     * Deflects a incoming call to given number
     *
     * @param phoneId indicates the phone instance which triggered the request
     * @param deflectNumber indicates the target number to deflect
     * @param listener an IQtiImsInterfaceListener instance to indicate the response
     * @return void
     */
    void sendCallDeflectRequest(int phoneId, String deflectNumber,
            IQtiImsInterfaceListener listener);
}
+9 −0
Original line number Diff line number Diff line
@@ -86,4 +86,13 @@ oneway interface IQtiImsInterfaceListener {
     * @return void
     */
   void onGetPacketErrorCount(int status, long packetErrorCount);

    /**
     * Notifies client the result of call deflect request
     *
     * @param <result> is one of the values QTIIMS_REQUEST_*, as defined in
     *        <code>org.codeaurora.ims.qtiims.QtiImsInterfaceUtils.</code>
     * @return void.
     */
    void receiveCallDeflectResponse(int result);
}
+86 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2015, The Linux Foundation. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above
 *       copyright notice, this list of conditions and the following
 *       disclaimer in the documentation and/or other materials provided
 *       with the distribution.
 *     * Neither the name of The Linux Foundation nor the names of its
 *       contributors may be used to endorse or promote products derived
 *       from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package org.codeaurora.ims.qtiims;

import android.content.ContentResolver;

/**
 * This class contains QtiImsInterface specific utiltity functions.
 */
public class QtiImsInterfaceUtils {

    private static String LOG_TAG = "QtiImsInterfaceUtils";

    public static final String QTI_IMS_CALL_DEFLECT_NUMBER =
            "ims_call_deflect_number";

    /* Call deflect extra key name */
    public static final String QTI_IMS_DEFLECT_EXTRA_KEY = "Deflect";

    /* Default success value */
    public static final int QTI_IMS_REQUEST_SUCCESS = 0;

    /* Default error value */
    public static final int QTI_IMS_REQUEST_ERROR = 1;

    /**
     * Private constructor for QtiImsInterfaceUtils as we don't want to instantiate this class
     */
    private QtiImsInterfaceUtils() {
    }

    /**
     * Retrieves the call deflection stored by the user
     * Returns stored number, or null otherwise.
     */
    public static String getCallDeflectNumber(ContentResolver contentResolver) {
        String deflectcall = android.provider.Settings.Global.getString(contentResolver,
                                     QTI_IMS_CALL_DEFLECT_NUMBER);

        /* Consider being null or empty as "Not Set" */
        if ((deflectcall != null) && (deflectcall.isEmpty())) {
            deflectcall = null;
        }

        return deflectcall;
    }

    /* Stores the call deflection provided by the user */
    public static void setCallDeflectNumber(ContentResolver contentResolver, String value) {
        String deflectNum = value;

        if (value == null || value.isEmpty()) {
            deflectNum = "";
        }

        android.provider.Settings.Global.putString(contentResolver,
                QTI_IMS_CALL_DEFLECT_NUMBER, deflectNum);
    }
}