Loading src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +11 −21 Original line number Diff line number Diff line Loading @@ -710,25 +710,20 @@ public class SubscriptionInfoUpdater extends Handler { } final EuiccProfileInfo[] embeddedProfiles; if (result.getResult() == EuiccService.RESULT_OK) { List<EuiccProfileInfo> list = result.getProfiles(); if (list == null || list.size() == 0) { embeddedProfiles = null; if (result.result == EuiccService.RESULT_OK) { embeddedProfiles = result.profiles; } else { embeddedProfiles = list.toArray(new EuiccProfileInfo[list.size()]); } } else { logd("updatedEmbeddedSubscriptions: error " + result.getResult() + " listing profiles"); logd("updatedEmbeddedSubscriptions: error " + result.result + " 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.getIsRemovable(); final boolean isRemovable = result.isRemovable; final String[] embeddedIccids = new String[embeddedProfiles.length]; for (int i = 0; i < embeddedProfiles.length; i++) { embeddedIccids[i] = embeddedProfiles[i].getIccid(); embeddedIccids[i] = embeddedProfiles[i].iccid; } // Note that this only tracks whether we make any writes to the DB. It's possible this will Loading @@ -746,30 +741,25 @@ public class SubscriptionInfoUpdater extends Handler { ContentResolver contentResolver = mContext.getContentResolver(); for (EuiccProfileInfo embeddedProfile : embeddedProfiles) { int index = findSubscriptionInfoForIccid(existingSubscriptions, embeddedProfile.getIccid()); findSubscriptionInfoForIccid(existingSubscriptions, embeddedProfile.iccid); if (index < 0) { // No existing entry for this ICCID; create an empty one. SubscriptionController.getInstance().insertEmptySubInfoRecord( embeddedProfile.getIccid(), SubscriptionManager.SIM_NOT_INSERTED); embeddedProfile.iccid, 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, isRuleListEmpty ? null : UiccAccessRule.encodeRules( ruleList.toArray(new UiccAccessRule[ruleList.size()]))); embeddedProfile.accessRules == null ? null : UiccAccessRule.encodeRules(embeddedProfile.accessRules)); values.put(SubscriptionManager.IS_REMOVABLE, isRemovable); values.put(SubscriptionManager.DISPLAY_NAME, embeddedProfile.getNickname()); values.put(SubscriptionManager.DISPLAY_NAME, embeddedProfile.nickname); values.put(SubscriptionManager.NAME_SOURCE, SubscriptionManager.NAME_SOURCE_USER_INPUT); hasChanges = true; contentResolver.update(SubscriptionManager.CONTENT_URI, values, SubscriptionManager.ICC_ID + "=\"" + embeddedProfile.getIccid() + "\"", null); SubscriptionManager.ICC_ID + "=\"" + embeddedProfile.iccid + "\"", null); // refresh Cached Active Subscription Info List SubscriptionController.getInstance().refreshCachedActiveSubscriptionInfoList(); Loading src/java/com/android/internal/telephony/euicc/EuiccController.java +14 −23 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.getResult()) { switch (result.result) { case EuiccService.RESULT_OK: resultCode = OK; extrasIntent.putExtra( EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTION, result.getDownloadableSubscription()); result.subscription); 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.getResult()); result.result); break; } Loading Loading @@ -346,7 +346,7 @@ public class EuiccController extends IEuiccController.Stub { @Override public void onGetMetadataComplete( GetDownloadableSubscriptionMetadataResult result) { if (result.getResult() == EuiccService.RESULT_MUST_DEACTIVATE_SIM) { if (result.result == 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,18 +360,14 @@ public class EuiccController extends IEuiccController.Stub { return; } if (result.getResult() != EuiccService.RESULT_OK) { if (result.result != EuiccService.RESULT_OK) { // Just propagate the error as normal. super.onGetMetadataComplete(result); return; } DownloadableSubscription subscription = result.getDownloadableSubscription(); UiccAccessRule[] rules = null; List<UiccAccessRule> rulesList = subscription.getAccessRules(); if (rulesList != null) { rules = rulesList.toArray(new UiccAccessRule[rulesList.size()]); } DownloadableSubscription subscription = result.subscription; UiccAccessRule[] rules = subscription.getAccessRules(); if (rules == null) { Log.e(TAG, "No access rules but caller is unprivileged"); sendResult(mCallbackIntent, ERROR, null /* extrasIntent */); Loading Loading @@ -566,15 +562,12 @@ public class EuiccController extends IEuiccController.Stub { public void onGetDefaultListComplete(GetDefaultDownloadableSubscriptionListResult result) { Intent extrasIntent = new Intent(); final int resultCode; switch (result.getResult()) { switch (result.result) { 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, list.toArray(new DownloadableSubscription[list.size()])); } result.subscriptions); break; case EuiccService.RESULT_MUST_DEACTIVATE_SIM: resultCode = RESOLVABLE_ERROR; Loading @@ -589,7 +582,7 @@ public class EuiccController extends IEuiccController.Stub { resultCode = ERROR; extrasIntent.putExtra( EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE, result.getResult()); result.result); break; } Loading Loading @@ -718,7 +711,7 @@ public class EuiccController extends IEuiccController.Stub { return; } if (!callerCanWriteEmbeddedSubscriptions && !mSubscriptionManager.canManageSubscription(sub, callingPackage)) { && !sub.canManageSubscription(mContext, callingPackage)) { Log.e(TAG, "Not permitted to switch to subscription: " + subscriptionId); sendResult(callbackIntent, ERROR, null /* extrasIntent */); return; Loading Loading @@ -1070,9 +1063,7 @@ 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() && mSubscriptionManager.canManageSubscription(subInfo, callingPackage)) { if (subInfo.isEmbedded() && subInfo.canManageSubscription(mContext, 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.EXTRA_RESOLUTION_CONSENT), resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), callbackIntent); break; case ACTION_DOWNLOAD_DEACTIVATE_SIM: resolvedDownloadDeactivateSim( resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), callbackIntent); break; case ACTION_DOWNLOAD_NO_PRIVILEGES: resolvedDownloadNoPrivileges( resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), callbackIntent); break; case ACTION_DOWNLOAD_CONFIRMATION_CODE: resolvedDownloadConfirmationCode( resolutionExtras.getString(EuiccService.EXTRA_RESOLUTION_CONFIRMATION_CODE), resolutionExtras.getString(EuiccService.RESOLUTION_EXTRA_CONFIRMATION_CODE), callbackIntent); break; case ACTION_GET_DEFAULT_LIST_DEACTIVATE_SIM: resolvedGetDefaultListDeactivateSim( resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), callbackIntent); break; case ACTION_SWITCH_DEACTIVATE_SIM: resolvedSwitchDeactivateSim( resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), callbackIntent); break; case ACTION_SWITCH_NO_PRIVILEGES: resolvedSwitchNoPrivileges( resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), callbackIntent); break; default: Loading src/java/com/android/internal/telephony/uicc/euicc/EuiccCard.java +8 −16 Original line number Diff line number Diff line Loading @@ -51,7 +51,6 @@ 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 @@ -190,10 +189,7 @@ public class EuiccCard extends UiccCard { loge("Profile must have an ICCID."); continue; } String strippedIccIdString = stripTrailingFs(profileNode.getChild(Tags.TAG_ICCID).asBytes()); EuiccProfileInfo.Builder profileBuilder = new EuiccProfileInfo.Builder(strippedIccIdString); EuiccProfileInfo.Builder profileBuilder = new EuiccProfileInfo.Builder(); buildProfile(profileNode, profileBuilder); EuiccProfileInfo profile = profileBuilder.build(); Loading Loading @@ -226,10 +222,7 @@ public class EuiccCard extends UiccCard { return null; } Asn1Node profileNode = profileNodes.get(0); String strippedIccIdString = stripTrailingFs(profileNode.getChild(Tags.TAG_ICCID).asBytes()); EuiccProfileInfo.Builder profileBuilder = new EuiccProfileInfo.Builder(strippedIccIdString); EuiccProfileInfo.Builder profileBuilder = new EuiccProfileInfo.Builder(); buildProfile(profileNode, profileBuilder); return profileBuilder.build(); }, Loading Loading @@ -519,7 +512,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(), Arrays.asList(opIds), builder.add(node.getChild(Tags.TAG_CTX_0).asBits(), opIds, node.getChild(Tags.TAG_CTX_2).asBits()); } return builder.build(); Loading Loading @@ -984,6 +977,10 @@ 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 @@ -1027,12 +1024,7 @@ 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); UiccAccessRule[] rules = buildUiccAccessRule(refArDoNodes); List<UiccAccessRule> rulesList = null; if (rules != null) { rulesList = Arrays.asList(rules); } profileBuilder.setUiccAccessRule(rulesList); profileBuilder.setUiccAccessRule(buildUiccAccessRule(refArDoNodes)); } } Loading tests/telephonytests/src/com/android/internal/telephony/euicc/EuiccControllerTest.java +2 −8 Original line number Diff line number Diff line Loading @@ -73,7 +73,6 @@ 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 @@ -101,8 +100,7 @@ public class EuiccControllerTest extends TelephonyTest { DownloadableSubscription.forActivationCode("abcde"); static { SUBSCRIPTION_WITH_METADATA.setCarrierName("test name"); SUBSCRIPTION_WITH_METADATA.setAccessRules( Arrays.asList(new UiccAccessRule[] { ACCESS_RULE })); SUBSCRIPTION_WITH_METADATA.setAccessRules(new UiccAccessRule[] { ACCESS_RULE }); } private static final String OS_VERSION = "1.0"; Loading Loading @@ -266,7 +264,7 @@ public class EuiccControllerTest extends TelephonyTest { @Test public void testGetEuiccInfo_success() { assertEquals(OS_VERSION, callGetEuiccInfo(true /* success */, EUICC_INFO).getOsVersion()); assertEquals(OS_VERSION, callGetEuiccInfo(true /* success */, EUICC_INFO).osVersion); } @Test Loading Loading @@ -839,8 +837,6 @@ 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 @@ -849,8 +845,6 @@ 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 +11 −21 Original line number Diff line number Diff line Loading @@ -710,25 +710,20 @@ public class SubscriptionInfoUpdater extends Handler { } final EuiccProfileInfo[] embeddedProfiles; if (result.getResult() == EuiccService.RESULT_OK) { List<EuiccProfileInfo> list = result.getProfiles(); if (list == null || list.size() == 0) { embeddedProfiles = null; if (result.result == EuiccService.RESULT_OK) { embeddedProfiles = result.profiles; } else { embeddedProfiles = list.toArray(new EuiccProfileInfo[list.size()]); } } else { logd("updatedEmbeddedSubscriptions: error " + result.getResult() + " listing profiles"); logd("updatedEmbeddedSubscriptions: error " + result.result + " 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.getIsRemovable(); final boolean isRemovable = result.isRemovable; final String[] embeddedIccids = new String[embeddedProfiles.length]; for (int i = 0; i < embeddedProfiles.length; i++) { embeddedIccids[i] = embeddedProfiles[i].getIccid(); embeddedIccids[i] = embeddedProfiles[i].iccid; } // Note that this only tracks whether we make any writes to the DB. It's possible this will Loading @@ -746,30 +741,25 @@ public class SubscriptionInfoUpdater extends Handler { ContentResolver contentResolver = mContext.getContentResolver(); for (EuiccProfileInfo embeddedProfile : embeddedProfiles) { int index = findSubscriptionInfoForIccid(existingSubscriptions, embeddedProfile.getIccid()); findSubscriptionInfoForIccid(existingSubscriptions, embeddedProfile.iccid); if (index < 0) { // No existing entry for this ICCID; create an empty one. SubscriptionController.getInstance().insertEmptySubInfoRecord( embeddedProfile.getIccid(), SubscriptionManager.SIM_NOT_INSERTED); embeddedProfile.iccid, 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, isRuleListEmpty ? null : UiccAccessRule.encodeRules( ruleList.toArray(new UiccAccessRule[ruleList.size()]))); embeddedProfile.accessRules == null ? null : UiccAccessRule.encodeRules(embeddedProfile.accessRules)); values.put(SubscriptionManager.IS_REMOVABLE, isRemovable); values.put(SubscriptionManager.DISPLAY_NAME, embeddedProfile.getNickname()); values.put(SubscriptionManager.DISPLAY_NAME, embeddedProfile.nickname); values.put(SubscriptionManager.NAME_SOURCE, SubscriptionManager.NAME_SOURCE_USER_INPUT); hasChanges = true; contentResolver.update(SubscriptionManager.CONTENT_URI, values, SubscriptionManager.ICC_ID + "=\"" + embeddedProfile.getIccid() + "\"", null); SubscriptionManager.ICC_ID + "=\"" + embeddedProfile.iccid + "\"", null); // refresh Cached Active Subscription Info List SubscriptionController.getInstance().refreshCachedActiveSubscriptionInfoList(); Loading
src/java/com/android/internal/telephony/euicc/EuiccController.java +14 −23 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.getResult()) { switch (result.result) { case EuiccService.RESULT_OK: resultCode = OK; extrasIntent.putExtra( EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTION, result.getDownloadableSubscription()); result.subscription); 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.getResult()); result.result); break; } Loading Loading @@ -346,7 +346,7 @@ public class EuiccController extends IEuiccController.Stub { @Override public void onGetMetadataComplete( GetDownloadableSubscriptionMetadataResult result) { if (result.getResult() == EuiccService.RESULT_MUST_DEACTIVATE_SIM) { if (result.result == 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,18 +360,14 @@ public class EuiccController extends IEuiccController.Stub { return; } if (result.getResult() != EuiccService.RESULT_OK) { if (result.result != EuiccService.RESULT_OK) { // Just propagate the error as normal. super.onGetMetadataComplete(result); return; } DownloadableSubscription subscription = result.getDownloadableSubscription(); UiccAccessRule[] rules = null; List<UiccAccessRule> rulesList = subscription.getAccessRules(); if (rulesList != null) { rules = rulesList.toArray(new UiccAccessRule[rulesList.size()]); } DownloadableSubscription subscription = result.subscription; UiccAccessRule[] rules = subscription.getAccessRules(); if (rules == null) { Log.e(TAG, "No access rules but caller is unprivileged"); sendResult(mCallbackIntent, ERROR, null /* extrasIntent */); Loading Loading @@ -566,15 +562,12 @@ public class EuiccController extends IEuiccController.Stub { public void onGetDefaultListComplete(GetDefaultDownloadableSubscriptionListResult result) { Intent extrasIntent = new Intent(); final int resultCode; switch (result.getResult()) { switch (result.result) { 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, list.toArray(new DownloadableSubscription[list.size()])); } result.subscriptions); break; case EuiccService.RESULT_MUST_DEACTIVATE_SIM: resultCode = RESOLVABLE_ERROR; Loading @@ -589,7 +582,7 @@ public class EuiccController extends IEuiccController.Stub { resultCode = ERROR; extrasIntent.putExtra( EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE, result.getResult()); result.result); break; } Loading Loading @@ -718,7 +711,7 @@ public class EuiccController extends IEuiccController.Stub { return; } if (!callerCanWriteEmbeddedSubscriptions && !mSubscriptionManager.canManageSubscription(sub, callingPackage)) { && !sub.canManageSubscription(mContext, callingPackage)) { Log.e(TAG, "Not permitted to switch to subscription: " + subscriptionId); sendResult(callbackIntent, ERROR, null /* extrasIntent */); return; Loading Loading @@ -1070,9 +1063,7 @@ 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() && mSubscriptionManager.canManageSubscription(subInfo, callingPackage)) { if (subInfo.isEmbedded() && subInfo.canManageSubscription(mContext, 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.EXTRA_RESOLUTION_CONSENT), resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), callbackIntent); break; case ACTION_DOWNLOAD_DEACTIVATE_SIM: resolvedDownloadDeactivateSim( resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), callbackIntent); break; case ACTION_DOWNLOAD_NO_PRIVILEGES: resolvedDownloadNoPrivileges( resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), callbackIntent); break; case ACTION_DOWNLOAD_CONFIRMATION_CODE: resolvedDownloadConfirmationCode( resolutionExtras.getString(EuiccService.EXTRA_RESOLUTION_CONFIRMATION_CODE), resolutionExtras.getString(EuiccService.RESOLUTION_EXTRA_CONFIRMATION_CODE), callbackIntent); break; case ACTION_GET_DEFAULT_LIST_DEACTIVATE_SIM: resolvedGetDefaultListDeactivateSim( resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), callbackIntent); break; case ACTION_SWITCH_DEACTIVATE_SIM: resolvedSwitchDeactivateSim( resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), callbackIntent); break; case ACTION_SWITCH_NO_PRIVILEGES: resolvedSwitchNoPrivileges( resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT), resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), callbackIntent); break; default: Loading
src/java/com/android/internal/telephony/uicc/euicc/EuiccCard.java +8 −16 Original line number Diff line number Diff line Loading @@ -51,7 +51,6 @@ 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 @@ -190,10 +189,7 @@ public class EuiccCard extends UiccCard { loge("Profile must have an ICCID."); continue; } String strippedIccIdString = stripTrailingFs(profileNode.getChild(Tags.TAG_ICCID).asBytes()); EuiccProfileInfo.Builder profileBuilder = new EuiccProfileInfo.Builder(strippedIccIdString); EuiccProfileInfo.Builder profileBuilder = new EuiccProfileInfo.Builder(); buildProfile(profileNode, profileBuilder); EuiccProfileInfo profile = profileBuilder.build(); Loading Loading @@ -226,10 +222,7 @@ public class EuiccCard extends UiccCard { return null; } Asn1Node profileNode = profileNodes.get(0); String strippedIccIdString = stripTrailingFs(profileNode.getChild(Tags.TAG_ICCID).asBytes()); EuiccProfileInfo.Builder profileBuilder = new EuiccProfileInfo.Builder(strippedIccIdString); EuiccProfileInfo.Builder profileBuilder = new EuiccProfileInfo.Builder(); buildProfile(profileNode, profileBuilder); return profileBuilder.build(); }, Loading Loading @@ -519,7 +512,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(), Arrays.asList(opIds), builder.add(node.getChild(Tags.TAG_CTX_0).asBits(), opIds, node.getChild(Tags.TAG_CTX_2).asBits()); } return builder.build(); Loading Loading @@ -984,6 +977,10 @@ 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 @@ -1027,12 +1024,7 @@ 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); UiccAccessRule[] rules = buildUiccAccessRule(refArDoNodes); List<UiccAccessRule> rulesList = null; if (rules != null) { rulesList = Arrays.asList(rules); } profileBuilder.setUiccAccessRule(rulesList); profileBuilder.setUiccAccessRule(buildUiccAccessRule(refArDoNodes)); } } Loading
tests/telephonytests/src/com/android/internal/telephony/euicc/EuiccControllerTest.java +2 −8 Original line number Diff line number Diff line Loading @@ -73,7 +73,6 @@ 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 @@ -101,8 +100,7 @@ public class EuiccControllerTest extends TelephonyTest { DownloadableSubscription.forActivationCode("abcde"); static { SUBSCRIPTION_WITH_METADATA.setCarrierName("test name"); SUBSCRIPTION_WITH_METADATA.setAccessRules( Arrays.asList(new UiccAccessRule[] { ACCESS_RULE })); SUBSCRIPTION_WITH_METADATA.setAccessRules(new UiccAccessRule[] { ACCESS_RULE }); } private static final String OS_VERSION = "1.0"; Loading Loading @@ -266,7 +264,7 @@ public class EuiccControllerTest extends TelephonyTest { @Test public void testGetEuiccInfo_success() { assertEquals(OS_VERSION, callGetEuiccInfo(true /* success */, EUICC_INFO).getOsVersion()); assertEquals(OS_VERSION, callGetEuiccInfo(true /* success */, EUICC_INFO).osVersion); } @Test Loading Loading @@ -839,8 +837,6 @@ 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 @@ -849,8 +845,6 @@ 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