From 35063d68fa92f3fc241c1209d556be7a9d9770ce Mon Sep 17 00:00:00 2001 From: Holly Jiuyu Sun Date: Wed, 17 Oct 2018 14:11:00 -0700 Subject: [PATCH] Catch SecurityException in EuiccCardController and trigger callback. Currently, if checkCallingPackage() throws a SecurityException, it won't trigger the callback. Since, EuiccCardManager is async which will return after invoke EuiccCardController, the throwed SecurityException will get lost. In this CL, the exception is caught in EuiccCardController and triggers the callback in this case. Also, fix a typo in EuiccCardManager. Bug: 78599148 Bug: 110845244 Test: test on phone Merged-In: I6487d7b29bc9ec0d2ead482ac7d7804b5325a379 Change-Id: I6487d7b29bc9ec0d2ead482ac7d7804b5325a379 --- api/system-current.txt | 1 + .../telephony/euicc/EuiccCardManager.java | 49 ++++++++++--------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/api/system-current.txt b/api/system-current.txt index b8de99c522d2c..77112363c9b8e 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -5568,6 +5568,7 @@ package android.telephony.euicc { field public static final int RESET_OPTION_DELETE_FIELD_LOADED_TEST_PROFILES = 2; // 0x2 field public static final int RESET_OPTION_DELETE_OPERATIONAL_PROFILES = 1; // 0x1 field public static final int RESET_OPTION_RESET_DEFAULT_SMDP_ADDRESS = 4; // 0x4 + field public static final int RESULT_CALLER_NOT_ALLOWED = -3; // 0xfffffffd field public static final int RESULT_EUICC_NOT_FOUND = -2; // 0xfffffffe field public static final int RESULT_OK = 0; // 0x0 field public static final int RESULT_UNKNOWN_ERROR = -1; // 0xffffffff diff --git a/telephony/java/android/telephony/euicc/EuiccCardManager.java b/telephony/java/android/telephony/euicc/EuiccCardManager.java index 11411778a9abb..3b1ef3f45993f 100644 --- a/telephony/java/android/telephony/euicc/EuiccCardManager.java +++ b/telephony/java/android/telephony/euicc/EuiccCardManager.java @@ -15,6 +15,7 @@ */ package android.telephony.euicc; +import android.annotation.CallbackExecutor; import android.annotation.IntDef; import android.annotation.Nullable; import android.annotation.SystemApi; @@ -50,7 +51,6 @@ import com.android.internal.telephony.euicc.ISwitchToProfileCallback; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import android.annotation.CallbackExecutor; import java.util.concurrent.Executor; /** @@ -119,6 +119,9 @@ public class EuiccCardManager { /** Result code when the eUICC card with the given card Id is not found. */ public static final int RESULT_EUICC_NOT_FOUND = -2; + /** Result code indicating the caller is not the active LPA. */ + public static final int RESULT_CALLER_NOT_ALLOWED = -3; + /** * Callback to receive the result of an eUICC card API. * @@ -152,7 +155,7 @@ public class EuiccCardManager { * Requests all the profiles on eUicc. * * @param cardId The Id of the eUICC. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback The callback to get the result code and all the profiles. */ public void requestAllProfiles(String cardId, @CallbackExecutor Executor executor, @@ -176,7 +179,7 @@ public class EuiccCardManager { * * @param cardId The Id of the eUICC. * @param iccid The iccid of the profile. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback The callback to get the result code and profile. */ public void requestProfile(String cardId, String iccid, @CallbackExecutor Executor executor, @@ -201,7 +204,7 @@ public class EuiccCardManager { * @param cardId The Id of the eUICC. * @param iccid The iccid of the profile. * @param refresh Whether sending the REFRESH command to modem. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback The callback to get the result code. */ public void disableProfile(String cardId, String iccid, boolean refresh, @@ -227,7 +230,7 @@ public class EuiccCardManager { * @param cardId The Id of the eUICC. * @param iccid The iccid of the profile to switch to. * @param refresh Whether sending the REFRESH command to modem. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback The callback to get the result code and the EuiccProfileInfo enabled. */ public void switchToProfile(String cardId, String iccid, boolean refresh, @@ -252,7 +255,7 @@ public class EuiccCardManager { * @param cardId The Id of the eUICC. * @param iccid The iccid of the profile. * @param nickname The nickname of the profile. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback The callback to get the result code. */ public void setNickname(String cardId, String iccid, String nickname, @@ -276,7 +279,7 @@ public class EuiccCardManager { * * @param cardId The Id of the eUICC. * @param iccid The iccid of the profile. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback The callback to get the result code. */ public void deleteProfile(String cardId, String iccid, @CallbackExecutor Executor executor, @@ -301,7 +304,7 @@ public class EuiccCardManager { * @param cardId The Id of the eUICC. * @param options Bits of the options of resetting which parts of the eUICC memory. See * EuiccCard for details. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback The callback to get the result code. */ public void resetMemory(String cardId, @ResetOption int options, @@ -324,7 +327,7 @@ public class EuiccCardManager { * Requests the default SM-DP+ address from eUICC. * * @param cardId The Id of the eUICC. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback The callback to get the result code and the default SM-DP+ address. */ public void requestDefaultSmdpAddress(String cardId, @CallbackExecutor Executor executor, @@ -347,7 +350,7 @@ public class EuiccCardManager { * Requests the SM-DS address from eUICC. * * @param cardId The Id of the eUICC. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback The callback to get the result code and the SM-DS address. */ public void requestSmdsAddress(String cardId, @CallbackExecutor Executor executor, @@ -371,7 +374,7 @@ public class EuiccCardManager { * * @param cardId The Id of the eUICC. * @param defaultSmdpAddress The default SM-DP+ address to set. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback The callback to get the result code. */ public void setDefaultSmdpAddress(String cardId, String defaultSmdpAddress, @@ -395,7 +398,7 @@ public class EuiccCardManager { * Requests Rules Authorisation Table. * * @param cardId The Id of the eUICC. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback the callback to get the result code and the rule authorisation table. */ public void requestRulesAuthTable(String cardId, @CallbackExecutor Executor executor, @@ -418,7 +421,7 @@ public class EuiccCardManager { * Requests the eUICC challenge for new profile downloading. * * @param cardId The Id of the eUICC. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback the callback to get the result code and the challenge. */ public void requestEuiccChallenge(String cardId, @CallbackExecutor Executor executor, @@ -441,7 +444,7 @@ public class EuiccCardManager { * Requests the eUICC info1 defined in GSMA RSP v2.0+ for new profile downloading. * * @param cardId The Id of the eUICC. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback the callback to get the result code and the info1. */ public void requestEuiccInfo1(String cardId, @CallbackExecutor Executor executor, @@ -464,7 +467,7 @@ public class EuiccCardManager { * Gets the eUICC info2 defined in GSMA RSP v2.0+ for new profile downloading. * * @param cardId The Id of the eUICC. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback the callback to get the result code and the info2. */ public void requestEuiccInfo2(String cardId, @CallbackExecutor Executor executor, @@ -497,7 +500,7 @@ public class EuiccCardManager { * GSMA RSP v2.0+. * @param serverCertificate ASN.1 data in byte array indicating SM-DP+ Certificate returned by * SM-DP+ server. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback the callback to get the result code and a byte array which represents a * {@code AuthenticateServerResponse} defined in GSMA RSP v2.0+. */ @@ -537,7 +540,7 @@ public class EuiccCardManager { * SM-DP+ server. * @param smdpCertificate ASN.1 data in byte array indicating the SM-DP+ Certificate returned * by SM-DP+ server. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback the callback to get the result code and a byte array which represents a * {@code PrepareDownloadResponse} defined in GSMA RSP v2.0+ */ @@ -569,7 +572,7 @@ public class EuiccCardManager { * * @param cardId The Id of the eUICC. * @param boundProfilePackage the Bound Profile Package data returned by SM-DP+ server. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback the callback to get the result code and a byte array which represents a * {@code LoadBoundProfilePackageResponse} defined in GSMA RSP v2.0+. */ @@ -598,7 +601,7 @@ public class EuiccCardManager { * @param cardId The Id of the eUICC. * @param transactionId the transaction ID returned by SM-DP+ server. * @param reason the cancel reason. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback the callback to get the result code and an byte[] which represents a * {@code CancelSessionResponse} defined in GSMA RSP v2.0+. */ @@ -627,7 +630,7 @@ public class EuiccCardManager { * * @param cardId The Id of the eUICC. * @param events bits of the event types ({@link EuiccNotification.Event}) to list. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback the callback to get the result code and the list of notifications. */ public void listNotifications(String cardId, @EuiccNotification.Event int events, @@ -651,7 +654,7 @@ public class EuiccCardManager { * * @param cardId The Id of the eUICC. * @param events bits of the event types ({@link EuiccNotification.Event}) to list. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback the callback to get the result code and the list of notifications. */ public void retrieveNotificationList(String cardId, @EuiccNotification.Event int events, @@ -675,7 +678,7 @@ public class EuiccCardManager { * * @param cardId The Id of the eUICC. * @param seqNumber the sequence number of the notification. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback the callback to get the result code and the notification. */ public void retrieveNotification(String cardId, int seqNumber, @@ -699,7 +702,7 @@ public class EuiccCardManager { * * @param cardId The Id of the eUICC. * @param seqNumber the sequence number of the notification. - * @param executor The executor through which the callback should be invode. + * @param executor The executor through which the callback should be invoke. * @param callback the callback to get the result code. */ public void removeNotificationFromList(String cardId, int seqNumber,