IMS : Add api to support cache retrieval

- isSimlessRttDowgradeSupported is returning the saved
  cache of previous sim to display in e911 rtt downgrade
  option during call.
- simless_rtt_downgrade_supported is a new key added to
  store the cached value of carrier config in the last sim.

Change-Id: I04b6450aa4d7c3c421d33f4e9041d739cd4eaf47
CRs-Fixed: 3090631
diff --git a/ims/ims-ext-common/src/org/codeaurora/ims/QtiCallConstants.java b/ims/ims-ext-common/src/org/codeaurora/ims/QtiCallConstants.java
index 595d31e..bfd077b 100644
--- a/ims/ims-ext-common/src/org/codeaurora/ims/QtiCallConstants.java
+++ b/ims/ims-ext-common/src/org/codeaurora/ims/QtiCallConstants.java
@@ -92,6 +92,9 @@
     public static final int CALL_FAIL_EXTRA_CODE_CALL_CS_RETRY_REQUIRED =
             ImsReasonInfo.CODE_LOCAL_CALL_CS_RETRY_REQUIRED;
 
+    public static final String SIMLESS_RTT_DOWNGRADE_SUPPORTED = "simless_rtt_downgrade_supported";
+    public static final String SIMLESS_RTT_SUPPORTED = "simless_rtt_supported";
+
     /* Calls are rejected due to low battery */
     public static final int CALL_FAIL_EXTRA_CODE_LOCAL_LOW_BATTERY =
             ImsReasonInfo.CODE_LOCAL_LOW_BATTERY;
diff --git a/ims/ims-ext-common/src/org/codeaurora/ims/utils/QtiImsExtUtils.java b/ims/ims-ext-common/src/org/codeaurora/ims/utils/QtiImsExtUtils.java
index 449d423..c769ad5 100644
--- a/ims/ims-ext-common/src/org/codeaurora/ims/utils/QtiImsExtUtils.java
+++ b/ims/ims-ext-common/src/org/codeaurora/ims/utils/QtiImsExtUtils.java
@@ -149,6 +149,10 @@
     public static final int QTI_IMS_TIR_PRESENTATION_RESTRICTED = 1;
     public static final int QTI_IMS_TIR_PRESENTATION_DEFAULT = 2;
 
+    /*RTT downgrade not supported */
+    public static final int QTI_IMS_RTT_DOWNGRADE_NOT_SUPPORTED = 0;
+    /*RTT upgrade not supported */
+    public static final int QTI_IMS_RTT_NOT_SUPPORTED = 0;
 
     /**
      * Private constructor for QtiImsExtUtils as we don't want to instantiate this class
@@ -637,6 +641,26 @@
             CarrierConfigManager.KEY_RTT_DOWNGRADE_SUPPORTED_BOOL);
     }
 
+    // Returns true if previous carrier supported RTT downgrade
+    // False otherwise
+    public static boolean isSimlessRttDowgradeSupported(int phoneId, Context context) {
+        int simLessRttDowngradeSupportedValue = android.provider.Settings.Secure.getInt(
+                context.getContentResolver(), QtiCallConstants.
+                SIMLESS_RTT_DOWNGRADE_SUPPORTED + convertRttPhoneId(phoneId),
+                QTI_IMS_RTT_DOWNGRADE_NOT_SUPPORTED);
+        return simLessRttDowngradeSupportedValue != QTI_IMS_RTT_DOWNGRADE_NOT_SUPPORTED;
+    }
+
+    // Returns true if previous carrier supported RTT upgrade
+    // False otherwise
+    public static boolean isSimlessRttSupported(int phoneId, Context context) {
+        int simLessRttSupportedValue = android.provider.Settings.Secure.getInt(
+                context.getContentResolver(), QtiCallConstants.
+                SIMLESS_RTT_SUPPORTED + convertRttPhoneId(phoneId),
+                QTI_IMS_RTT_NOT_SUPPORTED);
+        return simLessRttSupportedValue != QTI_IMS_RTT_NOT_SUPPORTED;
+    }
+
     // Returns true if Carrier support RTT visibility setting
     // False otherwise
     public static boolean shallShowRttVisibilitySetting(int phoneId, Context context) {