Compare commits

..

No commits in common. "e6a37c25dc77ea40074e90091ba558f279d36434" and "1c89b9c042f83188363d956ba5ef9f1b69bb291c" have entirely different histories.

9 changed files with 23 additions and 48 deletions

View file

@ -1,7 +1,7 @@
on: on:
push: push:
branches: branches:
- '*' - 'master'
jobs: jobs:
build-debug: build-debug:

View file

@ -45,9 +45,8 @@
<!-- Accepts URIs that begin with "lpa:" --> <!-- Accepts URIs that begin with "lpa:" -->
<!-- for example: "LPA:1$..." --> <!-- for example: "LPA:1$..." -->
<!-- refs: https://www.iana.org/assignments/uri-schemes/prov/lpa --> <!-- refs: https://www.iana.org/assignments/uri-schemes/prov/lpa -->
<data android:scheme="lpa" /> <data android:scheme="lpa"/>
<data android:scheme="LPA" tools:ignore="AppLinkUrlError" /> <data android:sspPrefix="1$"/>
<data android:sspPrefix="1$" />
</intent-filter> </intent-filter>
</activity> </activity>

View file

@ -27,13 +27,6 @@ import kotlinx.coroutines.launch
import net.typeblog.lpac_jni.impl.PKID_GSMA_LIVE_CI import net.typeblog.lpac_jni.impl.PKID_GSMA_LIVE_CI
import net.typeblog.lpac_jni.impl.PKID_GSMA_TEST_CI import net.typeblog.lpac_jni.impl.PKID_GSMA_TEST_CI
// https://euicc-manual.osmocom.org/docs/pki/eum/accredited.json
// ref: <https://regex101.com/r/5FFz8u>
private val RE_SAS = Regex(
"""^[A-Z]{2}-[A-Z]{2}(?:-UP)?-\d{4}T?(?:-\d+)?T?$""",
setOf(RegexOption.IGNORE_CASE),
)
class EuiccInfoActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker { class EuiccInfoActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker {
companion object { companion object {
private val YES_NO = Pair(R.string.yes, R.string.no) private val YES_NO = Pair(R.string.yes, R.string.no)
@ -116,14 +109,13 @@ class EuiccInfoActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker {
vendorInfo.firmwareVersion?.let { add(Item(R.string.euicc_info_fw_ver, it)) } vendorInfo.firmwareVersion?.let { add(Item(R.string.euicc_info_fw_ver, it)) }
vendorInfo.bootloaderVersion?.let { add(Item(R.string.euicc_info_bl_ver, it)) } vendorInfo.bootloaderVersion?.let { add(Item(R.string.euicc_info_bl_ver, it)) }
} }
channel.lpa.euiccInfo2?.let { info -> channel.lpa.euiccInfo2.let { info ->
add(Item(R.string.euicc_info_sgp22_version, info.sgp22Version.toString())) add(Item(R.string.euicc_info_sgp22_version, info?.sgp22Version.toString()))
add(Item(R.string.euicc_info_firmware_version, info.euiccFirmwareVersion.toString())) add(Item(R.string.euicc_info_firmware_version, info?.euiccFirmwareVersion.toString()))
add(Item(R.string.euicc_info_globalplatform_version, info.globalPlatformVersion.toString())) add(Item(R.string.euicc_info_globalplatform_version, info?.globalPlatformVersion.toString()))
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) add(Item(R.string.euicc_info_sas_accreditation_number, info?.sasAccreditationNumber))
?.let { add(Item(R.string.euicc_info_sas_accreditation_number, it.uppercase())) } add(Item(R.string.euicc_info_free_nvram, info?.freeNvram?.let(::formatFreeSpace)))
add(Item(R.string.euicc_info_free_nvram, info.freeNvram.let(::formatFreeSpace)))
} }
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)
@ -142,9 +134,14 @@ class EuiccInfoActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker {
add(Item(R.string.euicc_info_atr, atr, copiedToastResId = R.string.toast_atr_copied)) add(Item(R.string.euicc_info_atr, atr, copiedToastResId = R.string.toast_atr_copied))
} }
@Suppress("SameParameterValue")
private fun formatByBoolean(b: Boolean, res: Pair<Int, Int>): String = private fun formatByBoolean(b: Boolean, res: Pair<Int, Int>): String =
getString(if (b) res.first else res.second) getString(
if (b) {
res.first
} else {
res.second
}
)
inner class EuiccInfoViewHolder(root: View) : ViewHolder(root) { inner class EuiccInfoViewHolder(root: View) : ViewHolder(root) {
private val title: TextView = root.requireViewById(R.id.euicc_info_title) private val title: TextView = root.requireViewById(R.id.euicc_info_title)

View file

@ -347,7 +347,6 @@ open class EuiccManagementFragment : Fragment(), EuiccProfilesChangedListener,
private val profileClassLabel: TextView = root.requireViewById(R.id.profile_class_label) private val profileClassLabel: TextView = root.requireViewById(R.id.profile_class_label)
private val profileClass: TextView = root.requireViewById(R.id.profile_class) private val profileClass: TextView = root.requireViewById(R.id.profile_class)
private val profileMenu: ImageButton = root.requireViewById(R.id.profile_menu) private val profileMenu: ImageButton = root.requireViewById(R.id.profile_menu)
private val profileSeqNumber: TextView = root.requireViewById(R.id.profile_sequence_number)
init { init {
iccid.setOnClickListener { iccid.setOnClickListener {
@ -367,9 +366,7 @@ open class EuiccManagementFragment : Fragment(), EuiccProfilesChangedListener,
true true
} }
profileMenu.setOnClickListener { profileMenu.setOnClickListener { showOptionsMenu() }
showOptionsMenu()
}
} }
private lateinit var profile: LocalProfileInfo private lateinit var profile: LocalProfileInfo
@ -399,13 +396,6 @@ open class EuiccManagementFragment : Fragment(), EuiccProfilesChangedListener,
iccid.transformationMethod = PasswordTransformationMethod.getInstance() iccid.transformationMethod = PasswordTransformationMethod.getInstance()
} }
fun setProfileSequenceNumber(index: Int) {
profileSeqNumber.text = root.context.getString(
R.string.profile_sequence_number_format,
index,
)
}
private fun showOptionsMenu() { private fun showOptionsMenu() {
// Prevent users from doing multiple things at once // Prevent users from doing multiple things at once
if (invalid || swipeRefresh.isRefreshing) return if (invalid || swipeRefresh.isRefreshing) return
@ -471,7 +461,6 @@ open class EuiccManagementFragment : Fragment(), EuiccProfilesChangedListener,
when (holder) { when (holder) {
is ProfileViewHolder -> { is ProfileViewHolder -> {
holder.setProfile(profiles[position]) holder.setProfile(profiles[position])
holder.setProfileSequenceNumber(position + 1)
} }
is FooterViewHolder -> { is FooterViewHolder -> {
holder.attach(footerViews[position - profiles.size]) holder.attach(footerViews[position - profiles.size])

View file

@ -123,8 +123,8 @@ class DownloadWizardActivity: BaseEuiccAccessActivity() {
// If we get an LPA string from deep-link intents, extract from there. // If we get an LPA string from deep-link intents, extract from there.
// Note that `onRestoreInstanceState` could override this with user input, // Note that `onRestoreInstanceState` could override this with user input,
// but that _is_ the desired behavior. // but that _is_ the desired behavior.
val uri = intent.data ?: return val uri = intent.data
if (uri.scheme.contentEquals("lpa", ignoreCase = true)) { if (uri?.scheme == "lpa") {
val parsed = LPAString.parse(uri.schemeSpecificPart) val parsed = LPAString.parse(uri.schemeSpecificPart)
state.smdp = parsed.address state.smdp = parsed.address
state.matchingId = parsed.matchingId state.matchingId = parsed.matchingId

View file

@ -129,14 +129,6 @@
app:layout_constraintTop_toBottomOf="@id/profile_class" app:layout_constraintTop_toBottomOf="@id/profile_class"
app:layout_constraintBottom_toBottomOf="parent"/> app:layout_constraintBottom_toBottomOf="parent"/>
<TextView
android:id="@+id/profile_sequence_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="6dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/iccid" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>

View file

@ -27,7 +27,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:contentDescription="@string/profile_download"
android:src="@drawable/ic_add" android:src="@drawable/ic_add"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/> app:layout_constraintBottom_toBottomOf="parent"/>

View file

@ -19,7 +19,6 @@
<string name="profile_class_provisioning">Provisioning</string> <string name="profile_class_provisioning">Provisioning</string>
<string name="profile_class_operational">Operational</string> <string name="profile_class_operational">Operational</string>
<string name="iccid" translatable="false">ICCID:</string> <string name="iccid" translatable="false">ICCID:</string>
<string name="profile_sequence_number_format" translatable="false">#%d</string>
<string name="enable">Enable</string> <string name="enable">Enable</string>
<string name="disable">Disable</string> <string name="disable">Disable</string>

View file

@ -80,7 +80,7 @@ apdu_interface_transmit(struct euicc_ctx *ctx, uint8_t **rx, uint32_t *rx_len, c
LPAC_JNI_EXCEPTION_RETURN; LPAC_JNI_EXCEPTION_RETURN;
*rx_len = (*env)->GetArrayLength(env, ret); *rx_len = (*env)->GetArrayLength(env, ret);
*rx = calloc(*rx_len, sizeof(uint8_t)); *rx = calloc(*rx_len, sizeof(uint8_t));
(*env)->GetByteArrayRegion(env, ret, 0, *rx_len, (jbyte *) *rx); (*env)->GetByteArrayRegion(env, ret, 0, *rx_len, *rx);
(*env)->DeleteLocalRef(env, txArr); (*env)->DeleteLocalRef(env, txArr);
(*env)->DeleteLocalRef(env, ret); (*env)->DeleteLocalRef(env, ret);
return 0; return 0;
@ -113,7 +113,7 @@ http_interface_transmit(struct euicc_ctx *ctx, const char *url, uint32_t *rcode,
jbyteArray rxArr = (jbyteArray) (*env)->GetObjectField(env, ret, field_resp_data); jbyteArray rxArr = (jbyteArray) (*env)->GetObjectField(env, ret, field_resp_data);
*rx_len = (*env)->GetArrayLength(env, rxArr); *rx_len = (*env)->GetArrayLength(env, rxArr);
*rx = calloc(*rx_len, sizeof(uint8_t)); *rx = calloc(*rx_len, sizeof(uint8_t));
(*env)->GetByteArrayRegion(env, rxArr, 0, *rx_len, (jbyte *) *rx); (*env)->GetByteArrayRegion(env, rxArr, 0, *rx_len, *rx);
(*env)->DeleteLocalRef(env, txArr); (*env)->DeleteLocalRef(env, txArr);
(*env)->DeleteLocalRef(env, rxArr); (*env)->DeleteLocalRef(env, rxArr);
(*env)->DeleteLocalRef(env, headersArr); (*env)->DeleteLocalRef(env, headersArr);