Added CDMA phone check for getMeidForSlot test

We only need to validate MEID for CDMA phones.

Test: CtsTelephonyTestCases
Bug: 113824124
Bug: 113147119
Bug: 114169115
Change-Id: If8f0dcb88d8027b49cdd06319a58dd3d66de20be
diff --git a/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java b/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
index 9f2139a..a9bcb39 100644
--- a/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
@@ -40,6 +40,8 @@
 import android.telephony.CellLocation;
 import android.telephony.PhoneStateListener;
 import android.telephony.ServiceState;
+import android.telephony.SubscriptionInfo;
+import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
 import android.text.TextUtils;
 import android.util.Log;
@@ -557,10 +559,21 @@
             return;
         }
 
-        for (int i = 0; i < mTelephonyManager.getPhoneCount(); i++) {
-            String meid = mTelephonyManager.getMeid(i);
-            if (!TextUtils.isEmpty(meid)) {
-                assertMeidEsn(meid);
+        SubscriptionManager sm = (SubscriptionManager) getContext()
+                .getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
+        List<SubscriptionInfo> subInfos = sm.getActiveSubscriptionInfoList();
+
+        if (subInfos != null) {
+            for (SubscriptionInfo subInfo : subInfos) {
+                int slotIndex = subInfo.getSimSlotIndex();
+                int subId = subInfo.getSubscriptionId();
+                TelephonyManager tm = mTelephonyManager.createForSubscriptionId(subId);
+                if (tm.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
+                    String meid = mTelephonyManager.getMeid(slotIndex);
+                    if (!TextUtils.isEmpty(meid)) {
+                        assertMeidEsn(meid);
+                    }
+                }
             }
         }