Merge "Add Support for Smart DDS switch during voice call"
diff --git a/extphone/src/com/qti/extphone/ExtPhoneCallbackBase.java b/extphone/src/com/qti/extphone/ExtPhoneCallbackBase.java
index 791579c..1aebe8d 100644
--- a/extphone/src/com/qti/extphone/ExtPhoneCallbackBase.java
+++ b/extphone/src/com/qti/extphone/ExtPhoneCallbackBase.java
@@ -169,4 +169,23 @@
     @Override
     public void onImeiTypeChanged(QtiImeiInfo[] imeiInfo) throws RemoteException {
     }
+
+    public void onSendUserPreferenceForDataDuringVoiceCall(int slotId, Token token,
+            Status status) throws RemoteException {
+    }
+
+    @Override
+    public void onDdsSwitchCapabilityChange(int slotId, Token token, Status status,
+            boolean support) throws RemoteException {
+    }
+
+    @Override
+    public void onDdsSwitchCriteriaChange(int slotId, boolean telephonyDdsSwitch)
+            throws RemoteException {
+    }
+
+    @Override
+    public void onDdsSwitchRecommendation(int slotId,
+            int recommendedSlotId) throws RemoteException {
+    }
 }
diff --git a/extphone/src/com/qti/extphone/ExtTelephonyManager.java b/extphone/src/com/qti/extphone/ExtTelephonyManager.java
index 9d74c74..7df3bf5 100644
--- a/extphone/src/com/qti/extphone/ExtTelephonyManager.java
+++ b/extphone/src/com/qti/extphone/ExtTelephonyManager.java
@@ -792,6 +792,38 @@
         }
     }
 
+    public Token getDdsSwitchCapability(int slot, Client client) {
+        Token token = null;
+        if (!isServiceConnected()) {
+            Log.e(LOG_TAG, "service not connected!");
+            return token;
+        }
+        try {
+            token = mExtTelephonyService.getDdsSwitchCapability(slot, client);
+        } catch(RemoteException e) {
+            Log.e(LOG_TAG, "getDdsSwitchCapability, remote exception");
+            e.printStackTrace();
+        }
+        return token;
+    }
+
+    public Token sendUserPreferenceForDataDuringVoiceCall(int slot,
+            boolean userPreference, Client client) {
+        Token token = null;
+        if (!isServiceConnected()) {
+            Log.e(LOG_TAG, "service not connected!");
+            return token;
+        }
+        try {
+            token = mExtTelephonyService.sendUserPreferenceForDataDuringVoiceCall(slot,
+                    userPreference, client);
+        } catch(RemoteException e) {
+            Log.e(LOG_TAG, "getDdsSwitchCapability, remote exception");
+            e.printStackTrace();
+        }
+        return token;
+    }
+
     public Client registerCallback(String packageName, IExtPhoneCallback callback) {
         Client client = null;
         if (!isServiceConnected()) {
diff --git a/extphone/src/com/qti/extphone/IExtPhone.aidl b/extphone/src/com/qti/extphone/IExtPhone.aidl
index e5e901f..8e72fa2 100644
--- a/extphone/src/com/qti/extphone/IExtPhone.aidl
+++ b/extphone/src/com/qti/extphone/IExtPhone.aidl
@@ -349,4 +349,24 @@
     * Requires Permission: android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
     */
     QtiImeiInfo[] getImeiInfo();
+
+    /**
+     * Request for smart DDS switch capability supported by modem.
+     * @param - slotId slot ID
+     * @return - Integer Token can be used to compare with the response.
+     */
+    Token getDdsSwitchCapability(int slotId, in Client client);
+
+    /**
+     * Inform modem if user enabled/disabled UI preference for data during voice call.
+     * if its enabled then modem can send recommendations to switch DDS during
+     * voice call on nonDDS.
+     * @param - slotId slot ID
+     * @param - userPreference true/false based on UI preference
+     * @param - client registered with packagename to receive
+     *         callbacks.
+     * @return - Integer Token can be used to compare with the response.
+     */
+     Token sendUserPreferenceForDataDuringVoiceCall(int slotId,
+             boolean userPreference, in Client client);
 }
diff --git a/extphone/src/com/qti/extphone/IExtPhoneCallback.aidl b/extphone/src/com/qti/extphone/IExtPhoneCallback.aidl
index 5923db5..bcebb82 100644
--- a/extphone/src/com/qti/extphone/IExtPhoneCallback.aidl
+++ b/extphone/src/com/qti/extphone/IExtPhoneCallback.aidl
@@ -162,11 +162,11 @@
      */
     void getFacilityLockForAppResponse(in Status status, in int[] response);
 
-   /**
-    * Response to setSmartDdsSwitchToggle
-    * @param - token is the same token which is recived in setSmartDdsSwitchToggle
-    * @param - result SUCCESS/FAILURE based on the CnE HAL response
-    */
+    /**
+     * Response to setSmartDdsSwitchToggle
+     * @param - token is the same token which is recived in setSmartDdsSwitchToggle
+     * @param - result SUCCESS/FAILURE based on the CnE HAL response
+     */
     void setSmartDdsSwitchToggleResponse(in Token token, boolean result);
 
    /**
@@ -179,4 +179,44 @@
     * corresponds to a slot.
     */
     void onImeiTypeChanged(in QtiImeiInfo[] imeiInfo);
+
+    /**
+     * Response to sendUserPreferenceForDataDuringVoiceCall
+     * @param - slotId slot ID on whcih this callback is recevied.
+     * @param - token is the same token which is recived in
+     *          sendUserPreferenceForDataDuringVoiceCall
+     * @param - status SUCCESS/FAILURE based on RIL data module response
+     */
+    void onSendUserPreferenceForDataDuringVoiceCall(int slotId, in Token token,
+            in Status status);
+
+    /**
+     * Indicates DDS switch capability could be changed to Smart DDS
+     * Upon receiving this message, HLOS has to inform modem if user has enabled/disabled
+     * UI preference for data during voice call.
+     * @param - slotId slot ID on whcih this callback is recevied.
+     * @param - token is the same token which is recived in
+     *          getDdsSwitchCapability
+     * @param - status SUCCESS/FAILURE based on the modem Result code
+     * @param - support true/false if smart DDS switch is supported or not
+     */
+    void onDdsSwitchCapabilityChange(int slotId, in Token token, in Status status,
+            boolean support);
+
+    /**
+     * Indicates if telephony has to enable/disable its temp DDS switch logic
+     * If telephony temp DDS switch is disabled, then telephony will wait for modem recommendations
+     * in seperate indication to perform temp DDS switch.
+     * @param - slotId
+     * @param - telephonyDdsSwitch true/false based on telephony temp DDS switch
+     *          logic should be enabled/disabled.
+     */
+    void onDdsSwitchCriteriaChange(int slotId, boolean telephonyDdsSwitch);
+
+    /**
+     * Indicates modem recommendation for temp DDS switch during voice call on non-DDS.
+     * @param - slotId slot ID on whcih this callback is recevied.
+     * @param - recommendedSlotId slot ID to which DDS has to be switched.
+     */
+    void onDdsSwitchRecommendation(int slotId, int recommendedSlotId);
 }