summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-19 00:30:08 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-19 00:30:08 +0000
commit982b702497938dec56e5d1e842b7435b6a808904 (patch)
tree82a276acb05e7246f3c60ed65ad2595225fa7c17
parent649b6c279db1b9e4388b66f17e6be1624a7572cd (diff)
parente059a1a2ae24a8e0c2b01badb71121115c92bf03 (diff)
downloadAlternativeNetworkAccess-aml_per_331313010.tar.gz
Change-Id: I6cbe21b987aac60e45076b8c4c6d7194c99445d9
-rw-r--r--src/com/android/ons/ONSProfileDownloader.java64
-rw-r--r--tests/src/com/android/ons/ONSProfileDownloaderTest.java24
2 files changed, 43 insertions, 45 deletions
diff --git a/src/com/android/ons/ONSProfileDownloader.java b/src/com/android/ons/ONSProfileDownloader.java
index 76ec92d..f83aab9 100644
--- a/src/com/android/ons/ONSProfileDownloader.java
+++ b/src/com/android/ons/ONSProfileDownloader.java
@@ -129,57 +129,57 @@ public class ONSProfileDownloader {
int operationCode,
int errorCode) {
- if (operationCode == EuiccManager.OPERATION_DOWNLOAD) {
+ if (operationCode == EuiccManager.OPERATION_SMDX_SUBJECT_REASON_CODE) {
+ //SMDP Error codes handling
+ Pair<String, String> errCode = decodeSmdxSubjectAndReasonCode(detailedErrCode);
+ Log.e(TAG, " Subject Code: " + errCode.first + " Reason Code: "
+ + errCode.second);
+
+ //8.1 - eUICC, 4.8 - Insufficient Memory
+ // eUICC does not have sufficient space for this Profile.
+ if (errCode.equals(Pair.create("8.1.0", "4.8"))) {
+ return DownloadRetryOperationCode.ERR_MEMORY_FULL;
+ }
+
+ //8.8.5 - Download order, 4.10 - Time to Live Expired
+ //The Download order has expired
+ if (errCode.equals(Pair.create("8.8.5", "4.10"))) {
+ return DownloadRetryOperationCode.ERR_RETRY_DOWNLOAD;
+ }
+
+ //All other errors are unresolvable or retry after SIM State Change
+ return DownloadRetryOperationCode.ERR_UNRESOLVABLE;
+
+ }
+
+ switch (errorCode) {
//Success Cases
- if (resultCode == EuiccManager.EMBEDDED_SUBSCRIPTION_RESULT_OK) {
+ case EuiccManager.EMBEDDED_SUBSCRIPTION_RESULT_OK: {
return DownloadRetryOperationCode.DOWNLOAD_SUCCESSFUL;
}
//Low eUICC memory cases
- if (errorCode == EuiccManager.ERROR_EUICC_INSUFFICIENT_MEMORY) {
+ case EuiccManager.ERROR_EUICC_INSUFFICIENT_MEMORY: {
Log.d(TAG, "Download ERR: EUICC_INSUFFICIENT_MEMORY");
return DownloadRetryOperationCode.ERR_MEMORY_FULL;
}
//Temporary download error cases
- if (errorCode == EuiccManager.ERROR_TIME_OUT
- || errorCode == EuiccManager.ERROR_CONNECTION_ERROR
- || errorCode == EuiccManager.ERROR_OPERATION_BUSY) {
+ case EuiccManager.ERROR_TIME_OUT:
+ case EuiccManager.ERROR_CONNECTION_ERROR:
+ case EuiccManager.ERROR_OPERATION_BUSY: {
return DownloadRetryOperationCode.ERR_RETRY_DOWNLOAD;
}
//Profile installation failure cases
- if (errorCode == EuiccManager.ERROR_INSTALL_PROFILE) {
+ case EuiccManager.ERROR_INSTALL_PROFILE: {
return DownloadRetryOperationCode.ERR_INSTALL_ESIM_PROFILE_FAILED;
}
- //UnResolvable error cases
- return DownloadRetryOperationCode.ERR_UNRESOLVABLE;
-
- } else if (operationCode == EuiccManager.OPERATION_SMDX_SUBJECT_REASON_CODE) {
- //SMDP Error codes handling
- Pair<String, String> errCode = decodeSmdxSubjectAndReasonCode(detailedErrCode);
-
- //8.1 - eUICC, 4.8 - Insufficient Memory
- // eUICC does not have sufficient space for this Profile.
- if (errCode.equals(Pair.create("8.1.0", "4.8"))) {
- return DownloadRetryOperationCode.ERR_MEMORY_FULL;
- }
-
- //8.8.5 - Download order, 4.10 - Time to Live Expired
- //The Download order has expired
- if (errCode.equals(Pair.create("8.8.5", "4.10"))) {
- return DownloadRetryOperationCode.ERR_RETRY_DOWNLOAD;
+ default: {
+ return DownloadRetryOperationCode.ERR_UNRESOLVABLE;
}
-
- //All other errors are unresolvable or retry after SIM State Change
- return DownloadRetryOperationCode.ERR_UNRESOLVABLE;
-
- } else {
- //Ignore if Operation code is not DOWNLOAD or SMDX_SUBJECT_REASON_CODE.
- //Callback is registered only for download requests.
- return DownloadRetryOperationCode.ERR_UNRESOLVABLE;
}
}
}
diff --git a/tests/src/com/android/ons/ONSProfileDownloaderTest.java b/tests/src/com/android/ons/ONSProfileDownloaderTest.java
index f89d9bb..f37ef1e 100644
--- a/tests/src/com/android/ons/ONSProfileDownloaderTest.java
+++ b/tests/src/com/android/ons/ONSProfileDownloaderTest.java
@@ -136,8 +136,7 @@ public class ONSProfileDownloaderTest extends ONSBaseTest {
intent.putExtra(ONSProfileDownloader.PARAM_PRIMARY_SUBID, TEST_SUB_ID);
intent.putExtra(ONSProfileDownloader.PARAM_REQUEST_TYPE,
ONSProfileDownloader.REQUEST_CODE_DOWNLOAD_SUB);
- intent.putExtra(EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_OPERATION_CODE,
- EuiccManager.OPERATION_DOWNLOAD);
+ intent.putExtra(EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_OPERATION_CODE, 0);
onsProfileDownloader.onCallbackIntentReceived(intent,
EuiccManager.EMBEDDED_SUBSCRIPTION_RESULT_OK);
@@ -215,7 +214,7 @@ public class ONSProfileDownloaderTest extends ONSBaseTest {
intent.putExtra(ONSProfileDownloader.PARAM_REQUEST_TYPE,
ONSProfileDownloader.REQUEST_CODE_DOWNLOAD_SUB);
intent.putExtra(EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_OPERATION_CODE,
- EuiccManager.OPERATION_DOWNLOAD);
+ EuiccManager.OPERATION_EUICC_GSMA);
intent.putExtra(EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_ERROR_CODE,
EuiccManager.ERROR_EUICC_INSUFFICIENT_MEMORY);
@@ -266,7 +265,7 @@ public class ONSProfileDownloaderTest extends ONSBaseTest {
intent.putExtra(EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_ERROR_CODE,
EuiccManager.ERROR_CONNECTION_ERROR);
intent.putExtra(EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_OPERATION_CODE,
- EuiccManager.OPERATION_DOWNLOAD);
+ EuiccManager.OPERATION_SMDX);
onsProfileDownloader.onCallbackIntentReceived(intent,
EuiccManager.EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR);
@@ -320,7 +319,7 @@ public class ONSProfileDownloaderTest extends ONSBaseTest {
intent.putExtra(ONSProfileDownloader.PARAM_REQUEST_TYPE,
ONSProfileDownloader.REQUEST_CODE_DOWNLOAD_SUB);
intent.putExtra(EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_OPERATION_CODE,
- EuiccManager.OPERATION_DOWNLOAD);
+ EuiccManager.OPERATION_SIM_SLOT);
intent.putExtra(EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_ERROR_CODE,
EuiccManager.ERROR_TIME_OUT);
@@ -432,7 +431,7 @@ public class ONSProfileDownloaderTest extends ONSBaseTest {
intent.putExtra(ONSProfileDownloader.PARAM_REQUEST_TYPE,
ONSProfileDownloader.REQUEST_CODE_DOWNLOAD_SUB);
intent.putExtra(EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_OPERATION_CODE,
- EuiccManager.OPERATION_DOWNLOAD);
+ EuiccManager.OPERATION_SMDX);
intent.putExtra(EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_ERROR_CODE,
EuiccManager.ERROR_INVALID_RESPONSE);
@@ -472,42 +471,41 @@ public class ONSProfileDownloaderTest extends ONSBaseTest {
ONSProfileDownloader.DownloadRetryOperationCode res =
downloadHandler.mapDownloaderErrorCode(
- EuiccManager.EMBEDDED_SUBSCRIPTION_RESULT_OK, 0,
- EuiccManager.OPERATION_DOWNLOAD, 0);
+ EuiccManager.EMBEDDED_SUBSCRIPTION_RESULT_OK, 0, 0, 0);
assertEquals(
ONSProfileDownloader.DownloadRetryOperationCode.DOWNLOAD_SUCCESSFUL, res);
res = downloadHandler.mapDownloaderErrorCode(
EuiccManager.EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR, 0,
- EuiccManager.OPERATION_DOWNLOAD,
+ EuiccManager.OPERATION_EUICC_GSMA,
EuiccManager.ERROR_EUICC_INSUFFICIENT_MEMORY);
assertEquals(ONSProfileDownloader.DownloadRetryOperationCode
.ERR_MEMORY_FULL, res);
res = downloadHandler.mapDownloaderErrorCode(
EuiccManager.EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR, 0,
- EuiccManager.OPERATION_DOWNLOAD,
+ EuiccManager.OPERATION_SIM_SLOT,
EuiccManager.ERROR_TIME_OUT);
assertEquals(ONSProfileDownloader.DownloadRetryOperationCode
.ERR_RETRY_DOWNLOAD, res);
res = downloadHandler.mapDownloaderErrorCode(
EuiccManager.EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR, 0,
- EuiccManager.OPERATION_DOWNLOAD,
+ EuiccManager.OPERATION_SMDX,
EuiccManager.ERROR_CONNECTION_ERROR);
assertEquals(ONSProfileDownloader.DownloadRetryOperationCode
.ERR_RETRY_DOWNLOAD, res);
res = downloadHandler.mapDownloaderErrorCode(
EuiccManager.EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR, 0,
- EuiccManager.OPERATION_DOWNLOAD,
+ EuiccManager.OPERATION_SMDX,
EuiccManager.ERROR_INVALID_RESPONSE);
assertEquals(ONSProfileDownloader.DownloadRetryOperationCode
.ERR_UNRESOLVABLE, res);
res = downloadHandler.mapDownloaderErrorCode(
EuiccManager.EMBEDDED_SUBSCRIPTION_RESULT_ERROR, 0,
- EuiccManager.OPERATION_DOWNLOAD,
+ EuiccManager.OPERATION_SMDX,
EuiccManager.ERROR_INVALID_RESPONSE);
assertEquals(ONSProfileDownloader.DownloadRetryOperationCode
.ERR_UNRESOLVABLE, res);