Merge "Add client APIs for getting C_IWLAN config"
diff --git a/extphone/src/com/qti/extphone/CiwlanConfig.aidl b/extphone/src/com/qti/extphone/CiwlanConfig.aidl
new file mode 100644
index 0000000..c0d5380
--- /dev/null
+++ b/extphone/src/com/qti/extphone/CiwlanConfig.aidl
@@ -0,0 +1,8 @@
+/*
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause-Clear
+ */
+
+package com.qti.extphone;
+
+parcelable CiwlanConfig;
diff --git a/extphone/src/com/qti/extphone/CiwlanConfig.java b/extphone/src/com/qti/extphone/CiwlanConfig.java
new file mode 100644
index 0000000..6bd5ea0
--- /dev/null
+++ b/extphone/src/com/qti/extphone/CiwlanConfig.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause-Clear
+ */
+
+package com.qti.extphone;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class CiwlanConfig implements Parcelable {
+
+    private static final String TAG = "CiwlanConfig";
+
+    public static final int INVALID = -1;
+    public static final int ONLY = 0;
+    public static final int PREFERRED = 1;
+
+    private int mHomeMode = INVALID;
+    private int mRoamMode = INVALID;
+
+    public CiwlanConfig(int homeMode, int roamMode) {
+        mHomeMode = homeMode;
+        mRoamMode = roamMode;
+    }
+
+    public CiwlanConfig(Parcel in) {
+        mHomeMode = in.readInt();
+        mRoamMode = in.readInt();
+    }
+
+    public String getHomeCiwlanMode() {
+        switch (mHomeMode) {
+            case ONLY:
+                return "ONLY";
+            case PREFERRED:
+                return "PREFERRED";
+            default:
+                return "INVALID";
+        }
+    }
+
+    public String getRoamCiwlanMode() {
+        switch (mRoamMode) {
+            case ONLY:
+                return "ONLY";
+            case PREFERRED:
+                return "PREFERRED";
+            default:
+                return "INVALID";
+        }
+    }
+
+    public boolean isCiwlanOnlyInHome() {
+        return mHomeMode == ONLY;
+    }
+
+    public boolean isCiwlanOnlyInRoam() {
+        return mRoamMode == ONLY;
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel out, int flags) {
+        out.writeInt(mHomeMode);
+        out.writeInt(mRoamMode);
+    }
+
+    public static final Parcelable.Creator<CiwlanConfig> CREATOR = new Parcelable.Creator() {
+        @Override
+        public CiwlanConfig createFromParcel(Parcel in) {
+            return new CiwlanConfig(in);
+        }
+
+        @Override
+        public CiwlanConfig[] newArray(int size) {
+            return new CiwlanConfig[size];
+        }
+    };
+
+    @Override
+    public String toString() {
+        return TAG + " homeMode = " + getHomeCiwlanMode() + ", roamMode = " + getRoamCiwlanMode();
+    }
+}
diff --git a/extphone/src/com/qti/extphone/ExtTelephonyManager.java b/extphone/src/com/qti/extphone/ExtTelephonyManager.java
index 49084bc..fc90c6a 100644
--- a/extphone/src/com/qti/extphone/ExtTelephonyManager.java
+++ b/extphone/src/com/qti/extphone/ExtTelephonyManager.java
@@ -1085,6 +1085,20 @@
         return null;
     }
 
+    public CiwlanConfig getCiwlanConfig(int slotId) throws RemoteException {
+        CiwlanConfig config = null;
+        if (!isServiceConnected()) {
+            Log.e(LOG_TAG, "service not connected!");
+            return config;
+        }
+        try {
+            config = mExtTelephonyService.getCiwlanConfig(slotId);
+        } catch (RemoteException e) {
+            Log.e(LOG_TAG, "getCiwlanConfig ended in remote exception", e);
+        }
+        return config;
+    }
+
     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 0f4964c..444f2c6 100644
--- a/extphone/src/com/qti/extphone/IExtPhone.aidl
+++ b/extphone/src/com/qti/extphone/IExtPhone.aidl
@@ -38,7 +38,7 @@
 
 import android.telephony.ImsiEncryptionInfo;
 
-import com.qti.extphone.Token;
+import com.qti.extphone.CiwlanConfig;
 import com.qti.extphone.Client;
 import com.qti.extphone.IDepersoResCallback;
 import com.qti.extphone.IExtPhoneCallback;
@@ -47,6 +47,7 @@
 import com.qti.extphone.QtiImeiInfo;
 import com.qti.extphone.QtiSetNetworkSelectionMode;
 import com.qti.extphone.QtiSimType;
+import com.qti.extphone.Token;
 
 interface IExtPhone {
 
@@ -584,4 +585,12 @@
      * @return - Integer Token can be used to compare with the response.
      */
     Token setSimType(in Client client, in QtiSimType[] simType);
+
+    /**
+     * Query the C_IWLAN mode
+     *
+     * @param - slotId slot ID
+     * @return - The C_IWLAN configuration (only vs preferred) for home and roaming
+     */
+    CiwlanConfig getCiwlanConfig(int slotId);
 }
diff --git a/extphone/src/com/qti/extphone/IExtPhoneCallback.aidl b/extphone/src/com/qti/extphone/IExtPhoneCallback.aidl
index 484cedd..a068c52 100644
--- a/extphone/src/com/qti/extphone/IExtPhoneCallback.aidl
+++ b/extphone/src/com/qti/extphone/IExtPhoneCallback.aidl
@@ -30,7 +30,7 @@
 /*
  * Changes from Qualcomm Innovation Center are provided under the following license:
  *
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  * SPDX-License-Identifier: BSD-3-Clause-Clear
  */
 
@@ -270,7 +270,7 @@
 
     /**
      * Response to getSecureModeStatus
-     * @param - token is the same token which is received in setSmartDdsSwitchToggle
+     * @param - token is the same token which is passed in from getSecureModeStatus
      * @param - status SUCCESS/FAILURE based on RIL data module response
      * @param - enableStatus Secure Mode status - true: enabled, false: disabled
      */