Loading src/java/com/android/internal/telephony/euicc/EuiccConnector.java +8 −2 Original line number Diff line number Diff line Loading @@ -225,6 +225,8 @@ public class EuiccConnector extends StateMachine implements ServiceConnection { static class GetMetadataRequest { DownloadableSubscription mSubscription; boolean mForceDeactivateSim; boolean mSwitchAfterDownload; int mPortIndex; GetMetadataCommandCallback mCallback; } Loading Loading @@ -447,13 +449,15 @@ public class EuiccConnector extends StateMachine implements ServiceConnection { /** Asynchronously fetch metadata for the given downloadable subscription. */ @VisibleForTesting(visibility = PACKAGE) public void getDownloadableSubscriptionMetadata(int cardId, DownloadableSubscription subscription, public void getDownloadableSubscriptionMetadata(int cardId, int portIndex, DownloadableSubscription subscription, boolean switchAfterDownload, boolean forceDeactivateSim, GetMetadataCommandCallback callback) { GetMetadataRequest request = new GetMetadataRequest(); request.mSubscription = subscription; request.mForceDeactivateSim = forceDeactivateSim; request.mSwitchAfterDownload = switchAfterDownload; request.mPortIndex = portIndex; request.mCallback = callback; sendMessage(CMD_GET_DOWNLOADABLE_SUBSCRIPTION_METADATA, cardId, 0 /* arg2 */, request); } Loading Loading @@ -752,7 +756,9 @@ public class EuiccConnector extends StateMachine implements ServiceConnection { case CMD_GET_DOWNLOADABLE_SUBSCRIPTION_METADATA: { GetMetadataRequest request = (GetMetadataRequest) message.obj; mEuiccService.getDownloadableSubscriptionMetadata(slotId, request.mPortIndex, request.mSubscription, request.mSwitchAfterDownload, request.mForceDeactivateSim, new IGetDownloadableSubscriptionMetadataCallback.Stub() { @Override Loading src/java/com/android/internal/telephony/euicc/EuiccController.java +8 −4 Original line number Diff line number Diff line Loading @@ -386,6 +386,7 @@ public class EuiccController extends IEuiccController.Stub { void getDownloadableSubscriptionMetadata(int cardId, DownloadableSubscription subscription, boolean forceDeactivateSim, String callingPackage, PendingIntent callbackIntent) { Log.d(TAG, " getDownloadableSubscriptionMetadata callingPackage: " + callingPackage); if (!callerCanWriteEmbeddedSubscriptions()) { throw new SecurityException("Must have WRITE_EMBEDDED_SUBSCRIPTIONS to get metadata"); } Loading @@ -393,7 +394,8 @@ public class EuiccController extends IEuiccController.Stub { long token = Binder.clearCallingIdentity(); try { mConnector.getDownloadableSubscriptionMetadata(cardId, subscription, forceDeactivateSim, TelephonyManager.DEFAULT_PORT_INDEX, subscription, false /* switchAfterDownload */, forceDeactivateSim, new GetMetadataCommandCallback( token, subscription, callingPackage, callbackIntent)); } finally { Loading Loading @@ -602,8 +604,8 @@ public class EuiccController extends IEuiccController.Stub { if (!isConsentNeededToResolvePortIndex && canManageSubscriptionOnTargetSim(cardId, callingPackage, true, portIndex)) { mConnector.getDownloadableSubscriptionMetadata(cardId, subscription, forceDeactivateSim, mConnector.getDownloadableSubscriptionMetadata(cardId, portIndex, subscription, switchAfterDownload, forceDeactivateSim, new DownloadSubscriptionGetMetadataCommandCallback(token, subscription, switchAfterDownload, callingPackage, forceDeactivateSim, callbackIntent, false /* withUserConsent */, portIndex)); Loading Loading @@ -714,7 +716,8 @@ public class EuiccController extends IEuiccController.Stub { Log.d(TAG, " downloadSubscriptionPrivilegedCheckMetadata cardId: " + cardId + " switchAfterDownload: " + switchAfterDownload + " portIndex: " + portIndex + " forceDeactivateSim: " + forceDeactivateSim); mConnector.getDownloadableSubscriptionMetadata(cardId, subscription, forceDeactivateSim, mConnector.getDownloadableSubscriptionMetadata(cardId, portIndex, subscription, switchAfterDownload, forceDeactivateSim, new DownloadSubscriptionGetMetadataCommandCallback(callingToken, subscription, switchAfterDownload, callingPackage, forceDeactivateSim, callbackIntent, true /* withUserConsent */, portIndex)); Loading Loading @@ -863,6 +866,7 @@ public class EuiccController extends IEuiccController.Stub { void getDefaultDownloadableSubscriptionList(int cardId, boolean forceDeactivateSim, String callingPackage, PendingIntent callbackIntent) { Log.d(TAG, " getDefaultDownloadableSubscriptionList callingPackage: " + callingPackage); if (!callerCanWriteEmbeddedSubscriptions()) { throw new SecurityException( "Must have WRITE_EMBEDDED_SUBSCRIPTIONS to get default list"); Loading tests/telephonytests/src/com/android/internal/telephony/euicc/EuiccControllerTest.java +5 −5 Original line number Diff line number Diff line Loading @@ -318,8 +318,8 @@ public class EuiccControllerTest extends TelephonyTest { SUBSCRIPTION, false /* complete */, null /* result */); verifyIntentSent(EuiccManager.EMBEDDED_SUBSCRIPTION_RESULT_ERROR, 0 /* detailedCode */); verify(mMockConnector).getDownloadableSubscriptionMetadata(anyInt(), any(), anyBoolean(), any()); verify(mMockConnector).getDownloadableSubscriptionMetadata(anyInt(), anyInt(), any(), anyBoolean(), anyBoolean(), any()); } @Test Loading Loading @@ -1492,7 +1492,7 @@ public class EuiccControllerTest extends TelephonyTest { @Override public Void answer(InvocationOnMock invocation) throws Exception { EuiccConnector.GetMetadataCommandCallback cb = invocation .getArgument(3 /* resultCallback */); .getArgument(5 /* resultCallback */); if (complete) { cb.onGetMetadataComplete(CARD_ID, result); } else { Loading @@ -1500,8 +1500,8 @@ public class EuiccControllerTest extends TelephonyTest { } return null; } }).when(mMockConnector).getDownloadableSubscriptionMetadata(anyInt(), any(), anyBoolean(), any()); }).when(mMockConnector).getDownloadableSubscriptionMetadata(anyInt(), anyInt(), any(), anyBoolean(), anyBoolean(), any()); } private void callGetDownloadableSubscriptionMetadata(DownloadableSubscription subscription, Loading Loading
src/java/com/android/internal/telephony/euicc/EuiccConnector.java +8 −2 Original line number Diff line number Diff line Loading @@ -225,6 +225,8 @@ public class EuiccConnector extends StateMachine implements ServiceConnection { static class GetMetadataRequest { DownloadableSubscription mSubscription; boolean mForceDeactivateSim; boolean mSwitchAfterDownload; int mPortIndex; GetMetadataCommandCallback mCallback; } Loading Loading @@ -447,13 +449,15 @@ public class EuiccConnector extends StateMachine implements ServiceConnection { /** Asynchronously fetch metadata for the given downloadable subscription. */ @VisibleForTesting(visibility = PACKAGE) public void getDownloadableSubscriptionMetadata(int cardId, DownloadableSubscription subscription, public void getDownloadableSubscriptionMetadata(int cardId, int portIndex, DownloadableSubscription subscription, boolean switchAfterDownload, boolean forceDeactivateSim, GetMetadataCommandCallback callback) { GetMetadataRequest request = new GetMetadataRequest(); request.mSubscription = subscription; request.mForceDeactivateSim = forceDeactivateSim; request.mSwitchAfterDownload = switchAfterDownload; request.mPortIndex = portIndex; request.mCallback = callback; sendMessage(CMD_GET_DOWNLOADABLE_SUBSCRIPTION_METADATA, cardId, 0 /* arg2 */, request); } Loading Loading @@ -752,7 +756,9 @@ public class EuiccConnector extends StateMachine implements ServiceConnection { case CMD_GET_DOWNLOADABLE_SUBSCRIPTION_METADATA: { GetMetadataRequest request = (GetMetadataRequest) message.obj; mEuiccService.getDownloadableSubscriptionMetadata(slotId, request.mPortIndex, request.mSubscription, request.mSwitchAfterDownload, request.mForceDeactivateSim, new IGetDownloadableSubscriptionMetadataCallback.Stub() { @Override Loading
src/java/com/android/internal/telephony/euicc/EuiccController.java +8 −4 Original line number Diff line number Diff line Loading @@ -386,6 +386,7 @@ public class EuiccController extends IEuiccController.Stub { void getDownloadableSubscriptionMetadata(int cardId, DownloadableSubscription subscription, boolean forceDeactivateSim, String callingPackage, PendingIntent callbackIntent) { Log.d(TAG, " getDownloadableSubscriptionMetadata callingPackage: " + callingPackage); if (!callerCanWriteEmbeddedSubscriptions()) { throw new SecurityException("Must have WRITE_EMBEDDED_SUBSCRIPTIONS to get metadata"); } Loading @@ -393,7 +394,8 @@ public class EuiccController extends IEuiccController.Stub { long token = Binder.clearCallingIdentity(); try { mConnector.getDownloadableSubscriptionMetadata(cardId, subscription, forceDeactivateSim, TelephonyManager.DEFAULT_PORT_INDEX, subscription, false /* switchAfterDownload */, forceDeactivateSim, new GetMetadataCommandCallback( token, subscription, callingPackage, callbackIntent)); } finally { Loading Loading @@ -602,8 +604,8 @@ public class EuiccController extends IEuiccController.Stub { if (!isConsentNeededToResolvePortIndex && canManageSubscriptionOnTargetSim(cardId, callingPackage, true, portIndex)) { mConnector.getDownloadableSubscriptionMetadata(cardId, subscription, forceDeactivateSim, mConnector.getDownloadableSubscriptionMetadata(cardId, portIndex, subscription, switchAfterDownload, forceDeactivateSim, new DownloadSubscriptionGetMetadataCommandCallback(token, subscription, switchAfterDownload, callingPackage, forceDeactivateSim, callbackIntent, false /* withUserConsent */, portIndex)); Loading Loading @@ -714,7 +716,8 @@ public class EuiccController extends IEuiccController.Stub { Log.d(TAG, " downloadSubscriptionPrivilegedCheckMetadata cardId: " + cardId + " switchAfterDownload: " + switchAfterDownload + " portIndex: " + portIndex + " forceDeactivateSim: " + forceDeactivateSim); mConnector.getDownloadableSubscriptionMetadata(cardId, subscription, forceDeactivateSim, mConnector.getDownloadableSubscriptionMetadata(cardId, portIndex, subscription, switchAfterDownload, forceDeactivateSim, new DownloadSubscriptionGetMetadataCommandCallback(callingToken, subscription, switchAfterDownload, callingPackage, forceDeactivateSim, callbackIntent, true /* withUserConsent */, portIndex)); Loading Loading @@ -863,6 +866,7 @@ public class EuiccController extends IEuiccController.Stub { void getDefaultDownloadableSubscriptionList(int cardId, boolean forceDeactivateSim, String callingPackage, PendingIntent callbackIntent) { Log.d(TAG, " getDefaultDownloadableSubscriptionList callingPackage: " + callingPackage); if (!callerCanWriteEmbeddedSubscriptions()) { throw new SecurityException( "Must have WRITE_EMBEDDED_SUBSCRIPTIONS to get default list"); Loading
tests/telephonytests/src/com/android/internal/telephony/euicc/EuiccControllerTest.java +5 −5 Original line number Diff line number Diff line Loading @@ -318,8 +318,8 @@ public class EuiccControllerTest extends TelephonyTest { SUBSCRIPTION, false /* complete */, null /* result */); verifyIntentSent(EuiccManager.EMBEDDED_SUBSCRIPTION_RESULT_ERROR, 0 /* detailedCode */); verify(mMockConnector).getDownloadableSubscriptionMetadata(anyInt(), any(), anyBoolean(), any()); verify(mMockConnector).getDownloadableSubscriptionMetadata(anyInt(), anyInt(), any(), anyBoolean(), anyBoolean(), any()); } @Test Loading Loading @@ -1492,7 +1492,7 @@ public class EuiccControllerTest extends TelephonyTest { @Override public Void answer(InvocationOnMock invocation) throws Exception { EuiccConnector.GetMetadataCommandCallback cb = invocation .getArgument(3 /* resultCallback */); .getArgument(5 /* resultCallback */); if (complete) { cb.onGetMetadataComplete(CARD_ID, result); } else { Loading @@ -1500,8 +1500,8 @@ public class EuiccControllerTest extends TelephonyTest { } return null; } }).when(mMockConnector).getDownloadableSubscriptionMetadata(anyInt(), any(), anyBoolean(), any()); }).when(mMockConnector).getDownloadableSubscriptionMetadata(anyInt(), anyInt(), any(), anyBoolean(), anyBoolean(), any()); } private void callGetDownloadableSubscriptionMetadata(DownloadableSubscription subscription, Loading