Loading src/java/com/android/internal/telephony/TelephonyComponentFactory.java +12 −4 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.system.Os; import android.system.OsConstants; import android.system.StructStatVfs; import android.telephony.Rlog; import android.text.TextUtils; import com.android.internal.telephony.cdma.CdmaSubscriptionSourceManager; import com.android.internal.telephony.cdma.EriManager; Loading Loading @@ -72,18 +73,25 @@ public class TelephonyComponentFactory { private static final String TAG_INJECTION = "injection"; private static final String TAG_COMPONENTS = "components"; private static final String TAG_COMPONENT = "component"; private static final String SYSTEM = "/system/"; private final Set<String> mComponentNames = new HashSet<>(); private TelephonyComponentFactory mInjectedInstance; private String mPackageName; private String mJarPath; private boolean isInjected() { return mPackageName != null && mJarPath != null; /** * @return if jar path is correctly configured to inject. * 1) PackageName and JarPath mustn't be empty. * 2) JarPath is restricted under /system only */ private boolean isConfigValid() { return !TextUtils.isEmpty(mPackageName) && !TextUtils.isEmpty(mJarPath) && mJarPath.startsWith(SYSTEM); } private void makeInjectedInstance() { if (isInjected()) { if (isConfigValid()) { try { StructStatVfs vfs = Os.statvfs(mJarPath); if ((vfs.f_flag & OsConstants.ST_RDONLY) != 0) { Loading Loading @@ -222,7 +230,7 @@ public class TelephonyComponentFactory { mInjectedComponents = new InjectedComponents(); mInjectedComponents.parseXml(parser); mInjectedComponents.makeInjectedInstance(); Rlog.d(TAG, "Total components injected: " + (mInjectedComponents.isInjected() Rlog.d(TAG, "Total components injected: " + (mInjectedComponents.isConfigValid() ? mInjectedComponents.mComponentNames.size() : 0)); } } Loading src/java/com/android/internal/telephony/uicc/UiccController.java +19 −7 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.internal.telephony.uicc; import static android.telephony.TelephonyManager.UNINITIALIZED_CARD_ID; import static android.telephony.TelephonyManager.UNSUPPORTED_CARD_ID; import android.app.BroadcastOptions; import android.content.Context; import android.content.Intent; Loading Loading @@ -129,6 +132,8 @@ public class UiccController extends Handler { // The array index is the card ID (int). // This mapping exists to expose card-based functionality without exposing the EID, which is // considered sensetive information. // mCardStrings is populated using values from the IccSlotStatus and IccCardStatus. For // HAL < 1.2, these do not contain the EID or the ICCID, so mCardStrings will be empty private ArrayList<String> mCardStrings; // This is the card ID of the default eUICC. It starts as UNINITIALIZED_CARD_ID. Loading Loading @@ -214,7 +219,7 @@ public class UiccController extends Handler { mLauncher = new UiccStateChangedLauncher(c, this); mCardStrings = loadCardStrings(); mDefaultEuiccCardId = TelephonyManager.UNINITIALIZED_CARD_ID; mDefaultEuiccCardId = UNINITIALIZED_CARD_ID; } private int getSlotIdFromPhoneId(int phoneId) { Loading Loading @@ -556,7 +561,8 @@ public class UiccController extends Handler { if (eidIsNotSupported(status)) { // we will never get EID from the HAL, so set mDefaultEuiccCardId to UNSUPPORTED_CARD_ID mDefaultEuiccCardId = TelephonyManager.UNSUPPORTED_CARD_ID; if (DBG) log("eid is not supported"); mDefaultEuiccCardId = UNSUPPORTED_CARD_ID; } mPhoneIdToSlotId[index] = slotId; Loading Loading @@ -590,7 +596,7 @@ public class UiccController extends Handler { // EID may be unpopulated if RadioConfig<1.2 // If so, just register for EID loaded and skip this stuff if (isEuicc && cardString == null && mDefaultEuiccCardId != TelephonyManager.UNSUPPORTED_CARD_ID) { && mDefaultEuiccCardId != UNSUPPORTED_CARD_ID) { ((EuiccCard) card).registerForEidReady(this, EVENT_EID_READY, index); } Loading Loading @@ -634,18 +640,24 @@ public class UiccController extends Handler { * to match to a card ID. * * @return the matching cardId, or UNINITIALIZED_CARD_ID if the card string does not map to a * currently loaded cardId * currently loaded cardId, or UNSUPPORTED_CARD_ID if the device does not support card IDs */ public int convertToPublicCardId(String cardString) { if (mDefaultEuiccCardId == UNSUPPORTED_CARD_ID) { // even if cardString is not an EID, if EID is not supported (e.g. HAL < 1.2) we can't // guarentee a working card ID implementation, so return UNSUPPORTED_CARD_ID return UNSUPPORTED_CARD_ID; } if (TextUtils.isEmpty(cardString)) { return TelephonyManager.UNINITIALIZED_CARD_ID; return UNINITIALIZED_CARD_ID; } if (cardString.length() < EID_LENGTH) { cardString = IccUtils.stripTrailingFs(cardString); } int id = mCardStrings.indexOf(cardString); if (id == -1) { return TelephonyManager.UNINITIALIZED_CARD_ID; return UNINITIALIZED_CARD_ID; } else { return id; } Loading Loading @@ -920,7 +932,7 @@ public class UiccController extends Handler { // set mCardStrings and the defaultEuiccCardId using the now available EID String eid = ((EuiccCard) card).getEid(); addCardId(eid); if (mDefaultEuiccCardId == TelephonyManager.UNINITIALIZED_CARD_ID) { if (mDefaultEuiccCardId == UNINITIALIZED_CARD_ID) { // TODO(b/122738148) the default eUICC should not be removable mDefaultEuiccCardId = convertToPublicCardId(eid); log("onEidReady: eid=" + eid + " slot=" + slotId + " mDefaultEuiccCardId=" Loading tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -1844,7 +1844,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { sst.mSS.getNetworkRegistrationState(NetworkRegistrationState.DOMAIN_PS, TransportType.WWAN); assertEquals(lteVopsSupportInfo, sSnetworkRegistrationState.getDataSpecificStates().lteVopsSupportInfo); sSnetworkRegistrationState.getDataSpecificStates().getLteVopsSupportInfo()); lteVopsSupportInfo = new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_SUPPORTED, Loading @@ -1862,6 +1862,6 @@ public class ServiceStateTrackerTest extends TelephonyTest { sSnetworkRegistrationState = sst.mSS.getNetworkRegistrationState(2, 1); assertEquals(lteVopsSupportInfo, sSnetworkRegistrationState.getDataSpecificStates().lteVopsSupportInfo); sSnetworkRegistrationState.getDataSpecificStates().getLteVopsSupportInfo()); } } tests/telephonytests/src/com/android/internal/telephony/uicc/UiccControllerTest.java +5 −2 Original line number Diff line number Diff line Loading @@ -109,8 +109,9 @@ public class UiccControllerTest extends TelephonyTest { mIccCardStatus.mImsSubscriptionAppIndex = mIccCardStatus.mGsmUmtsSubscriptionAppIndex = -1; mSimulatedCommands.setIccCardStatus(mIccCardStatus); // slotIndex should be invalid when testing with older versions (before 1.2) of hal mIccCardStatus.physicalSlotIndex = UiccController.INVALID_SLOT_ID; // for testing we pretend slotIndex is set. In reality it would be invalid on older versions // (before 1.2) of hal mIccCardStatus.physicalSlotIndex = 0; mUiccControllerHandlerThread = new UiccControllerHandlerThread(TAG); mUiccControllerHandlerThread.start(); waitUntilReady(); Loading Loading @@ -235,6 +236,7 @@ public class UiccControllerTest extends TelephonyTest { ics.atr = "abcdef0123456789abcdef"; ics.iccid = "123451234567890"; ics.eid = "A1B2C3D4"; ics.physicalSlotIndex = 0; AsyncResult ar = new AsyncResult(null, ics, null); Message msg = Message.obtain(mUiccControllerUT, EVENT_GET_ICC_STATUS_DONE, ar); mUiccControllerUT.handleMessage(msg); Loading Loading @@ -325,6 +327,7 @@ public class UiccControllerTest extends TelephonyTest { ics.setUniversalPinState(3 /* disabled */); ics.atr = "abcdef0123456789abcdef"; ics.iccid = "123451234567890"; ics.physicalSlotIndex = 0; AsyncResult ar = new AsyncResult(null, ics, null); Message msg = Message.obtain(mUiccControllerUT, EVENT_GET_ICC_STATUS_DONE, ar); mUiccControllerUT.handleMessage(msg); Loading Loading
src/java/com/android/internal/telephony/TelephonyComponentFactory.java +12 −4 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.system.Os; import android.system.OsConstants; import android.system.StructStatVfs; import android.telephony.Rlog; import android.text.TextUtils; import com.android.internal.telephony.cdma.CdmaSubscriptionSourceManager; import com.android.internal.telephony.cdma.EriManager; Loading Loading @@ -72,18 +73,25 @@ public class TelephonyComponentFactory { private static final String TAG_INJECTION = "injection"; private static final String TAG_COMPONENTS = "components"; private static final String TAG_COMPONENT = "component"; private static final String SYSTEM = "/system/"; private final Set<String> mComponentNames = new HashSet<>(); private TelephonyComponentFactory mInjectedInstance; private String mPackageName; private String mJarPath; private boolean isInjected() { return mPackageName != null && mJarPath != null; /** * @return if jar path is correctly configured to inject. * 1) PackageName and JarPath mustn't be empty. * 2) JarPath is restricted under /system only */ private boolean isConfigValid() { return !TextUtils.isEmpty(mPackageName) && !TextUtils.isEmpty(mJarPath) && mJarPath.startsWith(SYSTEM); } private void makeInjectedInstance() { if (isInjected()) { if (isConfigValid()) { try { StructStatVfs vfs = Os.statvfs(mJarPath); if ((vfs.f_flag & OsConstants.ST_RDONLY) != 0) { Loading Loading @@ -222,7 +230,7 @@ public class TelephonyComponentFactory { mInjectedComponents = new InjectedComponents(); mInjectedComponents.parseXml(parser); mInjectedComponents.makeInjectedInstance(); Rlog.d(TAG, "Total components injected: " + (mInjectedComponents.isInjected() Rlog.d(TAG, "Total components injected: " + (mInjectedComponents.isConfigValid() ? mInjectedComponents.mComponentNames.size() : 0)); } } Loading
src/java/com/android/internal/telephony/uicc/UiccController.java +19 −7 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.internal.telephony.uicc; import static android.telephony.TelephonyManager.UNINITIALIZED_CARD_ID; import static android.telephony.TelephonyManager.UNSUPPORTED_CARD_ID; import android.app.BroadcastOptions; import android.content.Context; import android.content.Intent; Loading Loading @@ -129,6 +132,8 @@ public class UiccController extends Handler { // The array index is the card ID (int). // This mapping exists to expose card-based functionality without exposing the EID, which is // considered sensetive information. // mCardStrings is populated using values from the IccSlotStatus and IccCardStatus. For // HAL < 1.2, these do not contain the EID or the ICCID, so mCardStrings will be empty private ArrayList<String> mCardStrings; // This is the card ID of the default eUICC. It starts as UNINITIALIZED_CARD_ID. Loading Loading @@ -214,7 +219,7 @@ public class UiccController extends Handler { mLauncher = new UiccStateChangedLauncher(c, this); mCardStrings = loadCardStrings(); mDefaultEuiccCardId = TelephonyManager.UNINITIALIZED_CARD_ID; mDefaultEuiccCardId = UNINITIALIZED_CARD_ID; } private int getSlotIdFromPhoneId(int phoneId) { Loading Loading @@ -556,7 +561,8 @@ public class UiccController extends Handler { if (eidIsNotSupported(status)) { // we will never get EID from the HAL, so set mDefaultEuiccCardId to UNSUPPORTED_CARD_ID mDefaultEuiccCardId = TelephonyManager.UNSUPPORTED_CARD_ID; if (DBG) log("eid is not supported"); mDefaultEuiccCardId = UNSUPPORTED_CARD_ID; } mPhoneIdToSlotId[index] = slotId; Loading Loading @@ -590,7 +596,7 @@ public class UiccController extends Handler { // EID may be unpopulated if RadioConfig<1.2 // If so, just register for EID loaded and skip this stuff if (isEuicc && cardString == null && mDefaultEuiccCardId != TelephonyManager.UNSUPPORTED_CARD_ID) { && mDefaultEuiccCardId != UNSUPPORTED_CARD_ID) { ((EuiccCard) card).registerForEidReady(this, EVENT_EID_READY, index); } Loading Loading @@ -634,18 +640,24 @@ public class UiccController extends Handler { * to match to a card ID. * * @return the matching cardId, or UNINITIALIZED_CARD_ID if the card string does not map to a * currently loaded cardId * currently loaded cardId, or UNSUPPORTED_CARD_ID if the device does not support card IDs */ public int convertToPublicCardId(String cardString) { if (mDefaultEuiccCardId == UNSUPPORTED_CARD_ID) { // even if cardString is not an EID, if EID is not supported (e.g. HAL < 1.2) we can't // guarentee a working card ID implementation, so return UNSUPPORTED_CARD_ID return UNSUPPORTED_CARD_ID; } if (TextUtils.isEmpty(cardString)) { return TelephonyManager.UNINITIALIZED_CARD_ID; return UNINITIALIZED_CARD_ID; } if (cardString.length() < EID_LENGTH) { cardString = IccUtils.stripTrailingFs(cardString); } int id = mCardStrings.indexOf(cardString); if (id == -1) { return TelephonyManager.UNINITIALIZED_CARD_ID; return UNINITIALIZED_CARD_ID; } else { return id; } Loading Loading @@ -920,7 +932,7 @@ public class UiccController extends Handler { // set mCardStrings and the defaultEuiccCardId using the now available EID String eid = ((EuiccCard) card).getEid(); addCardId(eid); if (mDefaultEuiccCardId == TelephonyManager.UNINITIALIZED_CARD_ID) { if (mDefaultEuiccCardId == UNINITIALIZED_CARD_ID) { // TODO(b/122738148) the default eUICC should not be removable mDefaultEuiccCardId = convertToPublicCardId(eid); log("onEidReady: eid=" + eid + " slot=" + slotId + " mDefaultEuiccCardId=" Loading
tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -1844,7 +1844,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { sst.mSS.getNetworkRegistrationState(NetworkRegistrationState.DOMAIN_PS, TransportType.WWAN); assertEquals(lteVopsSupportInfo, sSnetworkRegistrationState.getDataSpecificStates().lteVopsSupportInfo); sSnetworkRegistrationState.getDataSpecificStates().getLteVopsSupportInfo()); lteVopsSupportInfo = new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_SUPPORTED, Loading @@ -1862,6 +1862,6 @@ public class ServiceStateTrackerTest extends TelephonyTest { sSnetworkRegistrationState = sst.mSS.getNetworkRegistrationState(2, 1); assertEquals(lteVopsSupportInfo, sSnetworkRegistrationState.getDataSpecificStates().lteVopsSupportInfo); sSnetworkRegistrationState.getDataSpecificStates().getLteVopsSupportInfo()); } }
tests/telephonytests/src/com/android/internal/telephony/uicc/UiccControllerTest.java +5 −2 Original line number Diff line number Diff line Loading @@ -109,8 +109,9 @@ public class UiccControllerTest extends TelephonyTest { mIccCardStatus.mImsSubscriptionAppIndex = mIccCardStatus.mGsmUmtsSubscriptionAppIndex = -1; mSimulatedCommands.setIccCardStatus(mIccCardStatus); // slotIndex should be invalid when testing with older versions (before 1.2) of hal mIccCardStatus.physicalSlotIndex = UiccController.INVALID_SLOT_ID; // for testing we pretend slotIndex is set. In reality it would be invalid on older versions // (before 1.2) of hal mIccCardStatus.physicalSlotIndex = 0; mUiccControllerHandlerThread = new UiccControllerHandlerThread(TAG); mUiccControllerHandlerThread.start(); waitUntilReady(); Loading Loading @@ -235,6 +236,7 @@ public class UiccControllerTest extends TelephonyTest { ics.atr = "abcdef0123456789abcdef"; ics.iccid = "123451234567890"; ics.eid = "A1B2C3D4"; ics.physicalSlotIndex = 0; AsyncResult ar = new AsyncResult(null, ics, null); Message msg = Message.obtain(mUiccControllerUT, EVENT_GET_ICC_STATUS_DONE, ar); mUiccControllerUT.handleMessage(msg); Loading Loading @@ -325,6 +327,7 @@ public class UiccControllerTest extends TelephonyTest { ics.setUniversalPinState(3 /* disabled */); ics.atr = "abcdef0123456789abcdef"; ics.iccid = "123451234567890"; ics.physicalSlotIndex = 0; AsyncResult ar = new AsyncResult(null, ics, null); Message msg = Message.obtain(mUiccControllerUT, EVENT_GET_ICC_STATUS_DONE, ar); mUiccControllerUT.handleMessage(msg); Loading