Compare commits

..

6 commits

Author SHA1 Message Date
18d0521576 Fixup layout centering for download progress
All checks were successful
/ build-debug (push) Successful in 5m9s
2025-09-07 14:55:36 -04:00
943f2bd14e Incorporate simplified error messages to the download progress UI
All checks were successful
/ build-debug (push) Successful in 4m43s
2025-09-07 14:39:52 -04:00
8a41eabfb3 Rework simplified error message strings
All checks were successful
/ build-debug (push) Successful in 5m10s
2025-09-07 10:59:20 -04:00
19f07de151 Redo SimplifiedErrorHandling as SimplifiedErrorMessages
All checks were successful
/ build-debug (push) Successful in 5m5s
...and it shouldn't be an object, it should just be an enum class with a
companion object.
2025-09-07 10:51:33 -04:00
1ed53a2f32
feat: add EIDNotSupported error handling and corresponding message 2025-08-28 21:31:44 +08:00
f167d059dc
feat: simplified error handling 2025-08-18 09:57:15 +08:00
9 changed files with 133 additions and 196 deletions

21
.idea/.gitignore generated vendored
View file

@ -1,7 +1,14 @@
* /shelf
!/codeStyles/Project.xml /caches
!/codeStyles/codeStyleConfig.xml /libraries
!/vcs.xml /assetWizardSettings.xml
!/kotlinc.xml /deploymentTarget*.xml
!/compiler.xml /gradle.xml
!/migrations.xml /misc.xml
/modules.xml
/navEditor.xml
/runConfigurations.xml
/workspace.xml
/AndroidProjectSystem.xml
**/*.iml

View file

@ -16,7 +16,7 @@ There are two variants of this project, OpenEUICC and EasyEUICC:
Some side notes: Some side notes:
1. When privileged, OpenEUICC supports any eUICC chip that implements the SGP.22 standard, internal or external. However, there is __no guarantee__ that external (removable) eSIMs actually follow the standard. Please __DO NOT__ submit bug reports for non-functioning removable eSIMs. They are __NOT__ officially supported unless they also support / are supported by EasyEUICC, the unprivileged variant. 1. When privileged, OpenEUICC supports any eUICC chip that implements the SGP.22 standard, internal or external. However, there is __no guarantee__ that external (removable) eSIMs actually follow the standard. Please __DO NOT__ submit bug reports for non-functioning removable eSIMs. They are __NOT__ officially supported unless they also support / are supported by EasyEUICC, the unprivileged variant.
2. Both variants support accessing eUICC chips through USB CCID readers, regardless of whether the chip contains the correct ARA-M hash to allow for unprivileged access. However, only `T=0` readers that use the standard [USB CCID protocol](https://en.wikipedia.org/wiki/CCID_(protocol)) are supported. 2. Both variants support accessing eUICC chips through USB CCID readers, regardless of whether the chip contains the correct ARA-M hash to allow for unprivileged access. However, only `T=0` readers that use the standard [USB CCID protocol](https://en.wikipedia.org/wiki/CCID_(protocol)) are supported.
3. Prebuilt release-mode EasyEUICC apks can be downloaded [here](https://gitea.angry.im/PeterCxy/OpenEUICC/releases). For OpenEUICC, no official release is currently provided and only debug mode APKs and Magisk modules can be found in the [CI page](https://gitea.angry.im/PeterCxy/OpenEUICC/actions). 3. Prebuilt release-mode EasyEUICC apks can be downloaded [here](https://gitea.angry.im/PeterCxy/OpenEUICC/releases). For OpenEUICC, no official release is currently provided and only debug mode APKs can be found in the CI page.
4. For removable eSIM chip vendors: to have your chip supported by official builds of EasyEUICC when inserted, include the ARA-M hash `2A2FA878BC7C3354C2CF82935A5945A3EDAE4AFA`. 4. For removable eSIM chip vendors: to have your chip supported by official builds of EasyEUICC when inserted, include the ARA-M hash `2A2FA878BC7C3354C2CF82935A5945A3EDAE4AFA`.
__This project is Free Software licensed under GNU GPL v3, WITHOUT the "or later" clause.__ Any modification and derivative work __MUST__ be released under the SAME license, which means, at the very least, that the source code __MUST__ be available upon request. __This project is Free Software licensed under GNU GPL v3, WITHOUT the "or later" clause.__ Any modification and derivative work __MUST__ be released under the SAME license, which means, at the very least, that the source code __MUST__ be available upon request.
@ -74,7 +74,10 @@ FAQs
=== ===
- Q: Do you provide prebuilt binaries for OpenEUICC? - Q: Do you provide prebuilt binaries for OpenEUICC?
- A: Debug-mode APKs and Magisk modules are available continuously as an artifact of the [Actions](https://gitea.angry.im/PeterCxy/OpenEUICC/actions) CI used by this project. However, these debug-mode APKs are **not** intended for inclusion inside system images, nor are they supported by the developer in any sense. If you are a custom ROM developer, either include the entire OpenEUICC repository in your AOSP source tree, or generate an APK using `gradle` and import that as a prebuilt system app. Note that you might want `privapp_whitelist_im.angry.openeuicc.xml` as well. - A: Debug-mode APKs are available continuously as an artifact of the [Actions](https://gitea.angry.im/PeterCxy/OpenEUICC/actions) CI used by this project. However, these debug-mode APKs are **not** intended for inclusion inside system images, nor are they supported by the developer in any sense. If you are a custom ROM developer, either include the entire OpenEUICC repository in your AOSP source tree, or generate an APK using `gradle` and import that as a prebuilt system app. Note that you might want `privapp_whitelist_im.angry.openeuicc.xml` as well.
- Q: AOSP's Settings app seems to be confused by OpenEUICC (for example, disabling / enabling profiles from the Networks page do not work properly)
- A: When your device has internal eSIM chip(s) __and__ you have inserted a removable eSIM chip, the Settings app can misbehave since it was never designed for this scenario. __Please prefer using OpenEUICC's own management interface whenever possible.__ In the future, there might be an option to exclude removable SIMs from being reported to the Android system.
- Q: Can EasyEUICC manage my phone's internal eSIM? - Q: Can EasyEUICC manage my phone's internal eSIM?
- A: No. For EasyEUICC to work, the eSIM chip MUST proactively grant access via its ARA-M field. - A: No. For EasyEUICC to work, the eSIM chip MUST proactively grant access via its ARA-M field.

View file

@ -123,13 +123,7 @@ class EuiccInfoActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker {
add(Item(R.string.euicc_info_pp_version, info.ppVersion.toString())) add(Item(R.string.euicc_info_pp_version, info.ppVersion.toString()))
info.sasAccreditationNumber.trim().takeIf(RE_SAS::matches) info.sasAccreditationNumber.trim().takeIf(RE_SAS::matches)
?.let { add(Item(R.string.euicc_info_sas_accreditation_number, it.uppercase())) } ?.let { add(Item(R.string.euicc_info_sas_accreditation_number, it.uppercase())) }
add(Item(R.string.euicc_info_free_nvram, info.freeNvram.let(::formatFreeSpace)))
val nvramText = buildString {
append(formatFreeSpace(info.freeNvram))
append(' ')
append(getString(R.string.euicc_info_free_nvram_hint))
}
add(Item(R.string.euicc_info_free_nvram, nvramText))
} }
channel.lpa.euiccInfo2?.euiccCiPKIdListForSigning.orEmpty().let { signers -> channel.lpa.euiccInfo2?.euiccCiPKIdListForSigning.orEmpty().let { signers ->
// SGP.28 v1.0, eSIM CI Registration Criteria (Page 5 of 9, 2019-10-24) // SGP.28 v1.0, eSIM CI Registration Criteria (Page 5 of 9, 2019-10-24)

View file

@ -7,7 +7,6 @@ import android.view.ViewGroup
import android.widget.ImageView import android.widget.ImageView
import android.widget.ProgressBar import android.widget.ProgressBar
import android.widget.TextView import android.widget.TextView
import androidx.annotation.StringRes
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
@ -43,17 +42,37 @@ class DownloadWizardProgressFragment : DownloadWizardActivity.DownloadWizardStep
} }
private data class ProgressItem( private data class ProgressItem(
@StringRes val titleRes: Int, val titleRes: Int,
var state: ProgressState = ProgressState.NotStarted, var state: ProgressState,
var errorMessage: SimplifiedErrorMessages? = null, var errorMessage: SimplifiedErrorMessages?,
) )
private val progressItems = arrayOf( private val progressItems = arrayOf(
ProgressItem(R.string.download_wizard_progress_step_preparing), ProgressItem(
ProgressItem(R.string.download_wizard_progress_step_connecting), R.string.download_wizard_progress_step_preparing,
ProgressItem(R.string.download_wizard_progress_step_authenticating), ProgressState.NotStarted,
ProgressItem(R.string.download_wizard_progress_step_downloading), null
ProgressItem(R.string.download_wizard_progress_step_finalizing) ),
ProgressItem(
R.string.download_wizard_progress_step_connecting,
ProgressState.NotStarted,
null
),
ProgressItem(
R.string.download_wizard_progress_step_authenticating,
ProgressState.NotStarted,
null
),
ProgressItem(
R.string.download_wizard_progress_step_downloading,
ProgressState.NotStarted,
null
),
ProgressItem(
R.string.download_wizard_progress_step_finalizing,
ProgressState.NotStarted,
null
)
) )
private val adapter = ProgressItemAdapter() private val adapter = ProgressItemAdapter()
@ -137,8 +156,9 @@ class DownloadWizardProgressFragment : DownloadWizardActivity.DownloadWizardStep
refreshButtons() refreshButtons()
} }
is EuiccChannelManagerService.ForegroundTaskState.InProgress -> is EuiccChannelManagerService.ForegroundTaskState.InProgress -> {
updateProgress(it.progress) updateProgress(it.progress)
}
else -> {} else -> {}
} }
@ -232,13 +252,14 @@ class DownloadWizardProgressFragment : DownloadWizardActivity.DownloadWizardStep
icon.setImageResource(R.drawable.ic_error_outline) icon.setImageResource(R.drawable.ic_error_outline)
icon.visibility = View.VISIBLE icon.visibility = View.VISIBLE
item.errorMessage?.titleResId?.let { if (item.errorMessage != null) {
errorTitle.visibility = View.VISIBLE errorTitle.visibility = View.VISIBLE
errorTitle.text = getString(it) errorTitle.text = getString(item.errorMessage!!.titleResId)
}
item.errorMessage?.suggestResId?.let { if (item.errorMessage!!.suggestResId != null) {
errorSuggestion.visibility = View.VISIBLE errorSuggestion.visibility = View.VISIBLE
errorSuggestion.text = getString(it) errorSuggestion.text = getString(item.errorMessage!!.suggestResId!!)
}
} }
} }
} }

View file

@ -6,7 +6,6 @@
<string name="euicc_info_unavailable">情報がありません</string> <string name="euicc_info_unavailable">情報がありません</string>
<string name="notification_help">ヘルプ</string> <string name="notification_help">ヘルプ</string>
<string name="profile_reload_slots">スロットを再読み込み</string> <string name="profile_reload_slots">スロットを再読み込み</string>
<string name="profile_no_enabled_profile">未知</string>
<string name="channel_name_format">論理スロット %d</string> <string name="channel_name_format">論理スロット %d</string>
<string name="profile_state_enabled">有効済み</string> <string name="profile_state_enabled">有効済み</string>
<string name="profile_state_disabled">無効済み</string> <string name="profile_state_disabled">無効済み</string>
@ -84,7 +83,6 @@
<string name="download_wizard_diagnostics_last_apdu_exception">最終の APDU 例外:</string> <string name="download_wizard_diagnostics_last_apdu_exception">最終の APDU 例外:</string>
<string name="download_wizard_diagnostics_save">保存</string> <string name="download_wizard_diagnostics_save">保存</string>
<string name="download_wizard_diagnostics_file_template">「%s」での診断</string> <string name="download_wizard_diagnostics_file_template">「%s」での診断</string>
<string name="download_wizard_error_suggest_network_unreachable">別のネットワークに接続しWi-Fi とデータを切り替える)、もう一度お試しください。</string>
<string name="logs_saved_message">ログは共有したパスに保存されました。別のアプリで共有しますか?</string> <string name="logs_saved_message">ログは共有したパスに保存されました。別のアプリで共有しますか?</string>
<string name="profile_rename_new_name">新しいニックネーム</string> <string name="profile_rename_new_name">新しいニックネーム</string>
<string name="profile_rename_encoding_error">ニックネームを UTF-8 にエンコードできませんでした</string> <string name="profile_rename_encoding_error">ニックネームを UTF-8 にエンコードできませんでした</string>
@ -116,7 +114,6 @@
<string name="euicc_info_sas_accreditation_number">SAS 認定番号</string> <string name="euicc_info_sas_accreditation_number">SAS 認定番号</string>
<string name="euicc_info_pp_version">保護されたプロファイルのバージョン</string> <string name="euicc_info_pp_version">保護されたプロファイルのバージョン</string>
<string name="euicc_info_free_nvram">NVRAM の空き容量 (eSIM プロファイルストレージ)</string> <string name="euicc_info_free_nvram">NVRAM の空き容量 (eSIM プロファイルストレージ)</string>
<string name="euicc_info_free_nvram_hint">(目安)</string>
<string name="euicc_info_ci_type">証明書発行者 (CI)</string> <string name="euicc_info_ci_type">証明書発行者 (CI)</string>
<string name="euicc_info_ci_gsma_live">GSMA ライブ CI</string> <string name="euicc_info_ci_gsma_live">GSMA ライブ CI</string>
<string name="euicc_info_ci_gsma_test">GSMA テスト CI</string> <string name="euicc_info_ci_gsma_test">GSMA テスト CI</string>
@ -153,7 +150,6 @@
<string name="pref_developer_ignore_tls_certificate">SM-DP+ TLS 証明書を無視する</string> <string name="pref_developer_ignore_tls_certificate">SM-DP+ TLS 証明書を無視する</string>
<string name="pref_developer_ignore_tls_certificate_desc">RSP サーバーで使用される TLS 証明書を受け入れます</string> <string name="pref_developer_ignore_tls_certificate_desc">RSP サーバーで使用される TLS 証明書を受け入れます</string>
<string name="pref_developer_isdr_aid_list_desc">一部のブランドの取り外し可能な eUICC では、独自の非標準 ISD-R AID が使用されている場合があり、サードパーティ アプリからアクセスできなくなります。アプリはこのリストに追加された非標準の AID の使用を試みる可能性がありますが、動作することは保証されません。</string> <string name="pref_developer_isdr_aid_list_desc">一部のブランドの取り外し可能な eUICC では、独自の非標準 ISD-R AID が使用されている場合があり、サードパーティ アプリからアクセスできなくなります。アプリはこのリストに追加された非標準の AID の使用を試みる可能性がありますが、動作することは保証されません。</string>
<string name="pref_developer_es10x_mss_desc">グローバル ES10x MSS</string>
<string name="pref_info">情報</string> <string name="pref_info">情報</string>
<string name="pref_info_app_version">アプリバージョン</string> <string name="pref_info_app_version">アプリバージョン</string>
<string name="pref_info_source_code">ソースコード</string> <string name="pref_info_source_code">ソースコード</string>
@ -173,24 +169,4 @@
<string name="pref_developer_isdr_aid_list">ISD-R AID リストのカスタマイズ</string> <string name="pref_developer_isdr_aid_list">ISD-R AID リストのカスタマイズ</string>
<string name="isdr_aid_list_restore_defaults">リセット</string> <string name="isdr_aid_list_restore_defaults">リセット</string>
<string name="isdr_aid_list">ISD-R AID リスト</string> <string name="isdr_aid_list">ISD-R AID リスト</string>
<string name="download_wizard_error_iccid_already">この eSIM プロファイルはすでに eSIM チップに存在しています。</string>
<string name="download_wizard_error_insufficient_memory">eSIM チップには十分なメモリ容量が残っていません。</string>
<string name="download_wizard_error_unsupported_profile">この eSIM プロファイルは、ダウンロード先のeSIM チップではサポートされていません。</string>
<string name="download_wizard_error_card_internal_error">eSIMチップでエラーが発生しました。</string>
<string name="download_wizard_error_eid_not_supported">お使いのデバイスまたは eSIM チップの EID は、通信事業者によってサポートされていません。</string>
<string name="download_wizard_error_eid_mismatch">この eSIM プロファイルはすでに別のデバイスにダウンロードされています。</string>
<string name="download_wizard_error_profile_unreleased">この eSIM プロファイルはキャンセルされました。</string>
<string name="download_wizard_error_matching_id_refused">アクティベーションコードが無効です。</string>
<string name="download_wizard_error_profile_retries_exceeded">eSIM プロファイルのダウンロード試行回数の上限を超えました。</string>
<string name="download_wizard_error_confirmation_code_missing">このプロファイルをダウンロードするには確認コードが必要です。</string>
<string name="download_wizard_error_confirmation_code_refused">入力した確認コードは無効です。</string>
<string name="download_wizard_error_profile_expired">この eSIM プロファイルの有効期限が切れています。</string>
<string name="download_wizard_error_confirmation_code_retries_exceeded">確認コードのダウンロード試行回数の上限を超えました。</string>
<string name="download_wizard_error_unknown_hostname">不明なSM-DP+アドレス</string>
<string name="download_wizard_error_network_unreachable">ネットワークにアクセスできません</string>
<string name="download_wizard_error_tls_certificate">TLS証明書エラー。このeSIMプロファイルはサポートされていません</string>
<string name="download_wizard_error_suggest_profile_installed">すでにダウンロードしたeSIMプロファイルを再インストールしようとしています</string>
<string name="download_wizard_error_suggest_insufficient_memory">不要なeSIMプロファイルをいくつか削除して、もう一度お試しください</string>
<string name="download_wizard_error_suggest_contact_carrier">通信事業者にお問い合わせください。</string>
<string name="download_wizard_error_suggest_contact_reissue">この eSIM プロファイルを再発行するには、通信事業者にお問い合わせください。</string>
</resources> </resources>

View file

@ -5,7 +5,6 @@
<string name="euicc_info_unknown">未知</string> <string name="euicc_info_unknown">未知</string>
<string name="notification_help">帮助</string> <string name="notification_help">帮助</string>
<string name="profile_reload_slots">重新加载卡槽</string> <string name="profile_reload_slots">重新加载卡槽</string>
<string name="profile_no_enabled_profile">未知</string>
<string name="channel_name_format">逻辑卡槽 %d</string> <string name="channel_name_format">逻辑卡槽 %d</string>
<string name="profile_state_enabled">已启用</string> <string name="profile_state_enabled">已启用</string>
<string name="profile_state_disabled">已禁用</string> <string name="profile_state_disabled">已禁用</string>
@ -47,7 +46,6 @@
<string name="profile_download_imei">IMEI (可选)</string> <string name="profile_download_imei">IMEI (可选)</string>
<string name="profile_download_low_nvram_title">剩余空间不足</string> <string name="profile_download_low_nvram_title">剩余空间不足</string>
<string name="profile_download_low_nvram_message">当前芯片的剩余空间不足,可能导致配置下载失败。\n是否继续下载</string> <string name="profile_download_low_nvram_message">当前芯片的剩余空间不足,可能导致配置下载失败。\n是否继续下载</string>
<string name="download_wizard_error_suggest_network_unreachable">请连接到其他网络(例如在 Wi-Fi 和数据之间切换)后重试。</string>
<string name="logs_saved_message">日志已保存到指定路径。需要通过其他 App 分享吗?</string> <string name="logs_saved_message">日志已保存到指定路径。需要通过其他 App 分享吗?</string>
<string name="profile_rename_new_name">新昵称</string> <string name="profile_rename_new_name">新昵称</string>
<string name="profile_rename_encoding_error">无法将昵称编码为 UTF-8</string> <string name="profile_rename_encoding_error">无法将昵称编码为 UTF-8</string>
@ -85,7 +83,6 @@
<string name="pref_advanced_logs">日志</string> <string name="pref_advanced_logs">日志</string>
<string name="pref_advanced_logs_desc">查看应用程序的最新调试日志</string> <string name="pref_advanced_logs_desc">查看应用程序的最新调试日志</string>
<string name="pref_developer_isdr_aid_list_desc">某些品牌的可移除 eUICC 可能会使用自己的非标准 ISD-R AID导致第三方应用无法访问。此 App 可以尝试使用此列表中添加的非标准 AID但不能保证它们一定有效。</string> <string name="pref_developer_isdr_aid_list_desc">某些品牌的可移除 eUICC 可能会使用自己的非标准 ISD-R AID导致第三方应用无法访问。此 App 可以尝试使用此列表中添加的非标准 AID但不能保证它们一定有效。</string>
<string name="pref_developer_es10x_mss_desc">全局 ES10x MSS</string>
<string name="pref_info">信息</string> <string name="pref_info">信息</string>
<string name="pref_info_app_version">App 版本</string> <string name="pref_info_app_version">App 版本</string>
<string name="pref_info_source_code">源码</string> <string name="pref_info_source_code">源码</string>
@ -139,7 +136,6 @@
<string name="euicc_info_sas_accreditation_number">SAS 认证号码</string> <string name="euicc_info_sas_accreditation_number">SAS 认证号码</string>
<string name="euicc_info_pp_version">Protected Profile 版本</string> <string name="euicc_info_pp_version">Protected Profile 版本</string>
<string name="euicc_info_free_nvram">NVRAM 剩余空间 (eSIM 存储容量)</string> <string name="euicc_info_free_nvram">NVRAM 剩余空间 (eSIM 存储容量)</string>
<string name="euicc_info_free_nvram_hint">(仅供参考)</string>
<string name="euicc_info_ci_type">证书签发者 (CI)</string> <string name="euicc_info_ci_type">证书签发者 (CI)</string>
<string name="euicc_info_ci_gsma_live">GSMA 生产环境 CI</string> <string name="euicc_info_ci_gsma_live">GSMA 生产环境 CI</string>
<string name="euicc_info_ci_gsma_test">GSMA 测试 CI</string> <string name="euicc_info_ci_gsma_test">GSMA 测试 CI</string>
@ -173,24 +169,4 @@
<string name="pref_developer_isdr_aid_list">自定义 ISD-R AID 列表</string> <string name="pref_developer_isdr_aid_list">自定义 ISD-R AID 列表</string>
<string name="isdr_aid_list_restore_defaults">重置</string> <string name="isdr_aid_list_restore_defaults">重置</string>
<string name="isdr_aid_list">ISD-R AID 列表</string> <string name="isdr_aid_list">ISD-R AID 列表</string>
<string name="download_wizard_error_iccid_already">此 eSIM 配置文件已存在于您的 eSIM 芯片上。</string>
<string name="download_wizard_error_insufficient_memory">您的 eSIM 芯片没有足够的空间来下载配置文件。</string>
<string name="download_wizard_error_unsupported_profile">您的 eSIM 芯片不支持此 eSIM 配置文件。</string>
<string name="download_wizard_error_card_internal_error">eSIM 芯片错误。</string>
<string name="download_wizard_error_eid_not_supported">您的设备或 eSIM 芯片的 EID 不受您的运营商支持。</string>
<string name="download_wizard_error_eid_mismatch">此 eSIM 配置文件已被下载到另一台设备上。</string>
<string name="download_wizard_error_profile_unreleased">此 eSIM 配置文件已被撤销。</string>
<string name="download_wizard_error_matching_id_refused">激活码无效。</string>
<string name="download_wizard_error_profile_retries_exceeded">已超出 eSIM 配置文件的最大下载尝试次数。</string>
<string name="download_wizard_error_confirmation_code_missing">下载此配置文件需要确认码。</string>
<string name="download_wizard_error_confirmation_code_refused">您输入的确认码无效。</string>
<string name="download_wizard_error_profile_expired">此 eSIM 配置文件已过期。</string>
<string name="download_wizard_error_confirmation_code_retries_exceeded">已超出确认码的最大下载尝试次数。</string>
<string name="download_wizard_error_unknown_hostname">未知的 SM-DP+ 地址</string>
<string name="download_wizard_error_network_unreachable">网络不可达</string>
<string name="download_wizard_error_tls_certificate">TLS 证书错误,不支持此 eSIM 配置文件</string>
<string name="download_wizard_error_suggest_profile_installed">您正在尝试重新安装已下载的 eSIM 配置文件</string>
<string name="download_wizard_error_suggest_insufficient_memory">请删除一些未使用的 eSIM 配置文件,然后重试</string>
<string name="download_wizard_error_suggest_contact_carrier">请联系您的运营商寻求帮助。</string>
<string name="download_wizard_error_suggest_contact_reissue">请联系您的运营商重新签发此 eSIM 配置文件。</string>
</resources> </resources>

View file

@ -5,7 +5,6 @@
<string name="euicc_info_unknown">未知</string> <string name="euicc_info_unknown">未知</string>
<string name="notification_help">幫助</string> <string name="notification_help">幫助</string>
<string name="profile_reload_slots">重新載入卡槽</string> <string name="profile_reload_slots">重新載入卡槽</string>
<string name="profile_no_enabled_profile">未知</string>
<string name="channel_name_format">虛擬卡槽 %d</string> <string name="channel_name_format">虛擬卡槽 %d</string>
<string name="profile_state_enabled">已啟用</string> <string name="profile_state_enabled">已啟用</string>
<string name="profile_state_disabled">已停用</string> <string name="profile_state_disabled">已停用</string>
@ -47,7 +46,6 @@
<string name="profile_download_imei">IMEI (可選)</string> <string name="profile_download_imei">IMEI (可選)</string>
<string name="profile_download_low_nvram_title">剩餘空間不足</string> <string name="profile_download_low_nvram_title">剩餘空間不足</string>
<string name="profile_download_low_nvram_message">目前晶片的剩餘空間不足,可能導致配置下載失敗。\n是否繼續下載</string> <string name="profile_download_low_nvram_message">目前晶片的剩餘空間不足,可能導致配置下載失敗。\n是否繼續下載</string>
<string name="download_wizard_error_suggest_network_unreachable">請連接到其他網路(例如在 Wi-Fi 和資料之間切換)後重試。</string>
<string name="logs_saved_message">日誌已儲存到指定路徑。需要透過其他 App 分享嗎?</string> <string name="logs_saved_message">日誌已儲存到指定路徑。需要透過其他 App 分享嗎?</string>
<string name="profile_rename_new_name">新名稱</string> <string name="profile_rename_new_name">新名稱</string>
<string name="profile_rename_encoding_error">無法將名稱編碼為 UTF-8</string> <string name="profile_rename_encoding_error">無法將名稱編碼為 UTF-8</string>
@ -85,7 +83,6 @@
<string name="pref_advanced_disable_safeguard_removable_esim">允許 停用/刪除 已啟用的設定檔</string> <string name="pref_advanced_disable_safeguard_removable_esim">允許 停用/刪除 已啟用的設定檔</string>
<string name="pref_advanced_disable_safeguard_removable_esim_desc">預設情況下,此應用程式會阻止您停用可插拔 eSIM 中已啟用的設定檔。\n因為這樣做 <i>有時</i> 會導致無法存取。\n勾選此框以 <i>移除</i> 此保護措施。</string> <string name="pref_advanced_disable_safeguard_removable_esim_desc">預設情況下,此應用程式會阻止您停用可插拔 eSIM 中已啟用的設定檔。\n因為這樣做 <i>有時</i> 會導致無法存取。\n勾選此框以 <i>移除</i> 此保護措施。</string>
<string name="pref_developer_isdr_aid_list_desc">某些品牌的可移除 eUICC 可能會使用自己的非標準 ISD-R AID導致第三方應用程式無法存取。此 App 可以嘗試使用此清單中新增的非標準 AID但不能保證它們一定有效。</string> <string name="pref_developer_isdr_aid_list_desc">某些品牌的可移除 eUICC 可能會使用自己的非標準 ISD-R AID導致第三方應用程式無法存取。此 App 可以嘗試使用此清單中新增的非標準 AID但不能保證它們一定有效。</string>
<string name="pref_developer_es10x_mss_desc">全局 ES10x MSS</string>
<string name="pref_info">資訊</string> <string name="pref_info">資訊</string>
<string name="pref_info_app_version">App 版本</string> <string name="pref_info_app_version">App 版本</string>
<string name="pref_info_source_code">原始碼</string> <string name="pref_info_source_code">原始碼</string>
@ -139,7 +136,6 @@
<string name="euicc_info_sas_accreditation_number">SAS 認證號碼</string> <string name="euicc_info_sas_accreditation_number">SAS 認證號碼</string>
<string name="euicc_info_pp_version">Protected Profile 版本</string> <string name="euicc_info_pp_version">Protected Profile 版本</string>
<string name="euicc_info_free_nvram">NVRAM 剩餘空間 (eSIM 儲存容量)</string> <string name="euicc_info_free_nvram">NVRAM 剩餘空間 (eSIM 儲存容量)</string>
<string name="euicc_info_free_nvram_hint">(僅供參考)</string>
<string name="euicc_info_ci_type">證書簽發者 (CI)</string> <string name="euicc_info_ci_type">證書簽發者 (CI)</string>
<string name="euicc_info_ci_gsma_live">GSMA 生產環境 CI</string> <string name="euicc_info_ci_gsma_live">GSMA 生產環境 CI</string>
<string name="euicc_info_ci_gsma_test">GSMA 測試 CI</string> <string name="euicc_info_ci_gsma_test">GSMA 測試 CI</string>
@ -173,24 +169,4 @@
<string name="pref_developer_isdr_aid_list">自訂 ISD-R AID 列表</string> <string name="pref_developer_isdr_aid_list">自訂 ISD-R AID 列表</string>
<string name="isdr_aid_list_restore_defaults">重置</string> <string name="isdr_aid_list_restore_defaults">重置</string>
<string name="isdr_aid_list">ISD-R AID 列表</string> <string name="isdr_aid_list">ISD-R AID 列表</string>
<string name="download_wizard_error_iccid_already">此 eSIM 設定檔已存在於您的 eSIM 晶片上。</string>
<string name="download_wizard_error_insufficient_memory">您的 eSIM 晶片沒有足夠的空間來下載設定檔。</string>
<string name="download_wizard_error_unsupported_profile">您的 eSIM 晶片不支援此 eSIM 設定檔。</string>
<string name="download_wizard_error_card_internal_error">eSIM 晶片錯誤。</string>
<string name="download_wizard_error_eid_not_supported">您的裝置或 eSIM 晶片的 EID 不受您的電信業者支援。</string>
<string name="download_wizard_error_eid_mismatch">此 eSIM 設定檔已被下載到另一台裝置上。</string>
<string name="download_wizard_error_profile_unreleased">此 eSIM 設定檔已被撤銷。</string>
<string name="download_wizard_error_matching_id_refused">啟用碼無效。</string>
<string name="download_wizard_error_profile_retries_exceeded">已超出 eSIM 設定檔的最大下載嘗試次數。</string>
<string name="download_wizard_error_confirmation_code_missing">下載此設定檔需要確認碼。</string>
<string name="download_wizard_error_confirmation_code_refused">您輸入的確認碼無效。</string>
<string name="download_wizard_error_profile_expired">此 eSIM 設定檔已過期。</string>
<string name="download_wizard_error_confirmation_code_retries_exceeded">已超出確認碼的最大下載嘗試次數。</string>
<string name="download_wizard_error_unknown_hostname">未知的 SM-DP+ 位址</string>
<string name="download_wizard_error_network_unreachable">網路不可達</string>
<string name="download_wizard_error_tls_certificate">TLS 憑證錯誤,不支援此 eSIM 設定檔</string>
<string name="download_wizard_error_suggest_profile_installed">您正在嘗試重新安裝已下載的 eSIM 設定文件</string>
<string name="download_wizard_error_suggest_insufficient_memory">請刪除一些未使用的 eSIM 設定文件,然後重試</string>
<string name="download_wizard_error_suggest_contact_carrier">請聯絡您的電信業者尋求協助。</string>
<string name="download_wizard_error_suggest_contact_reissue">請聯絡您的電信業者重新簽發此 eSIM 設定檔。</string>
</resources> </resources>

View file

@ -165,7 +165,6 @@
<string name="euicc_info_sas_accreditation_number">SAS Accreditation Number</string> <string name="euicc_info_sas_accreditation_number">SAS Accreditation Number</string>
<string name="euicc_info_pp_version">Protected Profile Version</string> <string name="euicc_info_pp_version">Protected Profile Version</string>
<string name="euicc_info_free_nvram">Free NVRAM (eSIM profile storage)</string> <string name="euicc_info_free_nvram">Free NVRAM (eSIM profile storage)</string>
<string name="euicc_info_free_nvram_hint">(for reference only)</string>
<string name="euicc_info_ci_type">Certificate Issuer (CI)</string> <string name="euicc_info_ci_type">Certificate Issuer (CI)</string>
<string name="euicc_info_ci_gsma_live">GSMA Live CI</string> <string name="euicc_info_ci_gsma_live">GSMA Live CI</string>
<string name="euicc_info_ci_gsma_test">GSMA Test CI</string> <string name="euicc_info_ci_gsma_test">GSMA Test CI</string>
@ -222,7 +221,7 @@
<string name="pref_developer_ignore_tls_certificate_desc">Accept any TLS certificate used by the RSP server</string> <string name="pref_developer_ignore_tls_certificate_desc">Accept any TLS certificate used by the RSP server</string>
<string name="pref_developer_euicc_memory_reset">Allow erasing eUICC</string> <string name="pref_developer_euicc_memory_reset">Allow erasing eUICC</string>
<string name="pref_developer_euicc_memory_reset_desc">This is a dangerous operation and hidden by default. As an alternative, you can delete all profiles manually.</string> <string name="pref_developer_euicc_memory_reset_desc">This is a dangerous operation and hidden by default. As an alternative, you can delete all profiles manually.</string>
<string name="pref_developer_es10x_mss" translatable="false">ES10x MSS</string> <string name="pref_developer_es10x_mss">ES10x MSS</string>
<string name="pref_developer_es10x_mss_desc">Global ES10x MSS</string> <string name="pref_developer_es10x_mss_desc">Global ES10x MSS</string>
<string-array name="pref_developer_es10x_entry_keys"> <string-array name="pref_developer_es10x_entry_keys">
<item>High Speed</item> <item>High Speed</item>

View file

@ -11,14 +11,12 @@ import net.typeblog.lpac_jni.LocalProfileInfo
import net.typeblog.lpac_jni.LocalProfileNotification import net.typeblog.lpac_jni.LocalProfileNotification
import net.typeblog.lpac_jni.ProfileDownloadCallback import net.typeblog.lpac_jni.ProfileDownloadCallback
import net.typeblog.lpac_jni.Version import net.typeblog.lpac_jni.Version
import java.util.concurrent.locks.ReentrantLock
import kotlin.concurrent.withLock
class LocalProfileAssistantImpl( class LocalProfileAssistantImpl(
isdrAid: ByteArray, isdrAid: ByteArray,
rawApduInterface: ApduInterface, rawApduInterface: ApduInterface,
rawHttpInterface: HttpInterface rawHttpInterface: HttpInterface
) : LocalProfileAssistant { ): LocalProfileAssistant {
companion object { companion object {
private const val TAG = "LocalProfileAssistantImpl" private const val TAG = "LocalProfileAssistantImpl"
} }
@ -76,10 +74,6 @@ class LocalProfileAssistantImpl(
} }
} }
// Controls concurrency of every single method in this class, since
// the C-side is explicitly NOT thread-safe
private val lock = ReentrantLock()
private val apduInterface = ApduInterfaceWrapper(rawApduInterface) private val apduInterface = ApduInterfaceWrapper(rawApduInterface)
private val httpInterface = HttpInterfaceWrapper(rawHttpInterface) private val httpInterface = HttpInterfaceWrapper(rawHttpInterface)
@ -111,24 +105,23 @@ class LocalProfileAssistantImpl(
} }
override val profiles: List<LocalProfileInfo> override val profiles: List<LocalProfileInfo>
get() = lock.withLock { @Synchronized
get() {
val head = LpacJni.es10cGetProfilesInfo(contextHandle) val head = LpacJni.es10cGetProfilesInfo(contextHandle)
var curr = head var curr = head
val ret = mutableListOf<LocalProfileInfo>() val ret = mutableListOf<LocalProfileInfo>()
while (curr != 0L) { while (curr != 0L) {
val state = LocalProfileInfo.State.fromString(LpacJni.profileGetStateString(curr)) val state = LocalProfileInfo.State.fromString(LpacJni.profileGetStateString(curr))
val clazz = LocalProfileInfo.Clazz.fromString(LpacJni.profileGetClassString(curr)) val clazz = LocalProfileInfo.Clazz.fromString(LpacJni.profileGetClassString(curr))
ret.add( ret.add(LocalProfileInfo(
LocalProfileInfo( LpacJni.profileGetIccid(curr),
LpacJni.profileGetIccid(curr), state,
state, LpacJni.profileGetName(curr),
LpacJni.profileGetName(curr), LpacJni.profileGetNickname(curr),
LpacJni.profileGetNickname(curr), LpacJni.profileGetServiceProvider(curr),
LpacJni.profileGetServiceProvider(curr), LpacJni.profileGetIsdpAid(curr),
LpacJni.profileGetIsdpAid(curr), clazz
clazz ))
)
)
curr = LpacJni.profilesNext(curr) curr = LpacJni.profilesNext(curr)
} }
@ -137,87 +130,79 @@ class LocalProfileAssistantImpl(
} }
override val notifications: List<LocalProfileNotification> override val notifications: List<LocalProfileNotification>
get() = lock.withLock { @Synchronized
get() {
val head = LpacJni.es10bListNotification(contextHandle) val head = LpacJni.es10bListNotification(contextHandle)
var curr = head var curr = head
val ret = mutableListOf<LocalProfileNotification>()
try { while (curr != 0L) {
val ret = mutableListOf<LocalProfileNotification>() ret.add(LocalProfileNotification(
while (curr != 0L) { LpacJni.notificationGetSeq(curr),
ret.add( LocalProfileNotification.Operation.fromString(LpacJni.notificationGetOperationString(curr)),
LocalProfileNotification( LpacJni.notificationGetAddress(curr),
LpacJni.notificationGetSeq(curr), LpacJni.notificationGetIccid(curr),
LocalProfileNotification.Operation.fromString( ))
LpacJni.notificationGetOperationString( curr = LpacJni.notificationsNext(curr)
curr
)
),
LpacJni.notificationGetAddress(curr),
LpacJni.notificationGetIccid(curr),
)
)
curr = LpacJni.notificationsNext(curr)
}
return ret.sortedBy { it.seqNumber }.reversed()
} finally {
LpacJni.notificationsFree(head)
} }
LpacJni.notificationsFree(head)
return ret.sortedBy { it.seqNumber }.reversed()
} }
override val eID: String override val eID: String
get() = lock.withLock { LpacJni.es10cGetEid(contextHandle)!! } @Synchronized
get() = LpacJni.es10cGetEid(contextHandle)!!
override val euiccInfo2: EuiccInfo2? override val euiccInfo2: EuiccInfo2?
get() = lock.withLock { @Synchronized
get() {
val cInfo = LpacJni.es10cexGetEuiccInfo2(contextHandle) val cInfo = LpacJni.es10cexGetEuiccInfo2(contextHandle)
if (cInfo == 0L) return null if (cInfo == 0L) return null
try { val ret = EuiccInfo2(
return EuiccInfo2( Version(LpacJni.euiccInfo2GetSGP22Version(cInfo)),
Version(LpacJni.euiccInfo2GetSGP22Version(cInfo)), Version(LpacJni.euiccInfo2GetProfileVersion(cInfo)),
Version(LpacJni.euiccInfo2GetProfileVersion(cInfo)), Version(LpacJni.euiccInfo2GetEuiccFirmwareVersion(cInfo)),
Version(LpacJni.euiccInfo2GetEuiccFirmwareVersion(cInfo)), Version(LpacJni.euiccInfo2GetGlobalPlatformVersion(cInfo)),
Version(LpacJni.euiccInfo2GetGlobalPlatformVersion(cInfo)), LpacJni.euiccInfo2GetSasAcreditationNumber(cInfo),
LpacJni.euiccInfo2GetSasAcreditationNumber(cInfo), Version(LpacJni.euiccInfo2GetPpVersion(cInfo)),
Version(LpacJni.euiccInfo2GetPpVersion(cInfo)), LpacJni.euiccInfo2GetFreeNonVolatileMemory(cInfo).toInt(),
LpacJni.euiccInfo2GetFreeNonVolatileMemory(cInfo).toInt(), LpacJni.euiccInfo2GetFreeVolatileMemory(cInfo).toInt(),
LpacJni.euiccInfo2GetFreeVolatileMemory(cInfo).toInt(), buildSet {
buildSet { var cursor = LpacJni.euiccInfo2GetEuiccCiPKIdListForSigning(cInfo)
var cursor = LpacJni.euiccInfo2GetEuiccCiPKIdListForSigning(cInfo) while (cursor != 0L) {
while (cursor != 0L) { add(LpacJni.stringDeref(cursor))
add(LpacJni.stringDeref(cursor)) cursor = LpacJni.stringArrNext(cursor)
cursor = LpacJni.stringArrNext(cursor) }
} },
}, buildSet {
buildSet { var cursor = LpacJni.euiccInfo2GetEuiccCiPKIdListForVerification(cInfo)
var cursor = LpacJni.euiccInfo2GetEuiccCiPKIdListForVerification(cInfo) while (cursor != 0L) {
while (cursor != 0L) { add(LpacJni.stringDeref(cursor))
add(LpacJni.stringDeref(cursor)) cursor = LpacJni.stringArrNext(cursor)
cursor = LpacJni.stringArrNext(cursor) }
} },
}, )
)
} finally { LpacJni.euiccInfo2Free(cInfo)
LpacJni.euiccInfo2Free(cInfo)
} return ret
} }
override fun enableProfile(iccid: String, refresh: Boolean): Boolean = lock.withLock { @Synchronized
override fun enableProfile(iccid: String, refresh: Boolean): Boolean =
LpacJni.es10cEnableProfile(contextHandle, iccid, refresh) == 0 LpacJni.es10cEnableProfile(contextHandle, iccid, refresh) == 0
}
override fun disableProfile(iccid: String, refresh: Boolean): Boolean = lock.withLock { @Synchronized
override fun disableProfile(iccid: String, refresh: Boolean): Boolean =
LpacJni.es10cDisableProfile(contextHandle, iccid, refresh) == 0 LpacJni.es10cDisableProfile(contextHandle, iccid, refresh) == 0
}
override fun deleteProfile(iccid: String): Boolean = lock.withLock { @Synchronized
override fun deleteProfile(iccid: String): Boolean =
LpacJni.es10cDeleteProfile(contextHandle, iccid) == 0 LpacJni.es10cDeleteProfile(contextHandle, iccid) == 0
}
override fun downloadProfile( @Synchronized
smdp: String, matchingId: String?, imei: String?, override fun downloadProfile(smdp: String, matchingId: String?, imei: String?,
confirmationCode: String?, callback: ProfileDownloadCallback confirmationCode: String?, callback: ProfileDownloadCallback) {
) = lock.withLock {
val res = LpacJni.downloadProfile( val res = LpacJni.downloadProfile(
contextHandle, contextHandle,
smdp, smdp,
@ -244,17 +229,18 @@ class LocalProfileAssistantImpl(
} }
} }
override fun deleteNotification(seqNumber: Long): Boolean = lock.withLock { @Synchronized
override fun deleteNotification(seqNumber: Long): Boolean =
LpacJni.es10bDeleteNotification(contextHandle, seqNumber) == 0 LpacJni.es10bDeleteNotification(contextHandle, seqNumber) == 0
}
override fun handleNotification(seqNumber: Long): Boolean = lock.withLock { @Synchronized
override fun handleNotification(seqNumber: Long): Boolean =
LpacJni.handleNotification(contextHandle, seqNumber).also { LpacJni.handleNotification(contextHandle, seqNumber).also {
Log.d(TAG, "handleNotification $seqNumber = $it") Log.d(TAG, "handleNotification $seqNumber = $it")
} == 0 } == 0
}
override fun setNickname(iccid: String, nickname: String) = lock.withLock { @Synchronized
override fun setNickname(iccid: String, nickname: String) {
val encoded = try { val encoded = try {
Charsets.UTF_8.encode(nickname).array() Charsets.UTF_8.encode(nickname).array()
} catch (e: CharacterCodingException) { } catch (e: CharacterCodingException) {
@ -273,12 +259,11 @@ class LocalProfileAssistantImpl(
} }
override fun euiccMemoryReset() { override fun euiccMemoryReset() {
lock.withLock { LpacJni.es10cEuiccMemoryReset(contextHandle)
LpacJni.es10cEuiccMemoryReset(contextHandle)
}
} }
override fun close() = lock.withLock { @Synchronized
override fun close() {
if (!finalized) { if (!finalized) {
LpacJni.euiccFini(contextHandle) LpacJni.euiccFini(contextHandle)
LpacJni.destroyContext(contextHandle) LpacJni.destroyContext(contextHandle)