diff options
| author | 2017-12-12 20:17:09 -0800 | |
|---|---|---|
| committer | 2018-02-08 11:12:30 -0800 | |
| commit | 4f73b9c09ac6ae73c22ad02872e362c817ab2d4c (patch) | |
| tree | dd3c17b8d5136758146f7ebddf295bf45afdb928 | |
| parent | af018ce38774262c634dbaee65cc1293aca21912 (diff) | |
Public EuiccManager APIs.
Public EuiccManager and other related necessary files.
Mark EuiccCardManager and other related necessary files as @SystemApi.
Solve lint errors and warnings.
Bug: 35851809
Test: test on phone
Change-Id: I68853e134e1e31fa9b91a83af6c491a2a8cca971
24 files changed, 934 insertions, 390 deletions
diff --git a/api/current.txt b/api/current.txt index 9204289c450e..113291365c15 100644 --- a/api/current.txt +++ b/api/current.txt @@ -6705,6 +6705,7 @@ package android.app.admin { field public static final int USER_OPERATION_ERROR_MAX_RUNNING_USERS = 3; // 0x3 field public static final int USER_OPERATION_ERROR_UNKNOWN = 1; // 0x1 field public static final int USER_OPERATION_SUCCESS = 0; // 0x0 + field public static final int WIPE_EUICC = 4; // 0x4 field public static final int WIPE_EXTERNAL_STORAGE = 1; // 0x1 field public static final int WIPE_RESET_PROTECTION_DATA = 2; // 0x2 } @@ -9440,6 +9441,7 @@ package android.content { field public static final java.lang.String DISPLAY_SERVICE = "display"; field public static final java.lang.String DOWNLOAD_SERVICE = "download"; field public static final java.lang.String DROPBOX_SERVICE = "dropbox"; + field public static final java.lang.String EUICC_SERVICE = "euicc"; field public static final java.lang.String FINGERPRINT_SERVICE = "fingerprint"; field public static final java.lang.String HARDWARE_PROPERTIES_SERVICE = "hardware_properties"; field public static final java.lang.String INPUT_METHOD_SERVICE = "input_method"; @@ -11265,6 +11267,7 @@ package android.content.pm { field public static final java.lang.String FEATURE_STRONGBOX_KEYSTORE = "android.hardware.strongbox_keystore"; field public static final java.lang.String FEATURE_TELEPHONY = "android.hardware.telephony"; field public static final java.lang.String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma"; + field public static final java.lang.String FEATURE_TELEPHONY_EUICC = "android.hardware.telephony.euicc"; field public static final java.lang.String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm"; field public static final java.lang.String FEATURE_TELEPHONY_MBMS = "android.hardware.telephony.mbms"; field public static final deprecated java.lang.String FEATURE_TELEVISION = "android.hardware.type.television"; @@ -42197,13 +42200,16 @@ package android.telephony { method public java.lang.String getNumber(); method public int getSimSlotIndex(); method public int getSubscriptionId(); + method public boolean isEmbedded(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator<android.telephony.SubscriptionInfo> CREATOR; } public class SubscriptionManager { method public void addOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener); + method public boolean canManageSubscription(android.telephony.SubscriptionInfo); method public static deprecated android.telephony.SubscriptionManager from(android.content.Context); + method public java.util.List<android.telephony.SubscriptionInfo> getAccessibleSubscriptionInfoList(); method public android.telephony.SubscriptionInfo getActiveSubscriptionInfo(int); method public int getActiveSubscriptionInfoCount(); method public int getActiveSubscriptionInfoCountMax(); @@ -42588,6 +42594,44 @@ package android.telephony.data { } +package android.telephony.euicc { + + public final class DownloadableSubscription implements android.os.Parcelable { + method public int describeContents(); + method public static android.telephony.euicc.DownloadableSubscription forActivationCode(java.lang.String); + method public java.lang.String getConfirmationCode(); + method public java.lang.String getEncodedActivationCode(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator<android.telephony.euicc.DownloadableSubscription> CREATOR; + } + + public final class EuiccInfo implements android.os.Parcelable { + ctor public EuiccInfo(java.lang.String); + method public int describeContents(); + method public java.lang.String getOsVersion(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator<android.telephony.euicc.EuiccInfo> CREATOR; + } + + public class EuiccManager { + method public void deleteSubscription(int, android.app.PendingIntent); + method public void downloadSubscription(android.telephony.euicc.DownloadableSubscription, boolean, android.app.PendingIntent); + method public java.lang.String getEid(); + method public android.telephony.euicc.EuiccInfo getEuiccInfo(); + method public boolean isEnabled(); + method public void startResolutionActivity(android.app.Activity, int, android.content.Intent, android.app.PendingIntent) throws android.content.IntentSender.SendIntentException; + method public void switchToSubscription(int, android.app.PendingIntent); + field public static final java.lang.String ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS = "android.telephony.euicc.action.MANAGE_EMBEDDED_SUBSCRIPTIONS"; + field public static final java.lang.String ACTION_NOTIFY_CARRIER_SETUP_INCOMPLETE = "android.telephony.euicc.action.NOTIFY_CARRIER_SETUP_INCOMPLETE"; + field public static final int EMBEDDED_SUBSCRIPTION_RESULT_ERROR = 2; // 0x2 + field public static final int EMBEDDED_SUBSCRIPTION_RESULT_OK = 0; // 0x0 + field public static final int EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR = 1; // 0x1 + field public static final java.lang.String EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_DETAILED_CODE"; + field public static final java.lang.String META_DATA_CARRIER_ICON = "android.telephony.euicc.carriericon"; + } + +} + package android.telephony.gsm { public class GsmCellLocation extends android.telephony.CellLocation { diff --git a/api/system-current.txt b/api/system-current.txt index 6b229afd6d23..79fb83d4b935 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -20,6 +20,7 @@ package android { field public static final java.lang.String BIND_APPWIDGET = "android.permission.BIND_APPWIDGET"; field public static final deprecated java.lang.String BIND_CONNECTION_SERVICE = "android.permission.BIND_CONNECTION_SERVICE"; field public static final java.lang.String BIND_DIRECTORY_SEARCH = "android.permission.BIND_DIRECTORY_SEARCH"; + field public static final java.lang.String BIND_EUICC_SERVICE = "android.permission.BIND_EUICC_SERVICE"; field public static final java.lang.String BIND_IMS_SERVICE = "android.permission.BIND_IMS_SERVICE"; field public static final java.lang.String BIND_KEYGUARD_APPWIDGET = "android.permission.BIND_KEYGUARD_APPWIDGET"; field public static final java.lang.String BIND_NETWORK_RECOMMENDATION_SERVICE = "android.permission.BIND_NETWORK_RECOMMENDATION_SERVICE"; @@ -186,6 +187,7 @@ package android { field public static final java.lang.String USE_RESERVED_DISK = "android.permission.USE_RESERVED_DISK"; field public static final java.lang.String WRITE_APN_SETTINGS = "android.permission.WRITE_APN_SETTINGS"; field public static final java.lang.String WRITE_DREAM_STATE = "android.permission.WRITE_DREAM_STATE"; + field public static final java.lang.String WRITE_EMBEDDED_SUBSCRIPTIONS = "android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS"; field public static final java.lang.String WRITE_GSERVICES = "android.permission.WRITE_GSERVICES"; field public static final java.lang.String WRITE_MEDIA_STORAGE = "android.permission.WRITE_MEDIA_STORAGE"; field public static final java.lang.String WRITE_SECURE_SETTINGS = "android.permission.WRITE_SECURE_SETTINGS"; @@ -784,6 +786,7 @@ package android.content { method public abstract void sendOrderedBroadcast(android.content.Intent, java.lang.String, android.os.Bundle, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); field public static final java.lang.String BACKUP_SERVICE = "backup"; field public static final java.lang.String CONTEXTHUB_SERVICE = "contexthub"; + field public static final java.lang.String EUICC_CARD_SERVICE = "euicc_card"; field public static final java.lang.String HDMI_CONTROL_SERVICE = "hdmi_control"; field public static final java.lang.String NETWORK_SCORE_SERVICE = "network_score"; field public static final java.lang.String OEM_LOCK_SERVICE = "oem_lock"; @@ -4125,6 +4128,7 @@ package android.provider { method public static boolean putString(android.content.ContentResolver, java.lang.String, java.lang.String, java.lang.String, boolean); method public static void resetToDefaults(android.content.ContentResolver, java.lang.String); field public static final java.lang.String AUTOFILL_COMPAT_ALLOWED_PACKAGES = "autofill_compat_allowed_packages"; + field public static final java.lang.String DEFAULT_SM_DP_PLUS = "default_sm_dp_plus"; field public static final java.lang.String OTA_DISABLE_AUTOMATIC_UPDATE = "ota_disable_automatic_update"; field public static final java.lang.String THEATER_MODE_ON = "theater_mode_on"; field public static final java.lang.String WEBVIEW_MULTIPROCESS = "webview_multiprocess"; @@ -4298,6 +4302,125 @@ package android.service.autofill { } +package android.service.euicc { + + public final class EuiccProfileInfo implements android.os.Parcelable { + method public int describeContents(); + method public android.service.carrier.CarrierIdentifier getCarrierIdentifier(); + method public java.lang.String getIccid(); + method public java.lang.String getNickname(); + method public int getPolicyRules(); + method public int getProfileClass(); + method public java.lang.String getProfileName(); + method public java.lang.String getServiceProviderName(); + method public int getState(); + method public java.util.List<android.telephony.UiccAccessRule> getUiccAccessRules(); + method public boolean hasPolicyRule(int); + method public boolean hasPolicyRules(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator<android.service.euicc.EuiccProfileInfo> CREATOR; + field public static final int POLICY_RULE_DELETE_AFTER_DISABLING = 4; // 0x4 + field public static final int POLICY_RULE_DO_NOT_DELETE = 2; // 0x2 + field public static final int POLICY_RULE_DO_NOT_DISABLE = 1; // 0x1 + field public static final int PROFILE_CLASS_OPERATIONAL = 2; // 0x2 + field public static final int PROFILE_CLASS_PROVISIONING = 1; // 0x1 + field public static final int PROFILE_CLASS_TESTING = 0; // 0x0 + field public static final int PROFILE_STATE_DISABLED = 0; // 0x0 + field public static final int PROFILE_STATE_ENABLED = 1; // 0x1 + } + + public static final class EuiccProfileInfo.Builder { + ctor public EuiccProfileInfo.Builder(java.lang.String); + ctor public EuiccProfileInfo.Builder(android.service.euicc.EuiccProfileInfo); + method public android.service.euicc.EuiccProfileInfo build(); + method public android.service.euicc.EuiccProfileInfo.Builder setCarrierIdentifier(android.service.carrier.CarrierIdentifier); + method public android.service.euicc.EuiccProfileInfo.Builder setIccid(java.lang.String); + method public android.service.euicc.EuiccProfileInfo.Builder setNickname(java.lang.String); + method public android.service.euicc.EuiccProfileInfo.Builder setPolicyRules(int); + method public android.service.euicc.EuiccProfileInfo.Builder setProfileClass(int); + method public android.service.euicc.EuiccProfileInfo.Builder setProfileName(java.lang.String); + method public android.service.euicc.EuiccProfileInfo.Builder setServiceProviderName(java.lang.String); + method public android.service.euicc.EuiccProfileInfo.Builder setState(int); + method public android.service.euicc.EuiccProfileInfo.Builder setUiccAccessRule(java.util.List<android.telephony.UiccAccessRule>); + } + + public static abstract class EuiccProfileInfo.PolicyRule implements java.lang.annotation.Annotation { + } + + public static abstract class EuiccProfileInfo.ProfileClass implements java.lang.annotation.Annotation { + } + + public static abstract class EuiccProfileInfo.ProfileState implements java.lang.annotation.Annotation { + } + + public abstract class EuiccService extends android.app.Service { + ctor public EuiccService(); + method public android.os.IBinder onBind(android.content.Intent); + method public abstract int onDeleteSubscription(int, java.lang.String); + method public abstract int onDownloadSubscription(int, android.telephony.euicc.DownloadableSubscription, boolean, boolean); + method public abstract int onEraseSubscriptions(int); + method public abstract android.service.euicc.GetDefaultDownloadableSubscriptionListResult onGetDefaultDownloadableSubscriptionList(int, boolean); + method public abstract android.service.euicc.GetDownloadableSubscriptionMetadataResult onGetDownloadableSubscriptionMetadata(int, android.telephony.euicc.DownloadableSubscription, boolean); + method public abstract java.lang.String onGetEid(int); + method public abstract android.telephony.euicc.EuiccInfo onGetEuiccInfo(int); + method public abstract android.service.euicc.GetEuiccProfileInfoListResult onGetEuiccProfileInfoList(int); + method public abstract int onGetOtaStatus(int); + method public abstract int onRetainSubscriptionsForFactoryReset(int); + method public abstract void onStartOtaIfNecessary(int, android.service.euicc.EuiccService.OtaStatusChangedCallback); + method public abstract int onSwitchToSubscription(int, java.lang.String, boolean); + method public abstract int onUpdateSubscriptionNickname(int, java.lang.String, java.lang.String); + field public static final java.lang.String ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS = "android.service.euicc.action.MANAGE_EMBEDDED_SUBSCRIPTIONS"; + field public static final java.lang.String ACTION_PROVISION_EMBEDDED_SUBSCRIPTION = "android.service.euicc.action.PROVISION_EMBEDDED_SUBSCRIPTION"; + field public static final java.lang.String ACTION_RESOLVE_CONFIRMATION_CODE = "android.service.euicc.action.RESOLVE_CONFIRMATION_CODE"; + field public static final java.lang.String ACTION_RESOLVE_DEACTIVATE_SIM = "android.service.euicc.action.RESOLVE_DEACTIVATE_SIM"; + field public static final java.lang.String ACTION_RESOLVE_NO_PRIVILEGES = "android.service.euicc.action.RESOLVE_NO_PRIVILEGES"; + field public static final java.lang.String CATEGORY_EUICC_UI = "android.service.euicc.category.EUICC_UI"; + field public static final java.lang.String EUICC_SERVICE_INTERFACE = "android.service.euicc.EuiccService"; + field public static final java.lang.String EXTRA_RESOLUTION_CALLING_PACKAGE = "android.service.euicc.extra.RESOLUTION_CALLING_PACKAGE"; + field public static final java.lang.String EXTRA_RESOLUTION_CONFIRMATION_CODE = "android.service.euicc.extra.RESOLUTION_CONFIRMATION_CODE"; + field public static final java.lang.String EXTRA_RESOLUTION_CONFIRMATION_CODE_RETRIED = "android.service.euicc.extra.RESOLUTION_CONFIRMATION_CODE_RETRIED"; + field public static final java.lang.String EXTRA_RESOLUTION_CONSENT = "android.service.euicc.extra.RESOLUTION_CONSENT"; + field public static final int RESULT_FIRST_USER = 1; // 0x1 + field public static final int RESULT_MUST_DEACTIVATE_SIM = -1; // 0xffffffff + field public static final int RESULT_NEED_CONFIRMATION_CODE = -2; // 0xfffffffe + field public static final int RESULT_OK = 0; // 0x0 + } + + public static abstract class EuiccService.OtaStatusChangedCallback { + ctor public EuiccService.OtaStatusChangedCallback(); + method public abstract void onOtaStatusChanged(int); + } + + public final class GetDefaultDownloadableSubscriptionListResult implements android.os.Parcelable { + ctor public GetDefaultDownloadableSubscriptionListResult(int, android.telephony.euicc.DownloadableSubscription[]); + method public int describeContents(); + method public java.util.List<android.telephony.euicc.DownloadableSubscription> getDownloadableSubscriptions(); + method public int getResult(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator<android.service.euicc.GetDefaultDownloadableSubscriptionListResult> CREATOR; + } + + public final class GetDownloadableSubscriptionMetadataResult implements android.os.Parcelable { + ctor public GetDownloadableSubscriptionMetadataResult(int, android.telephony.euicc.DownloadableSubscription); + method public int describeContents(); + method public android.telephony.euicc.DownloadableSubscription getDownloadableSubscription(); + method public int getResult(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator<android.service.euicc.GetDownloadableSubscriptionMetadataResult> CREATOR; + } + + public final class GetEuiccProfileInfoListResult implements android.os.Parcelable { + ctor public GetEuiccProfileInfoListResult(int, android.service.euicc.EuiccProfileInfo[], boolean); + method public int describeContents(); + method public boolean getIsRemovable(); + method public java.util.List<android.service.euicc.EuiccProfileInfo> getProfiles(); + method public int getResult(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator<android.service.euicc.GetEuiccProfileInfoListResult> CREATOR; + } + +} + package android.service.notification { public final class Adjustment implements android.os.Parcelable { @@ -4898,8 +5021,14 @@ package android.telephony { field public static final int RESULT_SYSTEM_ERROR = 15; // 0xf } + public class SubscriptionInfo implements android.os.Parcelable { + method public java.util.List<android.telephony.UiccAccessRule> getAccessRules(); + } + public class SubscriptionManager { + method public java.util.List<android.telephony.SubscriptionInfo> getAvailableSubscriptionInfoList(); method public java.util.List<android.telephony.SubscriptionPlan> getSubscriptionPlans(int); + method public void requestEmbeddedSubscriptionInfoListRefresh(); method public void setSubscriptionOverrideCongested(int, boolean, long); method public void setSubscriptionOverrideUnmetered(int, boolean, long); method public void setSubscriptionPlans(int, java.util.List<android.telephony.SubscriptionPlan>); @@ -5035,6 +5164,16 @@ package android.telephony { field public static final int SIM_STATE_PRESENT = 11; // 0xb } + public final class UiccAccessRule implements android.os.Parcelable { + ctor public UiccAccessRule(byte[], java.lang.String, long); + method public int describeContents(); + method public int getCarrierPrivilegeStatus(android.content.pm.PackageInfo); + method public int getCarrierPrivilegeStatus(android.content.pm.Signature, java.lang.String); + method public java.lang.String getPackageName(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator<android.telephony.UiccAccessRule> CREATOR; + } + public class UiccSlotInfo implements android.os.Parcelable { ctor public UiccSlotInfo(boolean, boolean, java.lang.String, int, int); method public int describeContents(); @@ -5145,6 +5284,125 @@ package android.telephony.data { } +package android.telephony.euicc { + + public final class DownloadableSubscription implements android.os.Parcelable { + method public java.util.List<android.telephony.UiccAccessRule> getAccessRules(); + method public java.lang.String getCarrierName(); + } + + public static final class DownloadableSubscription.Builder { + ctor public DownloadableSubscription.Builder(); + ctor public DownloadableSubscription.Builder(android.telephony.euicc.DownloadableSubscription); + method public android.telephony.euicc.DownloadableSubscription build(); + method public android.telephony.euicc.DownloadableSubscription.Builder setAccessRules(java.util.List<android.telephony.UiccAccessRule>); + method public android.telephony.euicc.DownloadableSubscription.Builder setCarrierName(java.lang.String); + method public android.telephony.euicc.DownloadableSubscription.Builder setConfirmationCode(java.lang.String); + method public android.telephony.euicc.DownloadableSubscription.Builder setEncodedActivationCode(java.lang.String); + } + + public class EuiccCardManager { + method public void authenticateServer(java.lang.String, java.lang.String, byte[], byte[], byte[], byte[], java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>); + method public void cancelSession(java.lang.String, byte[], int, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>); + method public void deleteProfile(java.lang.String, java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.Void>); + method public void disableProfile(java.lang.String, java.lang.String, boolean, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.Void>); + method public void listNotifications(java.lang.String, int, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.telephony.euicc.EuiccNotification[]>); + method public void loadBoundProfilePackage(java.lang.String, byte[], java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>); + method public void prepareDownload(java.lang.String, byte[], byte[], byte[], byte[], java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>); + method public void removeNotificationFromList(java.lang.String, int, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.Void>); + method public void requestAllProfiles(java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.service.euicc.EuiccProfileInfo[]>); + method public void requestDefaultSmdpAddress(java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.String>); + method public void requestEuiccChallenge(java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>); + method public void requestEuiccInfo1(java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>); + method public void requestEuiccInfo2(java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>); + method public void requestProfile(java.lang.String, java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.service.euicc.EuiccProfileInfo>); + method public void requestRulesAuthTable(java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.telephony.euicc.EuiccRulesAuthTable>); + method public void requestSmdsAddress(java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.String>); + method public void resetMemory(java.lang.String, int, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.Void>); + method public void retrieveNotification(java.lang.String, int, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.telephony.euicc.EuiccNotification>); + method public void retrieveNotificationList(java.lang.String, int, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.telephony.euicc.EuiccNotification[]>); + method public void setDefaultSmdpAddress(java.lang.String, java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.Void>); + method public void setNickname(java.lang.String, java.lang.String, java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.Void>); + method public void switchToProfile(java.lang.String, java.lang.String, boolean, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.service.euicc.EuiccProfileInfo>); + field public static final int CANCEL_REASON_END_USER_REJECTED = 0; // 0x0 + field public static final int CANCEL_REASON_POSTPONED = 1; // 0x1 + field public static final int CANCEL_REASON_PPR_NOT_ALLOWED = 3; // 0x3 + field public static final int CANCEL_REASON_TIMEOUT = 2; // 0x2 + 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_OK = 0; // 0x0 + field public static final int RESULT_UNKNOWN_ERROR = -1; // 0xffffffff + } + + public static abstract class EuiccCardManager.CancelReason implements java.lang.annotation.Annotation { + } + + public static abstract class EuiccCardManager.ResetOption implements java.lang.annotation.Annotation { + } + + public static abstract interface EuiccCardManager.ResultCallback<T> { + method public abstract void onComplete(int, T); + } + + public class EuiccManager { + method public void continueOperation(android.content.Intent, android.os.Bundle); + method public void getDefaultDownloadableSubscriptionList(android.app.PendingIntent); + method public void getDownloadableSubscriptionMetadata(android.telephony.euicc.DownloadableSubscription, android.app.PendingIntent); + method public int getOtaStatus(); + field public static final java.lang.String ACTION_OTA_STATUS_CHANGED = "android.telephony.euicc.action.OTA_STATUS_CHANGED"; + field public static final java.lang.String ACTION_PROVISION_EMBEDDED_SUBSCRIPTION = "android.telephony.euicc.action.PROVISION_EMBEDDED_SUBSCRIPTION"; + field public static final int EUICC_OTA_FAILED = 2; // 0x2 + field public static final int EUICC_OTA_IN_PROGRESS = 1; // 0x1 + field public static final int EUICC_OTA_NOT_NEEDED = 4; // 0x4 + field public static final int EUICC_OTA_STATUS_UNAVAILABLE = 5; // 0x5 + field public static final int EUICC_OTA_SUCCEEDED = 3; // 0x3 + field public static final java.lang.String EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTION = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTION"; + field public static final java.lang.String EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTIONS = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTIONS"; + } + + public static abstract class EuiccManager.OtaStatus implements java.lang.annotation.Annotation { + } + + public final class EuiccNotification implements android.os.Parcelable { + ctor public EuiccNotification(int, java.lang.String, int, byte[]); + method public int describeContents(); + method public byte[] getData(); + method public int getEvent(); + method public int getSeq(); + method public java.lang.String getTargetAddr(); + method public void writeToParcel(android.os.Parcel, int); + field public static final int ALL_EVENTS = 15; // 0xf + field public static final android.os.Parcelable.Creator<android.telephony.euicc.EuiccNotification> CREATOR; + field public static final int EVENT_DELETE = 8; // 0x8 + field public static final int EVENT_DISABLE = 4; // 0x4 + field public static final int EVENT_ENABLE = 2; // 0x2 + field public static final int EVENT_INSTALL = 1; // 0x1 + } + + public static abstract class EuiccNotification.Event implements java.lang.annotation.Annotation { + } + + public final class EuiccRulesAuthTable implements android.os.Parcelable { + method public int describeContents(); + method public int findIndex(int, android.service.carrier.CarrierIdentifier); + method public boolean hasPolicyRuleFlag(int, int); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator<android.telephony.euicc.EuiccRulesAuthTable> CREATOR; + field public static final int POLICY_RULE_FLAG_CONSENT_REQUIRED = 1; // 0x1 + } + + public static final class EuiccRulesAuthTable.Builder { + ctor public EuiccRulesAuthTable.Builder(int); + method public android.telephony.euicc.EuiccRulesAuthTable.Builder add(int, java.util.List<android.service.carrier.CarrierIdentifier>, int); + method public android.telephony.euicc.EuiccRulesAuthTable build(); + } + + public static abstract class EuiccRulesAuthTable.PolicyRuleFlag implements java.lang.annotation.Annotation { + } + +} + package android.telephony.ims { public final class ImsCallForwardInfo implements android.os.Parcelable { diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 77e118ccb1bf..b29644bcf320 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -3444,9 +3444,6 @@ public class DevicePolicyManager { /** * Flag for {@link #wipeData(int)}: also erase the device's eUICC data. - * - * TODO(b/35851809): make this public. - * @hide */ public static final int WIPE_EUICC = 0x0004; diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index bb37eb31b5ba..68f442e55188 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -3672,10 +3672,8 @@ public abstract class Context { * * @see #getSystemService(String) * @see android.telephony.euicc.EuiccManager - * TODO(b/35851809): Unhide this API. - * @hide */ - public static final String EUICC_SERVICE = "euicc_service"; + public static final String EUICC_SERVICE = "euicc"; /** * Use with {@link #getSystemService(String)} to retrieve a @@ -3683,10 +3681,10 @@ public abstract class Context { * * @see #getSystemService(String) * @see android.telephony.euicc.EuiccCardManager - * TODO(b/35851809): Make this a SystemApi. * @hide */ - public static final String EUICC_CARD_SERVICE = "euicc_card_service"; + @SystemApi + public static final String EUICC_CARD_SERVICE = "euicc_card"; /** * Use with {@link #getSystemService(String)} to retrieve a diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 486c86cedba3..08fccab6a5b2 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -2108,8 +2108,6 @@ public abstract class PackageManager { /** * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device * supports embedded subscriptions on eUICCs. - * TODO(b/35851809): Make this public. - * @hide */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_TELEPHONY_EUICC = "android.hardware.telephony.euicc"; diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 84996e03a641..d14ac208ab2c 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -8563,9 +8563,8 @@ public final class Settings { * * @see android.service.euicc.EuiccService * @hide - * - * TODO(b/35851809): Make this a SystemApi. */ + @SystemApi public static final String DEFAULT_SM_DP_PLUS = "default_sm_dp_plus"; /** diff --git a/core/java/android/service/euicc/EuiccProfileInfo.java b/core/java/android/service/euicc/EuiccProfileInfo.java index 8e752d1c6c1d..cb4f10455ec9 100644 --- a/core/java/android/service/euicc/EuiccProfileInfo.java +++ b/core/java/android/service/euicc/EuiccProfileInfo.java @@ -17,6 +17,7 @@ package android.service.euicc; import android.annotation.IntDef; import android.annotation.Nullable; +import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; import android.service.carrier.CarrierIdentifier; @@ -26,15 +27,15 @@ import android.text.TextUtils; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Arrays; +import java.util.List; import java.util.Objects; /** * Information about an embedded profile (subscription) on an eUICC. * * @hide - * - * TODO(b/35851809): Make this a SystemApi. */ +@SystemApi public final class EuiccProfileInfo implements Parcelable { /** Profile policy rules (bit mask) */ @@ -44,6 +45,7 @@ public final class EuiccProfileInfo implements Parcelable { POLICY_RULE_DO_NOT_DELETE, POLICY_RULE_DELETE_AFTER_DISABLING }) + /** @hide */ public @interface PolicyRule {} /** Once this profile is enabled, it cannot be disabled. */ public static final int POLICY_RULE_DO_NOT_DISABLE = 1; @@ -60,6 +62,7 @@ public final class EuiccProfileInfo implements Parcelable { PROFILE_CLASS_OPERATIONAL, PROFILE_CLASS_UNSET }) + /** @hide */ public @interface ProfileClass {} /** Testing profiles */ public static final int PROFILE_CLASS_TESTING = 0; @@ -80,6 +83,7 @@ public final class EuiccProfileInfo implements Parcelable { PROFILE_STATE_ENABLED, PROFILE_STATE_UNSET }) + /** @hide */ public @interface ProfileState {} /** Disabled profiles */ public static final int PROFILE_STATE_DISABLED = 0; @@ -92,34 +96,34 @@ public final class EuiccProfileInfo implements Parcelable { public static final int PROFILE_STATE_UNSET = -1; /** The iccid of the subscription. */ - public final String iccid; + private final String mIccid; /** An optional nickname for the subscription. */ - public final @Nullable String nickname; + private final @Nullable String mNickname; /** The service provider name for the subscription. */ - public final String serviceProviderName; + private final String mServiceProviderName; /** The profile name for the subscription. */ - public final String profileName; + private final String mProfileName; /** Profile class for the subscription. */ - @ProfileClass public final int profileClass; + @ProfileClass private final int mProfileClass; /** The profile state of the subscription. */ - @ProfileState public final int state; + @ProfileState private final int mState; /** The operator Id of the subscription. */ - public final CarrierIdentifier carrierIdentifier; + private final CarrierIdentifier mCarrierIdentifier; /** The policy rules of the subscription. */ - @PolicyRule public final int policyRules; + @PolicyRule private final int mPolicyRules; /** * Optional access rules defining which apps can manage this subscription. If unset, only the * platform can manage it. */ - public final @Nullable UiccAccessRule[] accessRules; + private final @Nullable UiccAccessRule[] mAccessRules; public static final Creator<EuiccProfileInfo> CREATOR = new Creator<EuiccProfileInfo>() { @Override @@ -144,51 +148,51 @@ public final class EuiccProfileInfo implements Parcelable { if (!TextUtils.isDigitsOnly(iccid)) { throw new IllegalArgumentException("iccid contains invalid characters: " + iccid); } - this.iccid = iccid; - this.accessRules = accessRules; - this.nickname = nickname; - - this.serviceProviderName = null; - this.profileName = null; - this.profileClass = PROFILE_CLASS_UNSET; - this.state = PROFILE_CLASS_UNSET; - this.carrierIdentifier = null; - this.policyRules = 0; + this.mIccid = iccid; + this.mAccessRules = accessRules; + this.mNickname = nickname; + + this.mServiceProviderName = null; + this.mProfileName = null; + this.mProfileClass = PROFILE_CLASS_UNSET; + this.mState = PROFILE_STATE_UNSET; + this.mCarrierIdentifier = null; + this.mPolicyRules = 0; } private EuiccProfileInfo(Parcel in) { - iccid = in.readString(); - nickname = in.readString(); - serviceProviderName = in.readString(); - profileName = in.readString(); - profileClass = in.readInt(); - state = in.readInt(); + mIccid = in.readString(); + mNickname = in.readString(); + mServiceProviderName = in.readString(); + mProfileName = in.readString(); + mProfileClass = in.readInt(); + mState = in.readInt(); byte exist = in.readByte(); if (exist == (byte) 1) { - carrierIdentifier = CarrierIdentifier.CREATOR.createFromParcel(in); + mCarrierIdentifier = CarrierIdentifier.CREATOR.createFromParcel(in); } else { - carrierIdentifier = null; + mCarrierIdentifier = null; } - policyRules = in.readInt(); - accessRules = in.createTypedArray(UiccAccessRule.CREATOR); + mPolicyRules = in.readInt(); + mAccessRules = in.createTypedArray(UiccAccessRule.CREATOR); } @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(iccid); - dest.writeString(nickname); - dest.writeString(serviceProviderName); - dest.writeString(profileName); - dest.writeInt(profileClass); - dest.writeInt(state); - if (carrierIdentifier != null) { + dest.writeString(mIccid); + dest.writeString(mNickname); + dest.writeString(mServiceProviderName); + dest.writeString(mProfileName); + dest.writeInt(mProfileClass); + dest.writeInt(mState); + if (mCarrierIdentifier != null) { dest.writeByte((byte) 1); - carrierIdentifier.writeToParcel(dest, flags); + mCarrierIdentifier.writeToParcel(dest, flags); } else { dest.writeByte((byte) 0); } - dest.writeInt(policyRules); - dest.writeTypedArray(accessRules, flags); + dest.writeInt(mPolicyRules); + dest.writeTypedArray(mAccessRules, flags); } @Override @@ -198,45 +202,50 @@ public final class EuiccProfileInfo implements Parcelable { /** The builder to build a new {@link EuiccProfileInfo} instance. */ public static final class Builder { - public String iccid; - public UiccAccessRule[] accessRules; - public String nickname; - public String serviceProviderName; - public String profileName; - @ProfileClass public int profileClass; - @ProfileState public int state; - public CarrierIdentifier carrierIdentifier; - @PolicyRule public int policyRules; - - public Builder() {} + private String mIccid; + private List<UiccAccessRule> mAccessRules; + private String mNickname; + private String mServiceProviderName; + private String mProfileName; + @ProfileClass private int mProfileClass; + @ProfileState private int mState; + private CarrierIdentifier mCarrierIdentifier; + @PolicyRule private int mPolicyRules; + + public Builder(String value) { + if (!TextUtils.isDigitsOnly(value)) { + throw new IllegalArgumentException("iccid contains invalid characters: " + value); + } + mIccid = value; + } public Builder(EuiccProfileInfo baseProfile) { - iccid = baseProfile.iccid; - nickname = baseProfile.nickname; - serviceProviderName = baseProfile.serviceProviderName; - profileName = baseProfile.profileName; - profileClass = baseProfile.profileClass; - state = baseProfile.state; - carrierIdentifier = baseProfile.carrierIdentifier; - policyRules = baseProfile.policyRules; - accessRules = baseProfile.accessRules; + mIccid = baseProfile.mIccid; + mNickname = baseProfile.mNickname; + mServiceProviderName = baseProfile.mServiceProviderName; + mProfileName = baseProfile.mProfileName; + mProfileClass = baseProfile.mProfileClass; + mState = baseProfile.mState; + mCarrierIdentifier = baseProfile.mCarrierIdentifier; + mPolicyRules = baseProfile.mPolicyRules; + mAccessRules = Arrays.asList(baseProfile.mAccessRules); } /** Builds the profile instance. */ public EuiccProfileInfo build() { - if (iccid == null) { + if (mIccid == null) { throw new IllegalStateException("ICCID must be set for a profile."); } return new EuiccProfileInfo( - iccid, - nickname, - serviceProviderName, - profileName, - profileClass, - state, - carrierIdentifier, - policyRules, - accessRules); + mIccid, + mNickname, + mServiceProviderName, + mProfileName, + mProfileClass, + mState, + mCarrierIdentifier, + mPolicyRules, + mAccessRules); } /** Sets the iccId of the subscription. */ @@ -244,55 +253,55 @@ public final class EuiccProfileInfo implements Parcelable { if (!TextUtils.isDigitsOnly(value)) { throw new IllegalArgumentException("iccid contains invalid characters: " + value); } - iccid = value; + mIccid = value; return this; } /** Sets the nickname of the subscription. */ public Builder setNickname(String value) { - nickname = value; + mNickname = value; return this; } /** Sets the service provider name of the subscription. */ public Builder setServiceProviderName(String value) { - serviceProviderName = value; + mServiceProviderName = value; return this; } /** Sets the profile name of the subscription. */ public Builder setProfileName(String value) { - profileName = value; + mProfileName = value; return this; } /** Sets the profile class of the subscription. */ public Builder setProfileClass(@ProfileClass int value) { - profileClass = value; + mProfileClass = value; return this; } /** Sets the state of the subscription. */ public Builder setState(@ProfileState int value) { - state = value; + mState = value; return this; } /** Sets the carrier identifier of the subscription. */ public Builder setCarrierIdentifier(CarrierIdentifier value) { - carrierIdentifier = value; + mCarrierIdentifier = value; return this; } /** Sets the policy rules of the subscription. */ public Builder setPolicyRules(@PolicyRule int value) { - policyRules = value; + mPolicyRules = value; return this; } /** Sets the access rules of the subscription. */ - public Builder setUiccAccessRule(@Nullable UiccAccessRule[] value) { - accessRules = value; + public Builder setUiccAccessRule(@Nullable List<UiccAccessRule> value) { + mAccessRules = value; return this; } } @@ -306,75 +315,81 @@ public final class EuiccProfileInfo implements Parcelable { @ProfileState int state, CarrierIdentifier carrierIdentifier, @PolicyRule int policyRules, - @Nullable UiccAccessRule[] accessRules) { - this.iccid = iccid; - this.nickname = nickname; - this.serviceProviderName = serviceProviderName; - this.profileName = profileName; - this.profileClass = profileClass; - this.state = state; - this.carrierIdentifier = carrierIdentifier; - this.policyRules = policyRules; - this.accessRules = accessRules; + @Nullable List<UiccAccessRule> accessRules) { + this.mIccid = iccid; + this.mNickname = nickname; + this.mServiceProviderName = serviceProviderName; + this.mProfileName = profileName; + this.mProfileClass = profileClass; + this.mState = state; + this.mCarrierIdentifier = carrierIdentifier; + this.mPolicyRules = policyRules; + if (accessRules != null && accessRules.size() > 0) { + this.mAccessRules = accessRules.toArray(new UiccAccessRule[accessRules.size()]); + } else { + this.mAccessRules = null; + } } /** Gets the ICCID string. */ public String getIccid() { - return iccid; + return mIccid; } /** Gets the access rules. */ @Nullable - public UiccAccessRule[] getUiccAccessRules() { - return accessRules; + public List<UiccAccessRule> getUiccAccessRules() { + if (mAccessRules == null) return null; + return Arrays.asList(mAccessRules); } /** Gets the nickname. */ + @Nullable public String getNickname() { - return nickname; + return mNickname; } /** Gets the service provider name. */ public String getServiceProviderName() { - return serviceProviderName; + return mServiceProviderName; } /** Gets the profile name. */ public String getProfileName() { - return profileName; + return mProfileName; } /** Gets the profile class. */ @ProfileClass public int getProfileClass() { - return profileClass; + return mProfileClass; } /** Gets the state of the subscription. */ @ProfileState public int getState() { - return state; + return mState; } /** Gets the carrier identifier. */ public CarrierIdentifier getCarrierIdentifier() { - return carrierIdentifier; + return mCarrierIdentifier; } /** Gets the policy rules. */ @PolicyRule public int getPolicyRules() { - return policyRules; + return mPolicyRules; } /** Returns whether any policy rule exists. */ public boolean hasPolicyRules() { - return policyRules != 0; + return mPolicyRules != 0; } /** Checks whether a certain policy rule exists. */ public boolean hasPolicyRule(@PolicyRule int policy) { - return (policyRules & policy) != 0; + return (mPolicyRules & policy) != 0; } @Override @@ -387,50 +402,50 @@ public final class EuiccProfileInfo implements Parcelable { } EuiccProfileInfo that = (EuiccProfileInfo) obj; - return Objects.equals(iccid, that.iccid) - && Objects.equals(nickname, that.nickname) - && Objects.equals(serviceProviderName, that.serviceProviderName) - && Objects.equals(profileName, that.profileName) - && profileClass == that.profileClass - && state == that.state - && Objects.equals(carrierIdentifier, that.carrierIdentifier) - && policyRules == that.policyRules - && Arrays.equals(accessRules, that.accessRules); + return Objects.equals(mIccid, that.mIccid) + && Objects.equals(mNickname, that.mNickname) + && Objects.equals(mServiceProviderName, that.mServiceProviderName) + && Objects.equals(mProfileName, that.mProfileName) + && mProfileClass == that.mProfileClass + && mState == that.mState + && Objects.equals(mCarrierIdentifier, that.mCarrierIdentifier) + && mPolicyRules == that.mPolicyRules + && Arrays.equals(mAccessRules, that.mAccessRules); } @Override public int hashCode() { int result = 1; - result = 31 * result + Objects.hashCode(iccid); - result = 31 * result + Objects.hashCode(nickname); - result = 31 * result + Objects.hashCode(serviceProviderName); - result = 31 * result + Objects.hashCode(profileName); - result = 31 * result + profileClass; - result = 31 * result + state; - result = 31 * result + Objects.hashCode(carrierIdentifier); - result = 31 * result + policyRules; - result = 31 * result + Arrays.hashCode(accessRules); + result = 31 * result + Objects.hashCode(mIccid); + result = 31 * result + Objects.hashCode(mNickname); + result = 31 * result + Objects.hashCode(mServiceProviderName); + result = 31 * result + Objects.hashCode(mProfileName); + result = 31 * result + mProfileClass; + result = 31 * result + mState; + result = 31 * result + Objects.hashCode(mCarrierIdentifier); + result = 31 * result + mPolicyRules; + result = 31 * result + Arrays.hashCode(mAccessRules); return result; } @Override public String toString() { return "EuiccProfileInfo (nickname=" - + nickname + + mNickname + ", serviceProviderName=" - + serviceProviderName + + mServiceProviderName + ", profileName=" - + profileName + + mProfileName + ", profileClass=" - + profileClass + + mProfileClass + ", state=" - + state + + mState + ", CarrierIdentifier=" - + carrierIdentifier.toString() + + mCarrierIdentifier.toString() + ", policyRules=" - + policyRules + + mPolicyRules + ", accessRules=" - + Arrays.toString(accessRules) + + Arrays.toString(mAccessRules) + ")"; } } diff --git a/core/java/android/service/euicc/EuiccService.java b/core/java/android/service/euicc/EuiccService.java index be8580074f73..b87faef5bb44 100644 --- a/core/java/android/service/euicc/EuiccService.java +++ b/core/java/android/service/euicc/EuiccService.java @@ -17,6 +17,7 @@ package android.service.euicc; import android.annotation.CallSuper; import android.annotation.Nullable; +import android.annotation.SystemApi; import android.app.Service; import android.content.Intent; import android.os.IBinder; @@ -41,8 +42,11 @@ import java.util.concurrent.atomic.AtomicInteger; * <p>To implement the LPA backend, you must extend this class and declare this service in your * manifest file. The service must require the * {@link android.Manifest.permission#BIND_EUICC_SERVICE} permission and include an intent filter - * with the {@link #EUICC_SERVICE_INTERFACE} action. The priority of the intent filter must be set - * to a non-zero value in case multiple implementations are present on the device. For example: + * with the {@link #EUICC_SERVICE_INTERFACE} action. It's suggested that the priority of the intent + * filter to be set to a non-zero value in case multiple implementations are present on the device. + * See the below example. Note that there will be problem if two LPAs are present and they have the + * same priority. + * Example: * * <pre>{@code * <service android:name=".MyEuiccService" @@ -65,9 +69,9 @@ import java.util.concurrent.atomic.AtomicInteger; * filter with the appropriate action, the {@link #CATEGORY_EUICC_UI} category, and a non-zero * priority. * - * TODO(b/35851809): Make this a SystemApi. * @hide */ +@SystemApi public abstract class EuiccService extends Service { /** Action which must be included in this service's intent filter. */ public static final String EUICC_SERVICE_INTERFACE = "android.service.euicc.EuiccService"; @@ -77,7 +81,10 @@ public abstract class EuiccService extends Service { // LUI actions. These are passthroughs of the corresponding EuiccManager actions. - /** @see android.telephony.euicc.EuiccManager#ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS */ + /** + * @see android.telephony.euicc.EuiccManager#ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS + * The difference is this one is used by system to bring up the LUI. + */ public static final String ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS = "android.service.euicc.action.MANAGE_EMBEDDED_SUBSCRIPTIONS"; /** @see android.telephony.euicc.EuiccManager#ACTION_PROVISION_EMBEDDED_SUBSCRIPTION */ @@ -88,7 +95,10 @@ public abstract class EuiccService extends Service { // require user interaction. // TODO(b/33075886): Define extras for any input parameters to these dialogs once they are // more scoped out. - /** Alert the user that this action will result in an active SIM being deactivated. */ + /** + * Alert the user that this action will result in an active SIM being deactivated. + * To implement the LUI triggered by the system, you need to define this in AndroidManifest.xml. + */ public static final String ACTION_RESOLVE_DEACTIVATE_SIM = "android.service.euicc.action.RESOLVE_DEACTIVATE_SIM"; /** @@ -102,7 +112,11 @@ public abstract class EuiccService extends Service { public static final String ACTION_RESOLVE_CONFIRMATION_CODE = "android.service.euicc.action.RESOLVE_CONFIRMATION_CODE"; - /** Intent extra set for resolution requests containing the package name of the calling app. */ + /** + * Intent extra set for resolution requests containing the package name of the calling app. + * This is used by the above actions including ACTION_RESOLVE_DEACTIVATE_SIM, + * ACTION_RESOLVE_NO_PRIVILEGES and ACTION_RESOLVE_CONFIRMATION_CODE. + */ public static final String EXTRA_RESOLUTION_CALLING_PACKAGE = "android.service.euicc.extra.RESOLUTION_CALLING_PACKAGE"; @@ -136,10 +150,18 @@ public abstract class EuiccService extends Service { RESOLUTION_ACTIONS.add(EuiccService.ACTION_RESOLVE_CONFIRMATION_CODE); } - /** Boolean extra for resolution actions indicating whether the user granted consent. */ - public static final String RESOLUTION_EXTRA_CONSENT = "consent"; - /** String extra for resolution actions indicating the carrier confirmation code. */ - public static final String RESOLUTION_EXTRA_CONFIRMATION_CODE = "confirmation_code"; + /** + * Boolean extra for resolution actions indicating whether the user granted consent. + * This is used and set by the implementation and used in {@code EuiccOperation}. + */ + public static final String EXTRA_RESOLUTION_CONSENT = + "android.service.euicc.extra.RESOLUTION_CONSENT"; + /** + * String extra for resolution actions indicating the carrier confirmation code. + * This is used and set by the implementation and used in {@code EuiccOperation}. + */ + public static final String EXTRA_RESOLUTION_CONFIRMATION_CODE = + "android.service.euicc.extra.RESOLUTION_CONFIRMATION_CODE"; private final IEuiccService.Stub mStubWrapper; @@ -199,9 +221,9 @@ public abstract class EuiccService extends Service { * * @see IEuiccService#startOtaIfNecessary */ - public interface OtaStatusChangedCallback { + public abstract static class OtaStatusChangedCallback { /** Called when OTA status is changed. */ - void onOtaStatusChanged(int status); + public abstract void onOtaStatusChanged(int status); } /** @@ -238,8 +260,7 @@ public abstract class EuiccService extends Service { /** * Populate {@link DownloadableSubscription} metadata for the given downloadable subscription. * - * @param slotId ID of the SIM slot to use for the operation. This is currently not populated - * but is here to future-proof the APIs. + * @param slotId ID of the SIM slot to use for the operation. * @param subscription A subscription whose metadata needs to be populated. * @param forceDeactivateSim If true, and if an active SIM must be deactivated to access the * eUICC, perform this action automatically. Otherwise, {@link #RESULT_MUST_DEACTIVATE_SIM)} @@ -267,8 +288,7 @@ public abstract class EuiccService extends Service { /** * Download the given subscription. * - * @param slotId ID of the SIM slot to use for the operation. This is currently not populated - * but is here to future-proof the APIs. + * @param slotId ID of the SIM slot to use for the operation. * @param subscription The subscription to download. * @param switchAfterDownload If true, the subscription should be enabled upon successful * download. @@ -286,8 +306,7 @@ public abstract class EuiccService extends Service { /** * Return a list of all @link EuiccProfileInfo}s. * - * @param slotId ID of the SIM slot to use for the operation. This is currently not populated - * but is here to future-proof the APIs. + * @param slotId ID of the SIM slot to use for the operation. * @return The result of the operation. * @see android.telephony.SubscriptionManager#getAvailableSubscriptionInfoList * @see android.telephony.SubscriptionManager#getAccessibleSubscriptionInfoList @@ -297,8 +316,7 @@ public abstract class EuiccService extends Service { /** * Return info about the eUICC chip/device. * - * @param slotId ID of the SIM slot to use for the operation. This is currently not populated - * but is here to future-proof the APIs. + * @param slotId ID of the SIM slot to use for the operation. * @return the {@link EuiccInfo} for the eUICC chip/device. * @see android.telephony.euicc.EuiccManager#getEuiccInfo */ @@ -310,8 +328,7 @@ public abstract class EuiccService extends Service { * <p>If the subscription is currently active, it should be deactivated first (equivalent to a * physical SIM being ejected). * - * @param slotId ID of the SIM slot to use for the operation. This is currently not populated - * but is here to future-proof the APIs. + * @param slotId ID of the SIM slot to use for the operation. * @param iccid the ICCID of the subscription to delete. * @return the result of the delete operation. May be one of the predefined {@code RESULT_} * constants or any implementation-specific code starting with {@link #RESULT_FIRST_USER}. @@ -322,8 +339,7 @@ public abstract class EuiccService extends Service { /** * Switch to the given subscription. * - * @param slotId ID of the SIM slot to use for the operation. This is currently not populated - * but is here to future-proof the APIs. + * @param slotId ID of the SIM slot to use for the operation. * @param iccid the ICCID of the subscription to enable. May be null, in which case the current * profile should be deactivated and no profile should be activated to replace it - this is * equivalent to a physical SIM being ejected. @@ -340,8 +356,7 @@ public abstract class EuiccService extends Service { /** * Update the nickname of the given subscription. * - * @param slotId ID of the SIM slot to use for the operation. This is currently not populated - * but is here to future-proof the APIs. + * @param slotId ID of the SIM slot to use for the operation. * @param iccid the ICCID of the subscription to update. * @param nickname the new nickname to apply. * @return the result of the update operation. May be one of the predefined {@code RESULT_} diff --git a/core/java/android/service/euicc/GetDefaultDownloadableSubscriptionListResult.java b/core/java/android/service/euicc/GetDefaultDownloadableSubscriptionListResult.java index 5a24492007f3..e2171ae6bc76 100644 --- a/core/java/android/service/euicc/GetDefaultDownloadableSubscriptionListResult.java +++ b/core/java/android/service/euicc/GetDefaultDownloadableSubscriptionListResult.java @@ -16,16 +16,19 @@ package android.service.euicc; import android.annotation.Nullable; +import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; import android.telephony.euicc.DownloadableSubscription; +import java.util.Arrays; +import java.util.List; + /** * Result of a {@link EuiccService#onGetDefaultDownloadableSubscriptionList} operation. * @hide - * - * TODO(b/35851809): Make this a SystemApi. */ +@SystemApi public final class GetDefaultDownloadableSubscriptionListResult implements Parcelable { public static final Creator<GetDefaultDownloadableSubscriptionListResult> CREATOR = @@ -42,20 +45,35 @@ public final class GetDefaultDownloadableSubscriptionListResult implements Parce }; /** - * Result of the operation. + * @hide + * @deprecated - Do no use. Use getResult() instead. + */ + @Deprecated + public final int result; + + @Nullable + private final DownloadableSubscription[] mSubscriptions; + + /** + * Gets the result of the operation. * * <p>May be one of the predefined {@code RESULT_} constants in EuiccService or any * implementation-specific code starting with {@link EuiccService#RESULT_FIRST_USER}. */ - public final int result; + public int getResult() { + return result; + } /** - * The available {@link DownloadableSubscription}s (with filled-in metadata). + * Gets the available {@link DownloadableSubscription}s (with filled-in metadata). * * <p>Only non-null if {@link #result} is {@link EuiccService#RESULT_OK}. */ @Nullable - public final DownloadableSubscription[] subscriptions; + public List<DownloadableSubscription> getDownloadableSubscriptions() { + if (mSubscriptions == null) return null; + return Arrays.asList(mSubscriptions); + } /** * Construct a new {@link GetDefaultDownloadableSubscriptionListResult}. @@ -70,25 +88,25 @@ public final class GetDefaultDownloadableSubscriptionListResult implements Parce @Nullable DownloadableSubscription[] subscriptions) { this.result = result; if (this.result == EuiccService.RESULT_OK) { - this.subscriptions = subscriptions; + this.mSubscriptions = subscriptions; } else { if (subscriptions != null) { throw new IllegalArgumentException( "Error result with non-null subscriptions: " + result); } - this.subscriptions = null; + this.mSubscriptions = null; } } private GetDefaultDownloadableSubscriptionListResult(Parcel in) { this.result = in.readInt(); - this.subscriptions = in.createTypedArray(DownloadableSubscription.CREATOR); + this.mSubscriptions = in.createTypedArray(DownloadableSubscription.CREATOR); } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(result); - dest.writeTypedArray(subscriptions, flags); + dest.writeTypedArray(mSubscriptions, flags); } @Override diff --git a/core/java/android/service/euicc/GetDownloadableSubscriptionMetadataResult.java b/core/java/android/service/euicc/GetDownloadableSubscriptionMetadataResult.java index de8a30706945..1edb5398add4 100644 --- a/core/java/android/service/euicc/GetDownloadableSubscriptionMetadataResult.java +++ b/core/java/android/service/euicc/GetDownloadableSubscriptionMetadataResult.java @@ -16,6 +16,7 @@ package android.service.euicc; import android.annotation.Nullable; +import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; import android.telephony.euicc.DownloadableSubscription; @@ -23,9 +24,8 @@ import android.telephony.euicc.DownloadableSubscription; /** * Result of a {@link EuiccService#onGetDownloadableSubscriptionMetadata} operation. * @hide - * - * TODO(b/35851809): Make this a SystemApi. */ +@SystemApi public final class GetDownloadableSubscriptionMetadataResult implements Parcelable { public static final Creator<GetDownloadableSubscriptionMetadataResult> CREATOR = @@ -42,20 +42,34 @@ public final class GetDownloadableSubscriptionMetadataResult implements Parcelab }; /** - * Result of the operation. + * @hide + * @deprecated - Do no use. Use getResult() instead. + */ + @Deprecated + public final int result; + + @Nullable + private final DownloadableSubscription mSubscription; + + /** + * Gets the result of the operation. * * <p>May be one of the predefined {@code RESULT_} constants in EuiccService or any * implementation-specific code starting with {@link EuiccService#RESULT_FIRST_USER}. */ - public final int result; + public int getResult() { + return result; + } /** - * The {@link DownloadableSubscription} with filled-in metadata. + * Gets the {@link DownloadableSubscription} with filled-in metadata. * * <p>Only non-null if {@link #result} is {@link EuiccService#RESULT_OK}. */ @Nullable - public final DownloadableSubscription subscription; + public DownloadableSubscription getDownloadableSubscription() { + return mSubscription; + } /** * Construct a new {@link GetDownloadableSubscriptionMetadataResult}. @@ -70,25 +84,25 @@ public final class GetDownloadableSubscriptionMetadataResult implements Parcelab @Nullable DownloadableSubscription subscription) { this.result = result; if (this.result == EuiccService.RESULT_OK) { - this.subscription = subscription; + this.mSubscription = subscription; } else { if (subscription != null) { throw new IllegalArgumentException( "Error result with non-null subscription: " + result); } - this.subscription = null; + this.mSubscription = null; } } private GetDownloadableSubscriptionMetadataResult(Parcel in) { this.result = in.readInt(); - this.subscription = in.readTypedObject(DownloadableSubscription.CREATOR); + this.mSubscription = in.readTypedObject(DownloadableSubscription.CREATOR); } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(result); - dest.writeTypedObject(this.subscription, flags); + dest.writeTypedObject(this.mSubscription, flags); } @Override diff --git a/core/java/android/service/euicc/GetEuiccProfileInfoListResult.java b/core/java/android/service/euicc/GetEuiccProfileInfoListResult.java index 7ad84888dc82..464d136e70e5 100644 --- a/core/java/android/service/euicc/GetEuiccProfileInfoListResult.java +++ b/core/java/android/service/euicc/GetEuiccProfileInfoListResult.java @@ -16,15 +16,18 @@ package android.service.euicc; import android.annotation.Nullable; +import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; +import java.util.Arrays; +import java.util.List; + /** * Result of a {@link EuiccService#onGetEuiccProfileInfoList} operation. * @hide - * - * TODO(b/35851809): Make this a SystemApi. */ +@SystemApi public final class GetEuiccProfileInfoListResult implements Parcelable { public static final Creator<GetEuiccProfileInfoListResult> CREATOR = @@ -41,19 +44,38 @@ public final class GetEuiccProfileInfoListResult implements Parcelable { }; /** - * Result of the operation. + * @hide + * @deprecated - Do no use. Use getResult() instead. + */ + @Deprecated + public final int result; + + @Nullable + private final EuiccProfileInfo[] mProfiles; + + private final boolean mIsRemovable; + + /** + * Gets the result of the operation. * * <p>May be one of the predefined {@code RESULT_} constants in EuiccService or any * implementation-specific code starting with {@link EuiccService#RESULT_FIRST_USER}. */ - public final int result; + public int getResult() { + return result; + } - /** The profile list (only upon success). */ + /** Gets the profile list (only upon success). */ @Nullable - public final EuiccProfileInfo[] profiles; + public List<EuiccProfileInfo> getProfiles() { + if (mProfiles == null) return null; + return Arrays.asList(mProfiles); + } - /** Whether the eUICC is removable. */ - public final boolean isRemovable; + /** Gets whether the eUICC is removable. */ + public boolean getIsRemovable() { + return mIsRemovable; + } /** * Construct a new {@link GetEuiccProfileInfoListResult}. @@ -71,30 +93,29 @@ public final class GetEuiccProfileInfoListResult implements Parcelable { public GetEuiccProfileInfoListResult( int result, @Nullable EuiccProfileInfo[] profiles, boolean isRemovable) { this.result = result; - this.isRemovable = isRemovable; + this.mIsRemovable = isRemovable; if (this.result == EuiccService.RESULT_OK) { - this.profiles = profiles; + this.mProfiles = profiles; } else { if (profiles != null) { throw new IllegalArgumentException( "Error result with non-null profiles: " + result); } - this.profiles = null; + this.mProfiles = null; } - } private GetEuiccProfileInfoListResult(Parcel in) { this.result = in.readInt(); - this.profiles = in.createTypedArray(EuiccProfileInfo.CREATOR); - this.isRemovable = in.readBoolean(); + this.mProfiles = in.createTypedArray(EuiccProfileInfo.CREATOR); + this.mIsRemovable = in.readBoolean(); } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(result); - dest.writeTypedArray(profiles, flags); - dest.writeBoolean(isRemovable); + dest.writeTypedArray(mProfiles, flags); + dest.writeBoolean(mIsRemovable); } @Override diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index deefddbf5f73..a71844254b33 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -1811,19 +1811,20 @@ <permission android:name="android.permission.BIND_TELEPHONY_NETWORK_SERVICE" android:protectionLevel="signature" /> - <!-- Allows an application to manage embedded subscriptions (those on a eUICC) through - EuiccManager APIs. + <!-- @SystemApi Allows an application to manage embedded subscriptions (those on a eUICC) + through EuiccManager APIs. <p>Protection level: signature|privileged|development - TODO(b/35851809): Mark this as a SystemApi and remove com. prefix. - @hide --> - <permission android:name="com.android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS" + @hide + --> + <permission android:name="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS" android:protectionLevel="signature|privileged|development" /> - <!-- Must be required by an EuiccService to ensure that only the system can bind to it. + <!-- @SystemApi Must be required by an EuiccService to ensure that only the system can bind to + it. <p>Protection level: signature - TODO(b/35851809): Mark this as a SystemApi and remove com. prefix. - @hide --> - <permission android:name="com.android.permission.BIND_EUICC_SERVICE" + @hide + --> + <permission android:name="android.permission.BIND_EUICC_SERVICE" android:protectionLevel="signature" /> <!-- ================================== --> diff --git a/core/tests/coretests/src/android/service/euicc/EuiccProfileInfoTest.java b/core/tests/coretests/src/android/service/euicc/EuiccProfileInfoTest.java index 1e3ddf3226af..e69d1e7505d1 100644 --- a/core/tests/coretests/src/android/service/euicc/EuiccProfileInfoTest.java +++ b/core/tests/coretests/src/android/service/euicc/EuiccProfileInfoTest.java @@ -30,14 +30,15 @@ import android.telephony.UiccAccessRule; import org.junit.Test; import org.junit.runner.RunWith; +import java.util.Arrays; + @SmallTest @RunWith(AndroidJUnit4.class) public class EuiccProfileInfoTest { @Test public void testWriteToParcel() { EuiccProfileInfo p = - new EuiccProfileInfo.Builder() - .setIccid("21430000000000006587") + new EuiccProfileInfo.Builder("21430000000000006587") .setNickname("profile nickname") .setServiceProviderName("service provider") .setProfileName("profile name") @@ -50,9 +51,7 @@ public class EuiccProfileInfoTest { "45")) .setPolicyRules(EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE) .setUiccAccessRule( - new UiccAccessRule[] { - new UiccAccessRule(new byte[] {}, "package", 12345L) - }) + Arrays.asList(new UiccAccessRule(new byte[] {}, "package", 12345L))) .build(); Parcel parcel = Parcel.obtain(); @@ -68,8 +67,7 @@ public class EuiccProfileInfoTest { @Test public void testWriteToParcelNullCarrierId() { EuiccProfileInfo p = - new EuiccProfileInfo.Builder() - .setIccid("21430000000000006587") + new EuiccProfileInfo.Builder("21430000000000006587") .setNickname("profile nickname") .setServiceProviderName("service provider") .setProfileName("profile name") @@ -77,9 +75,8 @@ public class EuiccProfileInfoTest { .setState(EuiccProfileInfo.PROFILE_STATE_ENABLED) .setPolicyRules(EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE) .setUiccAccessRule( - new UiccAccessRule[] { - new UiccAccessRule(new byte[] {}, "package", 12345L) - }) + Arrays.asList(new UiccAccessRule(new byte[] {}, "package", 12345L)) + ) .build(); Parcel parcel = Parcel.obtain(); @@ -95,8 +92,7 @@ public class EuiccProfileInfoTest { @Test public void testBuilderAndGetters() { EuiccProfileInfo p = - new EuiccProfileInfo.Builder() - .setIccid("21430000000000006587") + new EuiccProfileInfo.Builder("21430000000000006587") .setNickname("profile nickname") .setProfileName("profile name") .setServiceProviderName("service provider") @@ -108,10 +104,7 @@ public class EuiccProfileInfoTest { .setState(EuiccProfileInfo.PROFILE_STATE_ENABLED) .setProfileClass(EuiccProfileInfo.PROFILE_CLASS_OPERATIONAL) .setPolicyRules(EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE) - .setUiccAccessRule( - new UiccAccessRule[] { - new UiccAccessRule(new byte[0], null, 0) - }) + .setUiccAccessRule(Arrays.asList(new UiccAccessRule(new byte[0], null, 0))) .build(); assertEquals("21430000000000006587", p.getIccid()); @@ -130,14 +123,13 @@ public class EuiccProfileInfoTest { assertFalse(p.hasPolicyRule(EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE)); assertArrayEquals( new UiccAccessRule[] {new UiccAccessRule(new byte[0], null, 0)}, - p.getUiccAccessRules()); + p.getUiccAccessRules().toArray()); } @Test public void testBuilder_BasedOnAnotherProfile() { EuiccProfileInfo p = - new EuiccProfileInfo.Builder() - .setIccid("21430000000000006587") + new EuiccProfileInfo.Builder("21430000000000006587") .setNickname("profile nickname") .setProfileName("profile name") .setServiceProviderName("service provider") @@ -150,9 +142,7 @@ public class EuiccProfileInfoTest { .setProfileClass(EuiccProfileInfo.PROFILE_CLASS_OPERATIONAL) .setPolicyRules(EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE) .setUiccAccessRule( - new UiccAccessRule[] { - new UiccAccessRule(new byte[0], null, 0) - }) + Arrays.asList(new UiccAccessRule(new byte[] {}, "package", 12345L))) .build(); EuiccProfileInfo copied = new EuiccProfileInfo.Builder(p).build(); @@ -164,8 +154,7 @@ public class EuiccProfileInfoTest { @Test public void testEqualsHashCode() { EuiccProfileInfo p = - new EuiccProfileInfo.Builder() - .setIccid("21430000000000006587") + new EuiccProfileInfo.Builder("21430000000000006587") .setNickname("profile nickname") .setProfileName("profile name") .setServiceProviderName("service provider") @@ -177,10 +166,7 @@ public class EuiccProfileInfoTest { .setState(EuiccProfileInfo.PROFILE_STATE_ENABLED) .setProfileClass(EuiccProfileInfo.PROFILE_STATE_ENABLED) .setPolicyRules(EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE) - .setUiccAccessRule( - new UiccAccessRule[] { - new UiccAccessRule(new byte[0], null, 0) - }) + .setUiccAccessRule(Arrays.asList(new UiccAccessRule(new byte[0], null, 0))) .build(); assertTrue(p.equals(p)); @@ -229,13 +215,13 @@ public class EuiccProfileInfoTest { } @Test(expected = IllegalStateException.class) - public void testBuilderBuild_NoIccid() { - new EuiccProfileInfo.Builder().build(); + public void testBuilderBuild_IllegalIccid() { + new EuiccProfileInfo.Builder("abc").build(); } @Test(expected = IllegalArgumentException.class) public void testBuilderSetOperatorMccMnc_Illegal() { - new EuiccProfileInfo.Builder() + new EuiccProfileInfo.Builder("21430000000000006587") .setCarrierIdentifier(new CarrierIdentifier(new byte[] {1, 2, 3, 4}, null, null)); } diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml index 3495b84e0ab9..9d1fdbd157d7 100644 --- a/data/etc/privapp-permissions-platform.xml +++ b/data/etc/privapp-permissions-platform.xml @@ -176,7 +176,7 @@ applications that come with the platform <permission name="android.permission.UPDATE_LOCK"/> <permission name="android.permission.WRITE_APN_SETTINGS"/> <permission name="android.permission.WRITE_SECURE_SETTINGS"/> - <permission name="com.android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS"/> + <permission name="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS"/> <permission name="com.android.voicemail.permission.READ_VOICEMAIL"/> <permission name="com.android.voicemail.permission.WRITE_VOICEMAIL"/> </privapp-permissions> @@ -381,7 +381,7 @@ applications that come with the platform <permission name="android.permission.WRITE_DREAM_STATE"/> <permission name="android.permission.WRITE_MEDIA_STORAGE"/> <permission name="android.permission.WRITE_SECURE_SETTINGS"/> - <permission name="com.android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS"/> + <permission name="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS"/> </privapp-permissions> <privapp-permissions package="com.android.tv"> diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index cbb3e8fcab57..643987d71b72 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -110,7 +110,7 @@ <uses-permission android:name="com.android.alarm.permission.SET_ALARM" /> <!-- Keyguard --> - <uses-permission android:name="com.android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS" /> + <uses-permission android:name="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS" /> <uses-permission android:name="android.permission.CONTROL_KEYGUARD" /> <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java index 38408fe3d0fd..77413d9c730d 100644 --- a/telephony/java/android/telephony/SubscriptionInfo.java +++ b/telephony/java/android/telephony/SubscriptionInfo.java @@ -17,6 +17,7 @@ package android.telephony; import android.annotation.Nullable; +import android.annotation.SystemApi; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; @@ -34,6 +35,8 @@ import android.os.Parcelable; import android.util.DisplayMetrics; import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; /** * A Parcelable class for Subscription Information. @@ -332,12 +335,7 @@ public class SubscriptionInfo implements Parcelable { return this.mCountryIso; } - /** - * @return whether the subscription is an embedded one. - * @hide - * - * TODO(b/35851809): Make this public. - */ + /** @return whether the subscription is an embedded one. */ public boolean isEmbedded() { return this.mIsEmbedded; } @@ -351,9 +349,9 @@ public class SubscriptionInfo implements Parcelable { * @return whether the app is authorized to manage this subscription per its metadata. * @throws UnsupportedOperationException if this subscription is not embedded. * @hide - * - * TODO(b/35851809): Make this public. + * @deprecated - Do not use. */ + @Deprecated public boolean canManageSubscription(Context context) { return canManageSubscription(context, context.getPackageName()); } @@ -367,7 +365,9 @@ public class SubscriptionInfo implements Parcelable { * @return whether the app is authorized to manage this subscription per its metadata. * @throws UnsupportedOperationException if this subscription is not embedded. * @hide + * @deprecated - Do not use. */ + @Deprecated public boolean canManageSubscription(Context context, String packageName) { if (!isEmbedded()) { throw new UnsupportedOperationException("Not an embedded subscription"); @@ -395,14 +395,14 @@ public class SubscriptionInfo implements Parcelable { * @return the {@link UiccAccessRule}s dictating who is authorized to manage this subscription. * @throws UnsupportedOperationException if this subscription is not embedded. * @hide - * - * TODO(b/35851809): Make this a SystemApi. */ - public @Nullable UiccAccessRule[] getAccessRules() { + @SystemApi + public @Nullable List<UiccAccessRule> getAccessRules() { if (!isEmbedded()) { throw new UnsupportedOperationException("Not an embedded subscription"); } - return mAccessRules; + if (mAccessRules == null) return null; + return Arrays.asList(mAccessRules); } /** diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index debf43da79b4..11a1984e8934 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -30,6 +30,7 @@ import android.annotation.SystemService; import android.app.BroadcastOptions; import android.content.Context; import android.content.Intent; +import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.content.res.Resources; @@ -822,10 +823,13 @@ public class SubscriptionManager { * if the list is non-empty the list is sorted by {@link SubscriptionInfo#getSimSlotIndex} * then by {@link SubscriptionInfo#getSubscriptionId}. * </ul> - * @hide * - * TODO(b/35851809): Make this a SystemApi. + * <p> + * Permissions android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE is required + * for #getAvailableSubscriptionInfoList to be invoked. + * @hide */ + @SystemApi public List<SubscriptionInfo> getAvailableSubscriptionInfoList() { List<SubscriptionInfo> result = null; @@ -863,9 +867,6 @@ public class SubscriptionManager { * if the list is non-empty the list is sorted by {@link SubscriptionInfo#getSimSlotIndex} * then by {@link SubscriptionInfo#getSubscriptionId}. * </ul> - * @hide - * - * TODO(b/35851809): Make this public. */ public List<SubscriptionInfo> getAccessibleSubscriptionInfoList() { List<SubscriptionInfo> result = null; @@ -891,9 +892,8 @@ public class SubscriptionManager { * * <p>Requires the {@link android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission. * @hide - * - * TODO(b/35851809): Make this a SystemApi. */ + @SystemApi public void requestEmbeddedSubscriptionInfoListRefresh() { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); @@ -1892,4 +1892,51 @@ public class SubscriptionManager { options.setTemporaryAppWhitelistDuration(TimeUnit.MINUTES.toMillis(1)); mContext.sendBroadcast(intent, null, options.toBundle()); } + + /** + * Checks whether the app with the given context is authorized to manage the given subscription + * according to its metadata. Only supported for embedded subscriptions (if + * {@code SubscriptionInfo#isEmbedded} returns true). + * + * @param info The subscription to check. + * @return whether the app is authorized to manage this subscription per its metadata. + * @throws UnsupportedOperationException if this subscription is not embedded. + */ + public boolean canManageSubscription(SubscriptionInfo info) { + return canManageSubscription(info, mContext.getPackageName()); + } + + /** + * Checks whether the given app is authorized to manage the given subscription according to its + * metadata. Only supported for embedded subscriptions (if {@code SubscriptionInfo#isEmbedded} + * returns true). + * + * @param info The subscription to check. + * @param packageName Package name of the app to check. + * @return whether the app is authorized to manage this subscription per its metadata. + * @throws UnsupportedOperationException if this subscription is not embedded. + * @hide + */ + public boolean canManageSubscription(SubscriptionInfo info, String packageName) { + if (!info.isEmbedded()) { + throw new UnsupportedOperationException("Not an embedded subscription"); + } + if (info.getAccessRules() == null) { + return false; + } + PackageManager packageManager = mContext.getPackageManager(); + PackageInfo packageInfo; + try { + packageInfo = packageManager.getPackageInfo(packageName, PackageManager.GET_SIGNATURES); + } catch (PackageManager.NameNotFoundException e) { + throw new IllegalArgumentException("Unknown package: " + packageName, e); + } + for (UiccAccessRule rule : info.getAccessRules()) { + if (rule.getCarrierPrivilegeStatus(packageInfo) + == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) { + return true; + } + } + return false; + } } diff --git a/telephony/java/android/telephony/UiccAccessRule.java b/telephony/java/android/telephony/UiccAccessRule.java index 39372019c20f..c3f8a1930409 100644 --- a/telephony/java/android/telephony/UiccAccessRule.java +++ b/telephony/java/android/telephony/UiccAccessRule.java @@ -16,6 +16,7 @@ package android.telephony; import android.annotation.Nullable; +import android.annotation.SystemApi; import android.content.pm.PackageInfo; import android.content.pm.Signature; import android.os.Parcel; @@ -39,9 +40,8 @@ import java.util.Objects; * specification. * * @hide - * - * TODO(b/35851809): Make this a SystemApi. */ +@SystemApi public final class UiccAccessRule implements Parcelable { private static final String TAG = "UiccAccessRule"; diff --git a/telephony/java/android/telephony/euicc/DownloadableSubscription.java b/telephony/java/android/telephony/euicc/DownloadableSubscription.java index 01041c8b1360..88db22b82c5c 100644 --- a/telephony/java/android/telephony/euicc/DownloadableSubscription.java +++ b/telephony/java/android/telephony/euicc/DownloadableSubscription.java @@ -16,18 +16,17 @@ package android.telephony.euicc; import android.annotation.Nullable; +import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; import android.telephony.UiccAccessRule; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import com.android.internal.util.Preconditions; -/** - * Information about a subscription which is available for download. - * - * TODO(b/35851809): Make this public. - * @hide - */ +/** Information about a subscription which is available for download. */ public final class DownloadableSubscription implements Parcelable { public static final Creator<DownloadableSubscription> CREATOR = @@ -46,11 +45,12 @@ public final class DownloadableSubscription implements Parcelable { /** * Activation code. May be null for subscriptions which are not based on activation codes, e.g. * to download a default subscription assigned to this device. + * Should use getEncodedActivationCode() instead. * @hide - * - * TODO(b/35851809): Make this a SystemApi. + * @deprecated - Do not use. This will be private. Use getEncodedActivationCode() instead. */ @Nullable + @Deprecated public final String encodedActivationCode; @Nullable private String confirmationCode; @@ -58,8 +58,16 @@ public final class DownloadableSubscription implements Parcelable { // see getCarrierName and setCarrierName @Nullable private String carrierName; + // see getAccessRules and setAccessRules - private UiccAccessRule[] accessRules; + @Nullable + private List<UiccAccessRule> accessRules; + + /** Gets the activation code. */ + @Nullable + public String getEncodedActivationCode() { + return encodedActivationCode; + } /** @hide */ private DownloadableSubscription(String encodedActivationCode) { @@ -70,7 +78,59 @@ public final class DownloadableSubscription implements Parcelable { encodedActivationCode = in.readString(); confirmationCode = in.readString(); carrierName = in.readString(); - accessRules = in.createTypedArray(UiccAccessRule.CREATOR); + accessRules = new ArrayList<UiccAccessRule>(); + in.readTypedList(accessRules, UiccAccessRule.CREATOR); + } + + private DownloadableSubscription(String encodedActivationCode, String confirmationCode, + String carrierName, List<UiccAccessRule> accessRules) { + this.encodedActivationCode = encodedActivationCode; + this.confirmationCode = confirmationCode; + this.carrierName = carrierName; + this.accessRules = accessRules; + } + + /** @hide */ + @SystemApi + public static final class Builder { + @Nullable private String encodedActivationCode; + @Nullable private String confirmationCode; + @Nullable private String carrierName; + List<UiccAccessRule> accessRules; + + public Builder() {} + + public Builder(DownloadableSubscription baseSubscription) { + encodedActivationCode = baseSubscription.getEncodedActivationCode(); + confirmationCode = baseSubscription.getConfirmationCode(); + carrierName = baseSubscription.getCarrierName(); + accessRules = baseSubscription.getAccessRules(); + } + + public DownloadableSubscription build() { + return new DownloadableSubscription(encodedActivationCode, confirmationCode, + carrierName, accessRules); + } + + public Builder setEncodedActivationCode(String value) { + encodedActivationCode = value; + return this; + } + + public Builder setConfirmationCode(String value) { + confirmationCode = value; + return this; + } + + public Builder setCarrierName(String value) { + carrierName = value; + return this; + } + + public Builder setAccessRules(List<UiccAccessRule> value) { + accessRules = value; + return this; + } } /** @@ -87,7 +147,10 @@ public final class DownloadableSubscription implements Parcelable { /** * Sets the confirmation code. + * @hide + * @deprecated - Do not use. */ + @Deprecated public void setConfirmationCode(String confirmationCode) { this.confirmationCode = confirmationCode; } @@ -103,9 +166,9 @@ public final class DownloadableSubscription implements Parcelable { /** * Set the user-visible carrier name. * @hide - * - * TODO(b/35851809): Make this a SystemApi. + * @deprecated - Do not use. */ + @Deprecated public void setCarrierName(String carrierName) { this.carrierName = carrierName; } @@ -117,44 +180,51 @@ public final class DownloadableSubscription implements Parcelable { * those created with {@link #forActivationCode}). May be populated with * {@link EuiccManager#getDownloadableSubscriptionMetadata}. * @hide - * - * TODO(b/35851809): Make this a SystemApi. */ + @SystemApi @Nullable public String getCarrierName() { return carrierName; } /** - * Returns the {@link UiccAccessRule}s dictating access to this subscription. + * Returns the {@link UiccAccessRule}s in list dictating access to this subscription. * * <p>Only present for downloadable subscriptions that were queried from a server (as opposed to * those created with {@link #forActivationCode}). May be populated with * {@link EuiccManager#getDownloadableSubscriptionMetadata}. * @hide - * - * TODO(b/35851809): Make this a SystemApi. */ - public UiccAccessRule[] getAccessRules() { + @SystemApi + public List<UiccAccessRule> getAccessRules() { return accessRules; } /** * Set the {@link UiccAccessRule}s dictating access to this subscription. * @hide - * - * TODO(b/35851809): Make this a SystemApi. + * @deprecated - Do not use. */ - public void setAccessRules(UiccAccessRule[] accessRules) { + @Deprecated + public void setAccessRules(List<UiccAccessRule> accessRules) { this.accessRules = accessRules; } + /** + * @hide + * @deprecated - Do not use. + */ + @Deprecated + public void setAccessRules(UiccAccessRule[] accessRules) { + this.accessRules = Arrays.asList(accessRules); + } + @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(encodedActivationCode); dest.writeString(confirmationCode); dest.writeString(carrierName); - dest.writeTypedArray(accessRules, flags); + dest.writeTypedList(accessRules); } @Override diff --git a/telephony/java/android/telephony/euicc/EuiccCardManager.java b/telephony/java/android/telephony/euicc/EuiccCardManager.java index a1a6a5a4d5bb..c3f40074308b 100644 --- a/telephony/java/android/telephony/euicc/EuiccCardManager.java +++ b/telephony/java/android/telephony/euicc/EuiccCardManager.java @@ -17,6 +17,7 @@ package android.telephony.euicc; import android.annotation.IntDef; import android.annotation.Nullable; +import android.annotation.SystemApi; import android.content.Context; import android.os.RemoteException; import android.os.ServiceManager; @@ -49,14 +50,14 @@ 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; /** * EuiccCardManager is the application interface to an eSIM card. - * * @hide - * - * TODO(b/35851809): Make this a SystemApi. */ +@SystemApi public class EuiccCardManager { private static final String TAG = "EuiccCardManager"; @@ -68,6 +69,7 @@ public class EuiccCardManager { CANCEL_REASON_TIMEOUT, CANCEL_REASON_PPR_NOT_ALLOWED }) + /** @hide */ public @interface CancelReason {} /** @@ -96,6 +98,7 @@ public class EuiccCardManager { RESET_OPTION_DELETE_FIELD_LOADED_TEST_PROFILES, RESET_OPTION_RESET_DEFAULT_SMDP_ADDRESS }) + /** @hide */ public @interface ResetOption {} /** Deletes all operational profiles. */ @@ -143,18 +146,20 @@ public class EuiccCardManager { } /** - * Gets all the profiles on eUicc. + * 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 callback The callback to get the result code and all the profiles. */ - public void getAllProfiles(String cardId, ResultCallback<EuiccProfileInfo[]> callback) { + public void requestAllProfiles(String cardId, @CallbackExecutor Executor executor, + ResultCallback<EuiccProfileInfo[]> callback) { try { getIEuiccCardController().getAllProfiles(mContext.getOpPackageName(), cardId, new IGetAllProfilesCallback.Stub() { @Override public void onComplete(int resultCode, EuiccProfileInfo[] profiles) { - callback.onComplete(resultCode, profiles); + executor.execute(() -> callback.onComplete(resultCode, profiles)); } }); } catch (RemoteException e) { @@ -164,19 +169,21 @@ public class EuiccCardManager { } /** - * Gets the profile of the given iccid. + * Requests the profile of the given iccid. * * @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 callback The callback to get the result code and profile. */ - public void getProfile(String cardId, String iccid, ResultCallback<EuiccProfileInfo> callback) { + public void requestProfile(String cardId, String iccid, @CallbackExecutor Executor executor, + ResultCallback<EuiccProfileInfo> callback) { try { getIEuiccCardController().getProfile(mContext.getOpPackageName(), cardId, iccid, new IGetProfileCallback.Stub() { @Override public void onComplete(int resultCode, EuiccProfileInfo profile) { - callback.onComplete(resultCode, profile); + executor.execute(() -> callback.onComplete(resultCode, profile)); } }); } catch (RemoteException e) { @@ -191,16 +198,17 @@ 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 callback The callback to get the result code. */ public void disableProfile(String cardId, String iccid, boolean refresh, - ResultCallback<Void> callback) { + @CallbackExecutor Executor executor, ResultCallback<Void> callback) { try { getIEuiccCardController().disableProfile(mContext.getOpPackageName(), cardId, iccid, refresh, new IDisableProfileCallback.Stub() { @Override public void onComplete(int resultCode) { - callback.onComplete(resultCode, null); + executor.execute(() -> callback.onComplete(resultCode, null)); } }); } catch (RemoteException e) { @@ -216,16 +224,17 @@ 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 callback The callback to get the result code and the EuiccProfileInfo enabled. */ public void switchToProfile(String cardId, String iccid, boolean refresh, - ResultCallback<EuiccProfileInfo> callback) { + @CallbackExecutor Executor executor, ResultCallback<EuiccProfileInfo> callback) { try { getIEuiccCardController().switchToProfile(mContext.getOpPackageName(), cardId, iccid, refresh, new ISwitchToProfileCallback.Stub() { @Override public void onComplete(int resultCode, EuiccProfileInfo profile) { - callback.onComplete(resultCode, profile); + executor.execute(() -> callback.onComplete(resultCode, profile)); } }); } catch (RemoteException e) { @@ -240,16 +249,17 @@ 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 callback The callback to get the result code. */ public void setNickname(String cardId, String iccid, String nickname, - ResultCallback<Void> callback) { + @CallbackExecutor Executor executor, ResultCallback<Void> callback) { try { getIEuiccCardController().setNickname(mContext.getOpPackageName(), cardId, iccid, nickname, new ISetNicknameCallback.Stub() { @Override public void onComplete(int resultCode) { - callback.onComplete(resultCode, null); + executor.execute(() -> callback.onComplete(resultCode, null)); } }); } catch (RemoteException e) { @@ -263,15 +273,17 @@ 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 callback The callback to get the result code. */ - public void deleteProfile(String cardId, String iccid, ResultCallback<Void> callback) { + public void deleteProfile(String cardId, String iccid, @CallbackExecutor Executor executor, + ResultCallback<Void> callback) { try { getIEuiccCardController().deleteProfile(mContext.getOpPackageName(), cardId, iccid, new IDeleteProfileCallback.Stub() { @Override public void onComplete(int resultCode) { - callback.onComplete(resultCode, null); + executor.execute(() -> callback.onComplete(resultCode, null)); } }); } catch (RemoteException e) { @@ -286,15 +298,17 @@ 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 callback The callback to get the result code. */ - public void resetMemory(String cardId, @ResetOption int options, ResultCallback<Void> callback) { + public void resetMemory(String cardId, @ResetOption int options, + @CallbackExecutor Executor executor, ResultCallback<Void> callback) { try { getIEuiccCardController().resetMemory(mContext.getOpPackageName(), cardId, options, new IResetMemoryCallback.Stub() { @Override public void onComplete(int resultCode) { - callback.onComplete(resultCode, null); + executor.execute(() -> callback.onComplete(resultCode, null)); } }); } catch (RemoteException e) { @@ -304,18 +318,20 @@ public class EuiccCardManager { } /** - * Gets the default SM-DP+ address from eUICC. + * 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 callback The callback to get the result code and the default SM-DP+ address. */ - public void getDefaultSmdpAddress(String cardId, ResultCallback<String> callback) { + public void requestDefaultSmdpAddress(String cardId, @CallbackExecutor Executor executor, + ResultCallback<String> callback) { try { getIEuiccCardController().getDefaultSmdpAddress(mContext.getOpPackageName(), cardId, new IGetDefaultSmdpAddressCallback.Stub() { @Override public void onComplete(int resultCode, String address) { - callback.onComplete(resultCode, address); + executor.execute(() -> callback.onComplete(resultCode, address)); } }); } catch (RemoteException e) { @@ -325,18 +341,20 @@ public class EuiccCardManager { } /** - * Gets the SM-DS address from eUICC. + * 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 callback The callback to get the result code and the SM-DS address. */ - public void getSmdsAddress(String cardId, ResultCallback<String> callback) { + public void requestSmdsAddress(String cardId, @CallbackExecutor Executor executor, + ResultCallback<String> callback) { try { getIEuiccCardController().getSmdsAddress(mContext.getOpPackageName(), cardId, new IGetSmdsAddressCallback.Stub() { @Override public void onComplete(int resultCode, String address) { - callback.onComplete(resultCode, address); + executor.execute(() -> callback.onComplete(resultCode, address)); } }); } catch (RemoteException e) { @@ -350,16 +368,18 @@ 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 callback The callback to get the result code. */ - public void setDefaultSmdpAddress(String cardId, String defaultSmdpAddress, ResultCallback<Void> callback) { + public void setDefaultSmdpAddress(String cardId, String defaultSmdpAddress, + @CallbackExecutor Executor executor, ResultCallback<Void> callback) { try { getIEuiccCardController().setDefaultSmdpAddress(mContext.getOpPackageName(), cardId, defaultSmdpAddress, new ISetDefaultSmdpAddressCallback.Stub() { @Override public void onComplete(int resultCode) { - callback.onComplete(resultCode, null); + executor.execute(() -> callback.onComplete(resultCode, null)); } }); } catch (RemoteException e) { @@ -369,18 +389,20 @@ public class EuiccCardManager { } /** - * Gets Rules Authorisation Table. + * Requests Rules Authorisation Table. * * @param cardId The Id of the eUICC. + * @param executor The executor through which the callback should be invode. * @param callback the callback to get the result code and the rule authorisation table. */ - public void getRulesAuthTable(String cardId, ResultCallback<EuiccRulesAuthTable> callback) { + public void requestRulesAuthTable(String cardId, @CallbackExecutor Executor executor, + ResultCallback<EuiccRulesAuthTable> callback) { try { getIEuiccCardController().getRulesAuthTable(mContext.getOpPackageName(), cardId, new IGetRulesAuthTableCallback.Stub() { @Override public void onComplete(int resultCode, EuiccRulesAuthTable rat) { - callback.onComplete(resultCode, rat); + executor.execute(() -> callback.onComplete(resultCode, rat)); } }); } catch (RemoteException e) { @@ -390,18 +412,20 @@ public class EuiccCardManager { } /** - * Gets the eUICC challenge for new profile downloading. + * 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 callback the callback to get the result code and the challenge. */ - public void getEuiccChallenge(String cardId, ResultCallback<byte[]> callback) { + public void requestEuiccChallenge(String cardId, @CallbackExecutor Executor executor, + ResultCallback<byte[]> callback) { try { getIEuiccCardController().getEuiccChallenge(mContext.getOpPackageName(), cardId, new IGetEuiccChallengeCallback.Stub() { @Override public void onComplete(int resultCode, byte[] challenge) { - callback.onComplete(resultCode, challenge); + executor.execute(() -> callback.onComplete(resultCode, challenge)); } }); } catch (RemoteException e) { @@ -411,18 +435,20 @@ public class EuiccCardManager { } /** - * Gets the eUICC info1 defined in GSMA RSP v2.0+ for new profile downloading. + * 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 callback the callback to get the result code and the info1. */ - public void getEuiccInfo1(String cardId, ResultCallback<byte[]> callback) { + public void requestEuiccInfo1(String cardId, @CallbackExecutor Executor executor, + ResultCallback<byte[]> callback) { try { getIEuiccCardController().getEuiccInfo1(mContext.getOpPackageName(), cardId, new IGetEuiccInfo1Callback.Stub() { @Override public void onComplete(int resultCode, byte[] info) { - callback.onComplete(resultCode, info); + executor.execute(() -> callback.onComplete(resultCode, info)); } }); } catch (RemoteException e) { @@ -435,15 +461,17 @@ 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 callback the callback to get the result code and the info2. */ - public void getEuiccInfo2(String cardId, ResultCallback<byte[]> callback) { + public void requestEuiccInfo2(String cardId, @CallbackExecutor Executor executor, + ResultCallback<byte[]> callback) { try { getIEuiccCardController().getEuiccInfo2(mContext.getOpPackageName(), cardId, new IGetEuiccInfo2Callback.Stub() { @Override public void onComplete(int resultCode, byte[] info) { - callback.onComplete(resultCode, info); + executor.execute(() -> callback.onComplete(resultCode, info)); } }); } catch (RemoteException e) { @@ -466,12 +494,13 @@ 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 callback the callback to get the result code and a byte array which represents a * {@code AuthenticateServerResponse} defined in GSMA RSP v2.0+. */ public void authenticateServer(String cardId, String matchingId, byte[] serverSigned1, byte[] serverSignature1, byte[] euiccCiPkIdToBeUsed, byte[] serverCertificate, - ResultCallback<byte[]> callback) { + @CallbackExecutor Executor executor, ResultCallback<byte[]> callback) { try { getIEuiccCardController().authenticateServer( mContext.getOpPackageName(), @@ -484,7 +513,7 @@ public class EuiccCardManager { new IAuthenticateServerCallback.Stub() { @Override public void onComplete(int resultCode, byte[] response) { - callback.onComplete(resultCode, response); + executor.execute(() -> callback.onComplete(resultCode, response)); } }); } catch (RemoteException e) { @@ -505,11 +534,13 @@ 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 callback the callback to get the result code and a byte array which represents a * {@code PrepareDownloadResponse} defined in GSMA RSP v2.0+ */ public void prepareDownload(String cardId, @Nullable byte[] hashCc, byte[] smdpSigned2, - byte[] smdpSignature2, byte[] smdpCertificate, ResultCallback<byte[]> callback) { + byte[] smdpSignature2, byte[] smdpCertificate, @CallbackExecutor Executor executor, + ResultCallback<byte[]> callback) { try { getIEuiccCardController().prepareDownload( mContext.getOpPackageName(), @@ -521,7 +552,7 @@ public class EuiccCardManager { new IPrepareDownloadCallback.Stub() { @Override public void onComplete(int resultCode, byte[] response) { - callback.onComplete(resultCode, response); + executor.execute(() -> callback.onComplete(resultCode, response)); } }); } catch (RemoteException e) { @@ -535,11 +566,12 @@ 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 callback the callback to get the result code and a byte array which represents a * {@code LoadBoundProfilePackageResponse} defined in GSMA RSP v2.0+. */ public void loadBoundProfilePackage(String cardId, byte[] boundProfilePackage, - ResultCallback<byte[]> callback) { + @CallbackExecutor Executor executor, ResultCallback<byte[]> callback) { try { getIEuiccCardController().loadBoundProfilePackage( mContext.getOpPackageName(), @@ -548,7 +580,7 @@ public class EuiccCardManager { new ILoadBoundProfilePackageCallback.Stub() { @Override public void onComplete(int resultCode, byte[] response) { - callback.onComplete(resultCode, response); + executor.execute(() -> callback.onComplete(resultCode, response)); } }); } catch (RemoteException e) { @@ -563,11 +595,12 @@ 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 callback the callback to get the result code and an byte[] which represents a * {@code CancelSessionResponse} defined in GSMA RSP v2.0+. */ public void cancelSession(String cardId, byte[] transactionId, @CancelReason int reason, - ResultCallback<byte[]> callback) { + @CallbackExecutor Executor executor, ResultCallback<byte[]> callback) { try { getIEuiccCardController().cancelSession( mContext.getOpPackageName(), @@ -577,7 +610,7 @@ public class EuiccCardManager { new ICancelSessionCallback.Stub() { @Override public void onComplete(int resultCode, byte[] response) { - callback.onComplete(resultCode, response); + executor.execute(() -> callback.onComplete(resultCode, response)); } }); } catch (RemoteException e) { @@ -591,16 +624,17 @@ 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 callback the callback to get the result code and the list of notifications. */ public void listNotifications(String cardId, @EuiccNotification.Event int events, - ResultCallback<EuiccNotification[]> callback) { + @CallbackExecutor Executor executor, ResultCallback<EuiccNotification[]> callback) { try { getIEuiccCardController().listNotifications(mContext.getOpPackageName(), cardId, events, new IListNotificationsCallback.Stub() { @Override public void onComplete(int resultCode, EuiccNotification[] notifications) { - callback.onComplete(resultCode, notifications); + executor.execute(() -> callback.onComplete(resultCode, notifications)); } }); } catch (RemoteException e) { @@ -614,16 +648,17 @@ 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 callback the callback to get the result code and the list of notifications. */ public void retrieveNotificationList(String cardId, @EuiccNotification.Event int events, - ResultCallback<EuiccNotification[]> callback) { + @CallbackExecutor Executor executor, ResultCallback<EuiccNotification[]> callback) { try { getIEuiccCardController().retrieveNotificationList(mContext.getOpPackageName(), cardId, events, new IRetrieveNotificationListCallback.Stub() { @Override public void onComplete(int resultCode, EuiccNotification[] notifications) { - callback.onComplete(resultCode, notifications); + executor.execute(() -> callback.onComplete(resultCode, notifications)); } }); } catch (RemoteException e) { @@ -637,16 +672,17 @@ 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 callback the callback to get the result code and the notification. */ public void retrieveNotification(String cardId, int seqNumber, - ResultCallback<EuiccNotification> callback) { + @CallbackExecutor Executor executor, ResultCallback<EuiccNotification> callback) { try { getIEuiccCardController().retrieveNotification(mContext.getOpPackageName(), cardId, seqNumber, new IRetrieveNotificationCallback.Stub() { @Override public void onComplete(int resultCode, EuiccNotification notification) { - callback.onComplete(resultCode, notification); + executor.execute(() -> callback.onComplete(resultCode, notification)); } }); } catch (RemoteException e) { @@ -660,10 +696,11 @@ 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 callback the callback to get the result code. */ public void removeNotificationFromList(String cardId, int seqNumber, - ResultCallback<Void> callback) { + @CallbackExecutor Executor executor, ResultCallback<Void> callback) { try { getIEuiccCardController().removeNotificationFromList( mContext.getOpPackageName(), @@ -672,7 +709,7 @@ public class EuiccCardManager { new IRemoveNotificationFromListCallback.Stub() { @Override public void onComplete(int resultCode) { - callback.onComplete(resultCode, null); + executor.execute(() -> callback.onComplete(resultCode, null)); } }); } catch (RemoteException e) { diff --git a/telephony/java/android/telephony/euicc/EuiccInfo.java b/telephony/java/android/telephony/euicc/EuiccInfo.java index 5bfff08f8d45..a4adf0591a00 100644 --- a/telephony/java/android/telephony/euicc/EuiccInfo.java +++ b/telephony/java/android/telephony/euicc/EuiccInfo.java @@ -23,9 +23,6 @@ import android.os.Parcelable; * Information about an eUICC chip/device. * * @see EuiccManager#getEuiccInfo - * @hide - * - * TODO(b/35851809): Make this public. */ // WARNING: Do not add any privacy-sensitive fields to this class (such as an eUICC identifier)! // This API is accessible to all applications. Privacy-sensitive fields should be returned in their @@ -45,12 +42,17 @@ public final class EuiccInfo implements Parcelable { } }; + @Nullable + private final String osVersion; + /** - * Version of the operating system running on the eUICC. This field is hardware-specific and is - * not guaranteed to match any particular format. + * Gets the version of the operating system running on the eUICC. This field is + * hardware-specific and is not guaranteed to match any particular format. */ @Nullable - public final String osVersion; + public String getOsVersion() { + return osVersion; + } public EuiccInfo(@Nullable String osVersion) { this.osVersion = osVersion; diff --git a/telephony/java/android/telephony/euicc/EuiccManager.java b/telephony/java/android/telephony/euicc/EuiccManager.java index 7f913ceb8165..1637c55c0adf 100644 --- a/telephony/java/android/telephony/euicc/EuiccManager.java +++ b/telephony/java/android/telephony/euicc/EuiccManager.java @@ -42,9 +42,6 @@ import java.lang.annotation.RetentionPolicy; * {@link Context#getSystemService(String)} and {@link Context#EUICC_SERVICE}. * * <p>See {@link #isEnabled} before attempting to use these APIs. - * - * TODO(b/35851809): Make this public. - * @hide */ public class EuiccManager { @@ -56,6 +53,8 @@ public class EuiccManager { * * <p>The activity will immediately finish with {@link android.app.Activity#RESULT_CANCELED} if * {@link #isEnabled} is false. + * + * This is ued by non-LPA app to bring up LUI. */ @SdkConstant(SdkConstant.SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS = @@ -69,8 +68,10 @@ public class EuiccManager { * * <p class="note">This is a protected intent that can only be sent * by the system. - * TODO(b/35851809): Make this a SystemApi. + * + * @hide */ + @SystemApi @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_OTA_STATUS_CHANGED = "android.telephony.euicc.action.OTA_STATUS_CHANGED"; @@ -78,12 +79,10 @@ public class EuiccManager { /** * Broadcast Action: The action sent to carrier app so it knows the carrier setup is not * completed. - * - * TODO(b/35851809): Make this a public API. */ @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION) - public static final String ACTION_NOTIFY_CARRIER_SETUP = - "android.telephony.euicc.action.NOTIFY_CARRIER_SETUP"; + public static final String ACTION_NOTIFY_CARRIER_SETUP_INCOMPLETE = + "android.telephony.euicc.action.NOTIFY_CARRIER_SETUP_INCOMPLETE"; /** * Intent action to provision an embedded subscription. @@ -95,8 +94,9 @@ public class EuiccManager { * <p>The activity will immediately finish with {@link android.app.Activity#RESULT_CANCELED} if * {@link #isEnabled} is false. * - * TODO(b/35851809): Make this a SystemApi. + * @hide */ + @SystemApi @SdkConstant(SdkConstant.SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_PROVISION_EMBEDDED_SUBSCRIPTION = "android.telephony.euicc.action.PROVISION_EMBEDDED_SUBSCRIPTION"; @@ -143,9 +143,8 @@ public class EuiccManager { * Key for an extra set on {@link #getDownloadableSubscriptionMetadata} PendingIntent result * callbacks providing the downloadable subscription metadata. * @hide - * - * TODO(b/35851809): Make this a SystemApi. */ + @SystemApi public static final String EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTION = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTION"; @@ -153,9 +152,8 @@ public class EuiccManager { * Key for an extra set on {@link #getDefaultDownloadableSubscriptionList} PendingIntent result * callbacks providing the list of available downloadable subscriptions. * @hide - * - * TODO(b/35851809): Make this a SystemApi. */ + @SystemApi public static final String EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTIONS = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTIONS"; @@ -201,6 +199,7 @@ public class EuiccManager { * Euicc OTA update status which can be got by {@link #getOtaStatus} * @hide */ + @SystemApi @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = {"EUICC_OTA_"}, value = { EUICC_OTA_IN_PROGRESS, @@ -215,15 +214,37 @@ public class EuiccManager { /** * An OTA is in progress. During this time, the eUICC is not available and the user may lose * network access. + * @hide */ + @SystemApi public static final int EUICC_OTA_IN_PROGRESS = 1; - /** The OTA update failed. */ + + /** + * The OTA update failed. + * @hide + */ + @SystemApi public static final int EUICC_OTA_FAILED = 2; - /** The OTA update finished successfully. */ + + /** + * The OTA update finished successfully. + * @hide + */ + @SystemApi public static final int EUICC_OTA_SUCCEEDED = 3; - /** The OTA update not needed since current eUICC OS is latest. */ + + /** + * The OTA update not needed since current eUICC OS is latest. + * @hide + */ + @SystemApi public static final int EUICC_OTA_NOT_NEEDED = 4; - /** The OTA status is unavailable since eUICC service is unavailable. */ + + /** + * The OTA status is unavailable since eUICC service is unavailable. + * @hide + */ + @SystemApi public static final int EUICC_OTA_STATUS_UNAVAILABLE = 5; private final Context mContext; @@ -276,8 +297,10 @@ public class EuiccManager { * * @return the status of eUICC OTA. If {@link #isEnabled()} is false or the eUICC is not ready, * {@link OtaStatus#EUICC_OTA_STATUS_UNAVAILABLE} will be returned. - * TODO(b/35851809): Make this a SystemApi. + * + * @hide */ + @SystemApi public int getOtaStatus() { if (!isEnabled()) { return EUICC_OTA_STATUS_UNAVAILABLE; @@ -292,7 +315,7 @@ public class EuiccManager { /** * Attempt to download the given {@link DownloadableSubscription}. * - * <p>Requires the {@link android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission, + * <p>Requires the {@code android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission, * or the calling app must be authorized to manage both the currently-active subscription and * the subscription to be downloaded according to the subscription metadata. Without the former, * an {@link #EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR} will be returned in the callback @@ -354,14 +377,16 @@ public class EuiccManager { * * <p>To be called by the LUI upon completion of a resolvable error flow. * + * <p>Requires that the calling app has the + * {@link android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission. + * * @param resolutionIntent The original intent used to start the LUI. * @param resolutionExtras Resolution-specific extras depending on the result of the resolution. * For example, this may indicate whether the user has consented or may include the input * they provided. * @hide - * - * TODO(b/35851809): Make this a SystemApi. */ + @SystemApi public void continueOperation(Intent resolutionIntent, Bundle resolutionExtras) { if (!isEnabled()) { PendingIntent callbackIntent = @@ -395,9 +420,8 @@ public class EuiccManager { * @param subscription the subscription which needs metadata filled in * @param callbackIntent a PendingIntent to launch when the operation completes. * @hide - * - * TODO(b/35851809): Make this a SystemApi. */ + @SystemApi public void getDownloadableSubscriptionMetadata( DownloadableSubscription subscription, PendingIntent callbackIntent) { if (!isEnabled()) { @@ -426,9 +450,8 @@ public class EuiccManager { * * @param callbackIntent a PendingIntent to launch when the operation completes. * @hide - * - * TODO(b/35851809): Make this a SystemApi. */ + @SystemApi public void getDefaultDownloadableSubscriptionList(PendingIntent callbackIntent) { if (!isEnabled()) { sendUnavailableError(callbackIntent); @@ -468,7 +491,7 @@ public class EuiccManager { * * <p>Requires that the calling app has carrier privileges according to the metadata of the * profile to be deleted, or the - * {@link android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission. + * {@code android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission. * * @param subscriptionId the ID of the subscription to delete. * @param callbackIntent a PendingIntent to launch when the operation completes. @@ -489,7 +512,7 @@ public class EuiccManager { /** * Switch to (enable) the given subscription. * - * <p>Requires the {@link android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission, + * <p>Requires the {@code android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission, * or the calling app must be authorized to manage both the currently-active subscription and * the subscription to be enabled according to the subscription metadata. Without the former, * an {@link #EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR} will be returned in the callback @@ -599,11 +622,7 @@ public class EuiccManager { } } - /** - * @hide - */ - @TestApi - protected IEuiccController getIEuiccController() { + private static IEuiccController getIEuiccController() { return IEuiccController.Stub.asInterface(ServiceManager.getService("econtroller")); } } diff --git a/telephony/java/android/telephony/euicc/EuiccNotification.java b/telephony/java/android/telephony/euicc/EuiccNotification.java index ef3c1ce8cf3b..43a770748260 100644 --- a/telephony/java/android/telephony/euicc/EuiccNotification.java +++ b/telephony/java/android/telephony/euicc/EuiccNotification.java @@ -17,6 +17,7 @@ package android.telephony.euicc; import android.annotation.IntDef; import android.annotation.Nullable; +import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; @@ -31,10 +32,9 @@ import java.util.Objects; * disabling, or deleting). * * @hide - * - * TODO(b/35851809): Make this a @SystemApi. */ -public class EuiccNotification implements Parcelable { +@SystemApi +public final class EuiccNotification implements Parcelable { /** Event */ @Retention(RetentionPolicy.SOURCE) @IntDef(flag = true, prefix = { "EVENT_" }, value = { @@ -43,6 +43,7 @@ public class EuiccNotification implements Parcelable { EVENT_DISABLE, EVENT_DELETE }) + /** @hide */ public @interface Event {} /** A profile is downloaded and installed. */ @@ -57,7 +58,7 @@ public class EuiccNotification implements Parcelable { /** A profile is deleted. */ public static final int EVENT_DELETE = 1 << 3; - /** Value of the bits of all above events */ + /** Value of the bits of all the events including install, enable, disable and delete. */ @Event public static final int ALL_EVENTS = EVENT_INSTALL | EVENT_ENABLE | EVENT_DISABLE | EVENT_DELETE; diff --git a/telephony/java/android/telephony/euicc/EuiccRulesAuthTable.java b/telephony/java/android/telephony/euicc/EuiccRulesAuthTable.java index 7efe04364280..67ae983efeb0 100644 --- a/telephony/java/android/telephony/euicc/EuiccRulesAuthTable.java +++ b/telephony/java/android/telephony/euicc/EuiccRulesAuthTable.java @@ -16,6 +16,7 @@ package android.telephony.euicc; import android.annotation.IntDef; +import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; import android.service.carrier.CarrierIdentifier; @@ -27,20 +28,21 @@ import com.android.internal.annotations.VisibleForTesting; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; /** * This represents the RAT (Rules Authorisation Table) stored on eUICC. - * * @hide - * - * TODO(b/35851809): Make this a @SystemApi. */ +@SystemApi public final class EuiccRulesAuthTable implements Parcelable { /** Profile policy rule flags */ @Retention(RetentionPolicy.SOURCE) @IntDef(flag = true, prefix = { "POLICY_RULE_FLAG_" }, value = { POLICY_RULE_FLAG_CONSENT_REQUIRED }) + /** @hide */ public @interface PolicyRuleFlag {} /** User consent is required to install the profile. */ @@ -89,12 +91,14 @@ public final class EuiccRulesAuthTable implements Parcelable { * @throws ArrayIndexOutOfBoundsException If the {@code mPosition} is larger than the size * this table. */ - public Builder add(int policyRules, CarrierIdentifier[] carrierId, int policyRuleFlags) { + public Builder add(int policyRules, List<CarrierIdentifier> carrierId, int policyRuleFlags) { if (mPosition >= mPolicyRules.length) { throw new ArrayIndexOutOfBoundsException(mPosition); } mPolicyRules[mPosition] = policyRules; - mCarrierIds[mPosition] = carrierId; + if (carrierId != null && carrierId.size() > 0) { + mCarrierIds[mPosition] = carrierId.toArray(new CarrierIdentifier[carrierId.size()]); + } mPolicyRuleFlags[mPosition] = policyRuleFlags; mPosition++; return this; |