1 /** 2 * Copyright (c) 2015, The Linux Foundation. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: 7 * * Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * * Redistributions in binary form must reproduce the above 10 * copyright notice, this list of conditions and the following 11 * disclaimer in the documentation and/or other materials provided 12 * with the distribution. 13 * * Neither the name of The Linux Foundation nor the names of its 14 * contributors may be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 26 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30 package org.codeaurora.ims.utils; 31 32 import android.content.ContentResolver; 33 import android.content.Context; 34 35 /** 36 * This class contains QtiImsExt specific utiltity functions. 37 */ 38 public class QtiImsExtUtils { 39 40 private static String LOG_TAG = "QtiImsExtUtils"; 41 42 public static final String QTI_IMS_CALL_DEFLECT_NUMBER = 43 "ims_call_deflect_number"; 44 45 /* Call deflect setting name */ 46 public static final String QTI_IMS_DEFLECT_ENABLED = "qti.ims.call_deflect"; 47 48 /* Default success value */ 49 public static final int QTI_IMS_REQUEST_SUCCESS = 0; 50 51 /* Default error value */ 52 public static final int QTI_IMS_REQUEST_ERROR = 1; 53 54 /* Call RAT extra key */ 55 public static final String QTI_IMS_CALL_RAT_EXTRA_KEY = "CallRadioTech"; 56 57 /** 58 * Definitions for the call transfer type. For easier implementation, 59 * the transfer type is defined as a bit mask value. 60 */ 61 //Value representing blind call transfer type 62 public static final int QTI_IMS_BLIND_TRANSFER = 0x01; 63 //Value representing assured call transfer type 64 public static final int QTI_IMS_ASSURED_TRANSFER = 0x02; 65 //Value representing consultative call transfer type 66 public static final int QTI_IMS_CONSULTATIVE_TRANSFER = 0x04; 67 68 /* Call transfer extra key */ 69 public static final String QTI_IMS_TRANSFER_EXTRA_KEY = "transferType"; 70 71 /** 72 * Private constructor for QtiImsExtUtils as we don't want to instantiate this class 73 */ 74 private QtiImsExtUtils() { 75 } 76 77 /** 78 * Retrieves the call deflection stored by the user 79 * Returns stored number, or null otherwise. 80 */ 81 public static String getCallDeflectNumber(ContentResolver contentResolver) { 82 String deflectcall = android.provider.Settings.Global.getString(contentResolver, 83 QTI_IMS_CALL_DEFLECT_NUMBER); 84 85 /* Consider being null or empty as "Not Set" */ 86 if ((deflectcall != null) && (deflectcall.isEmpty())) { 87 deflectcall = null; 88 } 89 90 return deflectcall; 91 } 92 93 /* Stores the call deflection provided by the user */ 94 public static void setCallDeflectNumber(ContentResolver contentResolver, String value) { 95 String deflectNum = value; 96 97 if (value == null || value.isEmpty()) { 98 deflectNum = ""; 99 } 100 101 android.provider.Settings.Global.putString(contentResolver, 102 QTI_IMS_CALL_DEFLECT_NUMBER, deflectNum); 103 } 104 105 /*** 106 * Checks if the IMS call transfer property is enabled or not. 107 * Returns true if enabled, or false otherwise. 108 */ 109 public static boolean isCallTransferEnabled(Context context) { 110 return false; 111 } 112 } 113