Loading src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +21 −11 Original line number Diff line number Diff line Loading @@ -710,20 +710,25 @@ public class SubscriptionInfoUpdater extends Handler { } final EuiccProfileInfo[] embeddedProfiles; if (result.result == EuiccService.RESULT_OK) { embeddedProfiles = result.profiles; if (result.getResult() == EuiccService.RESULT_OK) { List<EuiccProfileInfo> list = result.getProfiles(); if (list == null || list.size() == 0) { embeddedProfiles = null; } else { logd("updatedEmbeddedSubscriptions: error " + result.result + " listing profiles"); embeddedProfiles = list.toArray(new EuiccProfileInfo[list.size()]); } } else { logd("updatedEmbeddedSubscriptions: error " + result.getResult() + " listing profiles"); // If there's an error listing profiles, treat it equivalently to a successful // listing which returned no profiles under the assumption that none are currently // accessible. embeddedProfiles = new EuiccProfileInfo[0]; } final boolean isRemovable = result.isRemovable; final boolean isRemovable = result.getIsRemovable(); final String[] embeddedIccids = new String[embeddedProfiles.length]; for (int i = 0; i < embeddedProfiles.length; i++) { embeddedIccids[i] = embeddedProfiles[i].iccid; embeddedIccids[i] = embeddedProfiles[i].getIccid(); } // Note that this only tracks whether we make any writes to the DB. It's possible this will Loading @@ -741,25 +746,30 @@ public class SubscriptionInfoUpdater extends Handler { ContentResolver contentResolver = mContext.getContentResolver(); for (EuiccProfileInfo embeddedProfile : embeddedProfiles) { int index = findSubscriptionInfoForIccid(existingSubscriptions, embeddedProfile.iccid); findSubscriptionInfoForIccid(existingSubscriptions, embeddedProfile.getIccid()); if (index < 0) { // No existing entry for this ICCID; create an empty one. SubscriptionController.getInstance().insertEmptySubInfoRecord( embeddedProfile.iccid, SubscriptionManager.SIM_NOT_INSERTED); embeddedProfile.getIccid(), SubscriptionManager.SIM_NOT_INSERTED); } else { existingSubscriptions.remove(index); } ContentValues values = new ContentValues(); values.put(SubscriptionManager.IS_EMBEDDED, 1); List<UiccAccessRule> ruleList = embeddedProfile.getUiccAccessRules(); boolean isRuleListEmpty = false; if (ruleList == null || ruleList.size() == 0) { isRuleListEmpty = true; } values.put(SubscriptionManager.ACCESS_RULES, embeddedProfile.accessRules == null ? null : UiccAccessRule.encodeRules(embeddedProfile.accessRules)); isRuleListEmpty ? null : UiccAccessRule.encodeRules( ruleList.toArray(new UiccAccessRule[ruleList.size()]))); values.put(SubscriptionManager.IS_REMOVABLE, isRemovable); values.put(SubscriptionManager.DISPLAY_NAME, embeddedProfile.nickname); values.put(SubscriptionManager.DISPLAY_NAME, embeddedProfile.getNickname()); values.put(SubscriptionManager.NAME_SOURCE, SubscriptionManager.NAME_SOURCE_USER_INPUT); hasChanges = true; contentResolver.update(SubscriptionManager.CONTENT_URI, values, SubscriptionManager.ICC_ID + "=\"" + embeddedProfile.iccid + "\"", null); SubscriptionManager.ICC_ID + "=\"" + embeddedProfile.getIccid() + "\"", null); // refresh Cached Active Subscription Info List SubscriptionController.getInstance().refreshCachedActiveSubscriptionInfoList(); Loading src/java/com/android/internal/telephony/euicc/EuiccController.java +23 −14 Original line number Diff line number Diff line Loading @@ -259,12 +259,12 @@ public class EuiccController extends IEuiccController.Stub { GetDownloadableSubscriptionMetadataResult result) { Intent extrasIntent = new Intent(); final int resultCode; switch (result.result) { switch (result.getResult()) { case EuiccService.RESULT_OK: resultCode = OK; extrasIntent.putExtra( EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTION, result.subscription); result.getDownloadableSubscription()); break; case EuiccService.RESULT_MUST_DEACTIVATE_SIM: resultCode = RESOLVABLE_ERROR; Loading @@ -278,7 +278,7 @@ public class EuiccController extends IEuiccController.Stub { resultCode = ERROR; extrasIntent.putExtra( EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE, result.result); result.getResult()); break; } Loading Loading @@ -346,7 +346,7 @@ public class EuiccController extends IEuiccController.Stub { @Override public void onGetMetadataComplete( GetDownloadableSubscriptionMetadataResult result) { if (result.result == EuiccService.RESULT_MUST_DEACTIVATE_SIM) { if (result.getResult() == EuiccService.RESULT_MUST_DEACTIVATE_SIM) { // If we need to deactivate the current SIM to even check permissions, go ahead and // require that the user resolve the stronger permission dialog. Intent extrasIntent = new Intent(); Loading @@ -360,14 +360,18 @@ public class EuiccController extends IEuiccController.Stub { return; } if (result.result != EuiccService.RESULT_OK) { if (result.getResult() != EuiccService.RESULT_OK) { // Just propagate the error as normal. super.onGetMetadataComplete(result); return; } DownloadableSubscription subscription = result.subscription; UiccAccessRule[] rules = subscription.getAccessRules(); DownloadableSubscription subscription = result.getDownloadableSubscription(); UiccAccessRule[] rules = null; List<UiccAccessRule> rulesList = subscription.getAccessRules(); if (rulesList != null) { rules = rulesList.toArray(new UiccAccessRule[rulesList.size()]); } if (rules == null) { Log.e(TAG, "No access rules but caller is unprivileged"); sendResult(mCallbackIntent, ERROR, null /* extrasIntent */); Loading Loading @@ -562,12 +566,15 @@ public class EuiccController extends IEuiccController.Stub { public void onGetDefaultListComplete(GetDefaultDownloadableSubscriptionListResult result) { Intent extrasIntent = new Intent(); final int resultCode; switch (result.result) { switch (result.getResult()) { case EuiccService.RESULT_OK: resultCode = OK; List<DownloadableSubscription> list = result.getDownloadableSubscriptions(); if (list != null && list.size() > 0) { extrasIntent.putExtra( EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTIONS, result.subscriptions); list.toArray(new DownloadableSubscription[list.size()])); } break; case EuiccService.RESULT_MUST_DEACTIVATE_SIM: resultCode = RESOLVABLE_ERROR; Loading @@ -582,7 +589,7 @@ public class EuiccController extends IEuiccController.Stub { resultCode = ERROR; extrasIntent.putExtra( EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE, result.result); result.getResult()); break; } Loading Loading @@ -711,7 +718,7 @@ public class EuiccController extends IEuiccController.Stub { return; } if (!callerCanWriteEmbeddedSubscriptions && !sub.canManageSubscription(mContext, callingPackage)) { && !mSubscriptionManager.canManageSubscription(sub, callingPackage)) { Log.e(TAG, "Not permitted to switch to subscription: " + subscriptionId); sendResult(callbackIntent, ERROR, null /* extrasIntent */); return; Loading Loading @@ -1063,7 +1070,9 @@ public class EuiccController extends IEuiccController.Stub { int size = subInfoList.size(); for (int subIndex = 0; subIndex < size; subIndex++) { SubscriptionInfo subInfo = subInfoList.get(subIndex); if (subInfo.isEmbedded() && subInfo.canManageSubscription(mContext, callingPackage)) { if (subInfo.isEmbedded() && mSubscriptionManager.canManageSubscription(subInfo, callingPackage)) { return true; } } Loading src/java/com/android/internal/telephony/euicc/EuiccOperation.java +7 −7 Original line number Diff line number Diff line Loading @@ -207,37 +207,37 @@ public class EuiccOperation implements Parcelable { switch (mAction) { case ACTION_GET_METADATA_DEACTIVATE_SIM: resolvedGetMetadataDeactivateSim( resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), callbackIntent); break; case ACTION_DOWNLOAD_DEACTIVATE_SIM: resolvedDownloadDeactivateSim( resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), callbackIntent); break; case ACTION_DOWNLOAD_NO_PRIVILEGES: resolvedDownloadNoPrivileges( resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), callbackIntent); break; case ACTION_DOWNLOAD_CONFIRMATION_CODE: resolvedDownloadConfirmationCode( resolutionExtras.getString(EuiccService.RESOLUTION_EXTRA_CONFIRMATION_CODE), resolutionExtras.getString(EuiccService.EXTRA_RESOLUTION_CONFIRMATION_CODE), callbackIntent); break; case ACTION_GET_DEFAULT_LIST_DEACTIVATE_SIM: resolvedGetDefaultListDeactivateSim( resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), callbackIntent); break; case ACTION_SWITCH_DEACTIVATE_SIM: resolvedSwitchDeactivateSim( resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), callbackIntent); break; case ACTION_SWITCH_NO_PRIVILEGES: resolvedSwitchNoPrivileges( resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), callbackIntent); break; default: Loading src/java/com/android/internal/telephony/uicc/euicc/EuiccCard.java +16 −8 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ import com.android.internal.telephony.uicc.euicc.apdu.RequestProvider; import com.android.internal.telephony.uicc.euicc.async.AsyncResultCallback; import com.android.internal.telephony.uicc.euicc.async.AsyncResultHelper; import java.util.Arrays; import java.util.List; /** Loading Loading @@ -189,7 +190,10 @@ public class EuiccCard extends UiccCard { loge("Profile must have an ICCID."); continue; } EuiccProfileInfo.Builder profileBuilder = new EuiccProfileInfo.Builder(); String strippedIccIdString = stripTrailingFs(profileNode.getChild(Tags.TAG_ICCID).asBytes()); EuiccProfileInfo.Builder profileBuilder = new EuiccProfileInfo.Builder(strippedIccIdString); buildProfile(profileNode, profileBuilder); EuiccProfileInfo profile = profileBuilder.build(); Loading Loading @@ -222,7 +226,10 @@ public class EuiccCard extends UiccCard { return null; } Asn1Node profileNode = profileNodes.get(0); EuiccProfileInfo.Builder profileBuilder = new EuiccProfileInfo.Builder(); String strippedIccIdString = stripTrailingFs(profileNode.getChild(Tags.TAG_ICCID).asBytes()); EuiccProfileInfo.Builder profileBuilder = new EuiccProfileInfo.Builder(strippedIccIdString); buildProfile(profileNode, profileBuilder); return profileBuilder.build(); }, Loading Loading @@ -512,7 +519,7 @@ public class EuiccCard extends UiccCard { for (int j = 0; j < opIdSize; j++) { opIds[j] = buildCarrierIdentifier(opIdNodes.get(j)); } builder.add(node.getChild(Tags.TAG_CTX_0).asBits(), opIds, builder.add(node.getChild(Tags.TAG_CTX_0).asBits(), Arrays.asList(opIds), node.getChild(Tags.TAG_CTX_2).asBits()); } return builder.build(); Loading Loading @@ -977,10 +984,6 @@ public class EuiccCard extends UiccCard { private static void buildProfile(Asn1Node profileNode, EuiccProfileInfo.Builder profileBuilder) throws TagNotFoundException, InvalidAsn1DataException { String strippedIccIdString = stripTrailingFs(profileNode.getChild(Tags.TAG_ICCID).asBytes()); profileBuilder.setIccid(strippedIccIdString); if (profileNode.hasChild(Tags.TAG_NICKNAME)) { profileBuilder.setNickname(profileNode.getChild(Tags.TAG_NICKNAME).asString()); } Loading Loading @@ -1024,7 +1027,12 @@ public class EuiccCard extends UiccCard { if (profileNode.hasChild(Tags.TAG_CARRIER_PRIVILEGE_RULES)) { List<Asn1Node> refArDoNodes = profileNode.getChild(Tags.TAG_CARRIER_PRIVILEGE_RULES) .getChildren(Tags.TAG_REF_AR_DO); profileBuilder.setUiccAccessRule(buildUiccAccessRule(refArDoNodes)); UiccAccessRule[] rules = buildUiccAccessRule(refArDoNodes); List<UiccAccessRule> rulesList = null; if (rules != null) { rulesList = Arrays.asList(rules); } profileBuilder.setUiccAccessRule(rulesList); } } Loading tests/telephonytests/src/com/android/internal/telephony/euicc/EuiccControllerTest.java +8 −2 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ import org.mockito.stubbing.Stubber; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Arrays; import java.util.Collections; @RunWith(AndroidJUnit4.class) Loading Loading @@ -100,7 +101,8 @@ public class EuiccControllerTest extends TelephonyTest { DownloadableSubscription.forActivationCode("abcde"); static { SUBSCRIPTION_WITH_METADATA.setCarrierName("test name"); SUBSCRIPTION_WITH_METADATA.setAccessRules(new UiccAccessRule[] { ACCESS_RULE }); SUBSCRIPTION_WITH_METADATA.setAccessRules( Arrays.asList(new UiccAccessRule[] { ACCESS_RULE })); } private static final String OS_VERSION = "1.0"; Loading Loading @@ -264,7 +266,7 @@ public class EuiccControllerTest extends TelephonyTest { @Test public void testGetEuiccInfo_success() { assertEquals(OS_VERSION, callGetEuiccInfo(true /* success */, EUICC_INFO).osVersion); assertEquals(OS_VERSION, callGetEuiccInfo(true /* success */, EUICC_INFO).getOsVersion()); } @Test Loading Loading @@ -837,6 +839,8 @@ public class EuiccControllerTest extends TelephonyTest { SubscriptionInfo subInfo = new SubscriptionInfo( 0, "", 0, "", "", 0, 0, "", 0, null, 0, 0, "", true /* isEmbedded */, hasPrivileges ? new UiccAccessRule[] { ACCESS_RULE } : null); when(mSubscriptionManager.canManageSubscription(subInfo, PACKAGE_NAME)).thenReturn( hasPrivileges); when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn( Collections.singletonList(subInfo)); } Loading @@ -845,6 +849,8 @@ public class EuiccControllerTest extends TelephonyTest { SubscriptionInfo subInfo = new SubscriptionInfo( SUBSCRIPTION_ID, ICC_ID, 0, "", "", 0, 0, "", 0, null, 0, 0, "", true /* isEmbedded */, hasPrivileges ? new UiccAccessRule[] { ACCESS_RULE } : null); when(mSubscriptionManager.canManageSubscription(subInfo, PACKAGE_NAME)).thenReturn( hasPrivileges); when(mSubscriptionManager.getAvailableSubscriptionInfoList()).thenReturn( Collections.singletonList(subInfo)); } Loading Loading
src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +21 −11 Original line number Diff line number Diff line Loading @@ -710,20 +710,25 @@ public class SubscriptionInfoUpdater extends Handler { } final EuiccProfileInfo[] embeddedProfiles; if (result.result == EuiccService.RESULT_OK) { embeddedProfiles = result.profiles; if (result.getResult() == EuiccService.RESULT_OK) { List<EuiccProfileInfo> list = result.getProfiles(); if (list == null || list.size() == 0) { embeddedProfiles = null; } else { logd("updatedEmbeddedSubscriptions: error " + result.result + " listing profiles"); embeddedProfiles = list.toArray(new EuiccProfileInfo[list.size()]); } } else { logd("updatedEmbeddedSubscriptions: error " + result.getResult() + " listing profiles"); // If there's an error listing profiles, treat it equivalently to a successful // listing which returned no profiles under the assumption that none are currently // accessible. embeddedProfiles = new EuiccProfileInfo[0]; } final boolean isRemovable = result.isRemovable; final boolean isRemovable = result.getIsRemovable(); final String[] embeddedIccids = new String[embeddedProfiles.length]; for (int i = 0; i < embeddedProfiles.length; i++) { embeddedIccids[i] = embeddedProfiles[i].iccid; embeddedIccids[i] = embeddedProfiles[i].getIccid(); } // Note that this only tracks whether we make any writes to the DB. It's possible this will Loading @@ -741,25 +746,30 @@ public class SubscriptionInfoUpdater extends Handler { ContentResolver contentResolver = mContext.getContentResolver(); for (EuiccProfileInfo embeddedProfile : embeddedProfiles) { int index = findSubscriptionInfoForIccid(existingSubscriptions, embeddedProfile.iccid); findSubscriptionInfoForIccid(existingSubscriptions, embeddedProfile.getIccid()); if (index < 0) { // No existing entry for this ICCID; create an empty one. SubscriptionController.getInstance().insertEmptySubInfoRecord( embeddedProfile.iccid, SubscriptionManager.SIM_NOT_INSERTED); embeddedProfile.getIccid(), SubscriptionManager.SIM_NOT_INSERTED); } else { existingSubscriptions.remove(index); } ContentValues values = new ContentValues(); values.put(SubscriptionManager.IS_EMBEDDED, 1); List<UiccAccessRule> ruleList = embeddedProfile.getUiccAccessRules(); boolean isRuleListEmpty = false; if (ruleList == null || ruleList.size() == 0) { isRuleListEmpty = true; } values.put(SubscriptionManager.ACCESS_RULES, embeddedProfile.accessRules == null ? null : UiccAccessRule.encodeRules(embeddedProfile.accessRules)); isRuleListEmpty ? null : UiccAccessRule.encodeRules( ruleList.toArray(new UiccAccessRule[ruleList.size()]))); values.put(SubscriptionManager.IS_REMOVABLE, isRemovable); values.put(SubscriptionManager.DISPLAY_NAME, embeddedProfile.nickname); values.put(SubscriptionManager.DISPLAY_NAME, embeddedProfile.getNickname()); values.put(SubscriptionManager.NAME_SOURCE, SubscriptionManager.NAME_SOURCE_USER_INPUT); hasChanges = true; contentResolver.update(SubscriptionManager.CONTENT_URI, values, SubscriptionManager.ICC_ID + "=\"" + embeddedProfile.iccid + "\"", null); SubscriptionManager.ICC_ID + "=\"" + embeddedProfile.getIccid() + "\"", null); // refresh Cached Active Subscription Info List SubscriptionController.getInstance().refreshCachedActiveSubscriptionInfoList(); Loading
src/java/com/android/internal/telephony/euicc/EuiccController.java +23 −14 Original line number Diff line number Diff line Loading @@ -259,12 +259,12 @@ public class EuiccController extends IEuiccController.Stub { GetDownloadableSubscriptionMetadataResult result) { Intent extrasIntent = new Intent(); final int resultCode; switch (result.result) { switch (result.getResult()) { case EuiccService.RESULT_OK: resultCode = OK; extrasIntent.putExtra( EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTION, result.subscription); result.getDownloadableSubscription()); break; case EuiccService.RESULT_MUST_DEACTIVATE_SIM: resultCode = RESOLVABLE_ERROR; Loading @@ -278,7 +278,7 @@ public class EuiccController extends IEuiccController.Stub { resultCode = ERROR; extrasIntent.putExtra( EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE, result.result); result.getResult()); break; } Loading Loading @@ -346,7 +346,7 @@ public class EuiccController extends IEuiccController.Stub { @Override public void onGetMetadataComplete( GetDownloadableSubscriptionMetadataResult result) { if (result.result == EuiccService.RESULT_MUST_DEACTIVATE_SIM) { if (result.getResult() == EuiccService.RESULT_MUST_DEACTIVATE_SIM) { // If we need to deactivate the current SIM to even check permissions, go ahead and // require that the user resolve the stronger permission dialog. Intent extrasIntent = new Intent(); Loading @@ -360,14 +360,18 @@ public class EuiccController extends IEuiccController.Stub { return; } if (result.result != EuiccService.RESULT_OK) { if (result.getResult() != EuiccService.RESULT_OK) { // Just propagate the error as normal. super.onGetMetadataComplete(result); return; } DownloadableSubscription subscription = result.subscription; UiccAccessRule[] rules = subscription.getAccessRules(); DownloadableSubscription subscription = result.getDownloadableSubscription(); UiccAccessRule[] rules = null; List<UiccAccessRule> rulesList = subscription.getAccessRules(); if (rulesList != null) { rules = rulesList.toArray(new UiccAccessRule[rulesList.size()]); } if (rules == null) { Log.e(TAG, "No access rules but caller is unprivileged"); sendResult(mCallbackIntent, ERROR, null /* extrasIntent */); Loading Loading @@ -562,12 +566,15 @@ public class EuiccController extends IEuiccController.Stub { public void onGetDefaultListComplete(GetDefaultDownloadableSubscriptionListResult result) { Intent extrasIntent = new Intent(); final int resultCode; switch (result.result) { switch (result.getResult()) { case EuiccService.RESULT_OK: resultCode = OK; List<DownloadableSubscription> list = result.getDownloadableSubscriptions(); if (list != null && list.size() > 0) { extrasIntent.putExtra( EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTIONS, result.subscriptions); list.toArray(new DownloadableSubscription[list.size()])); } break; case EuiccService.RESULT_MUST_DEACTIVATE_SIM: resultCode = RESOLVABLE_ERROR; Loading @@ -582,7 +589,7 @@ public class EuiccController extends IEuiccController.Stub { resultCode = ERROR; extrasIntent.putExtra( EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE, result.result); result.getResult()); break; } Loading Loading @@ -711,7 +718,7 @@ public class EuiccController extends IEuiccController.Stub { return; } if (!callerCanWriteEmbeddedSubscriptions && !sub.canManageSubscription(mContext, callingPackage)) { && !mSubscriptionManager.canManageSubscription(sub, callingPackage)) { Log.e(TAG, "Not permitted to switch to subscription: " + subscriptionId); sendResult(callbackIntent, ERROR, null /* extrasIntent */); return; Loading Loading @@ -1063,7 +1070,9 @@ public class EuiccController extends IEuiccController.Stub { int size = subInfoList.size(); for (int subIndex = 0; subIndex < size; subIndex++) { SubscriptionInfo subInfo = subInfoList.get(subIndex); if (subInfo.isEmbedded() && subInfo.canManageSubscription(mContext, callingPackage)) { if (subInfo.isEmbedded() && mSubscriptionManager.canManageSubscription(subInfo, callingPackage)) { return true; } } Loading
src/java/com/android/internal/telephony/euicc/EuiccOperation.java +7 −7 Original line number Diff line number Diff line Loading @@ -207,37 +207,37 @@ public class EuiccOperation implements Parcelable { switch (mAction) { case ACTION_GET_METADATA_DEACTIVATE_SIM: resolvedGetMetadataDeactivateSim( resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), callbackIntent); break; case ACTION_DOWNLOAD_DEACTIVATE_SIM: resolvedDownloadDeactivateSim( resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), callbackIntent); break; case ACTION_DOWNLOAD_NO_PRIVILEGES: resolvedDownloadNoPrivileges( resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), callbackIntent); break; case ACTION_DOWNLOAD_CONFIRMATION_CODE: resolvedDownloadConfirmationCode( resolutionExtras.getString(EuiccService.RESOLUTION_EXTRA_CONFIRMATION_CODE), resolutionExtras.getString(EuiccService.EXTRA_RESOLUTION_CONFIRMATION_CODE), callbackIntent); break; case ACTION_GET_DEFAULT_LIST_DEACTIVATE_SIM: resolvedGetDefaultListDeactivateSim( resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), callbackIntent); break; case ACTION_SWITCH_DEACTIVATE_SIM: resolvedSwitchDeactivateSim( resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), callbackIntent); break; case ACTION_SWITCH_NO_PRIVILEGES: resolvedSwitchNoPrivileges( resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), callbackIntent); break; default: Loading
src/java/com/android/internal/telephony/uicc/euicc/EuiccCard.java +16 −8 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ import com.android.internal.telephony.uicc.euicc.apdu.RequestProvider; import com.android.internal.telephony.uicc.euicc.async.AsyncResultCallback; import com.android.internal.telephony.uicc.euicc.async.AsyncResultHelper; import java.util.Arrays; import java.util.List; /** Loading Loading @@ -189,7 +190,10 @@ public class EuiccCard extends UiccCard { loge("Profile must have an ICCID."); continue; } EuiccProfileInfo.Builder profileBuilder = new EuiccProfileInfo.Builder(); String strippedIccIdString = stripTrailingFs(profileNode.getChild(Tags.TAG_ICCID).asBytes()); EuiccProfileInfo.Builder profileBuilder = new EuiccProfileInfo.Builder(strippedIccIdString); buildProfile(profileNode, profileBuilder); EuiccProfileInfo profile = profileBuilder.build(); Loading Loading @@ -222,7 +226,10 @@ public class EuiccCard extends UiccCard { return null; } Asn1Node profileNode = profileNodes.get(0); EuiccProfileInfo.Builder profileBuilder = new EuiccProfileInfo.Builder(); String strippedIccIdString = stripTrailingFs(profileNode.getChild(Tags.TAG_ICCID).asBytes()); EuiccProfileInfo.Builder profileBuilder = new EuiccProfileInfo.Builder(strippedIccIdString); buildProfile(profileNode, profileBuilder); return profileBuilder.build(); }, Loading Loading @@ -512,7 +519,7 @@ public class EuiccCard extends UiccCard { for (int j = 0; j < opIdSize; j++) { opIds[j] = buildCarrierIdentifier(opIdNodes.get(j)); } builder.add(node.getChild(Tags.TAG_CTX_0).asBits(), opIds, builder.add(node.getChild(Tags.TAG_CTX_0).asBits(), Arrays.asList(opIds), node.getChild(Tags.TAG_CTX_2).asBits()); } return builder.build(); Loading Loading @@ -977,10 +984,6 @@ public class EuiccCard extends UiccCard { private static void buildProfile(Asn1Node profileNode, EuiccProfileInfo.Builder profileBuilder) throws TagNotFoundException, InvalidAsn1DataException { String strippedIccIdString = stripTrailingFs(profileNode.getChild(Tags.TAG_ICCID).asBytes()); profileBuilder.setIccid(strippedIccIdString); if (profileNode.hasChild(Tags.TAG_NICKNAME)) { profileBuilder.setNickname(profileNode.getChild(Tags.TAG_NICKNAME).asString()); } Loading Loading @@ -1024,7 +1027,12 @@ public class EuiccCard extends UiccCard { if (profileNode.hasChild(Tags.TAG_CARRIER_PRIVILEGE_RULES)) { List<Asn1Node> refArDoNodes = profileNode.getChild(Tags.TAG_CARRIER_PRIVILEGE_RULES) .getChildren(Tags.TAG_REF_AR_DO); profileBuilder.setUiccAccessRule(buildUiccAccessRule(refArDoNodes)); UiccAccessRule[] rules = buildUiccAccessRule(refArDoNodes); List<UiccAccessRule> rulesList = null; if (rules != null) { rulesList = Arrays.asList(rules); } profileBuilder.setUiccAccessRule(rulesList); } } Loading
tests/telephonytests/src/com/android/internal/telephony/euicc/EuiccControllerTest.java +8 −2 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ import org.mockito.stubbing.Stubber; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Arrays; import java.util.Collections; @RunWith(AndroidJUnit4.class) Loading Loading @@ -100,7 +101,8 @@ public class EuiccControllerTest extends TelephonyTest { DownloadableSubscription.forActivationCode("abcde"); static { SUBSCRIPTION_WITH_METADATA.setCarrierName("test name"); SUBSCRIPTION_WITH_METADATA.setAccessRules(new UiccAccessRule[] { ACCESS_RULE }); SUBSCRIPTION_WITH_METADATA.setAccessRules( Arrays.asList(new UiccAccessRule[] { ACCESS_RULE })); } private static final String OS_VERSION = "1.0"; Loading Loading @@ -264,7 +266,7 @@ public class EuiccControllerTest extends TelephonyTest { @Test public void testGetEuiccInfo_success() { assertEquals(OS_VERSION, callGetEuiccInfo(true /* success */, EUICC_INFO).osVersion); assertEquals(OS_VERSION, callGetEuiccInfo(true /* success */, EUICC_INFO).getOsVersion()); } @Test Loading Loading @@ -837,6 +839,8 @@ public class EuiccControllerTest extends TelephonyTest { SubscriptionInfo subInfo = new SubscriptionInfo( 0, "", 0, "", "", 0, 0, "", 0, null, 0, 0, "", true /* isEmbedded */, hasPrivileges ? new UiccAccessRule[] { ACCESS_RULE } : null); when(mSubscriptionManager.canManageSubscription(subInfo, PACKAGE_NAME)).thenReturn( hasPrivileges); when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn( Collections.singletonList(subInfo)); } Loading @@ -845,6 +849,8 @@ public class EuiccControllerTest extends TelephonyTest { SubscriptionInfo subInfo = new SubscriptionInfo( SUBSCRIPTION_ID, ICC_ID, 0, "", "", 0, 0, "", 0, null, 0, 0, "", true /* isEmbedded */, hasPrivileges ? new UiccAccessRule[] { ACCESS_RULE } : null); when(mSubscriptionManager.canManageSubscription(subInfo, PACKAGE_NAME)).thenReturn( hasPrivileges); when(mSubscriptionManager.getAvailableSubscriptionInfoList()).thenReturn( Collections.singletonList(subInfo)); } Loading