eSIM enablement via @PeterCxy's OpenEUICC

tested working on bluejay

Signed-off-by: Tad <tad@spotco.us>
This commit is contained in:
Tad 2023-08-21 08:10:18 -04:00
parent c90920965f
commit c070e856b2
No known key found for this signature in database
GPG Key ID: B286E9F57A07424B
5 changed files with 143 additions and 7 deletions

View File

@ -52,9 +52,9 @@
<!-- GrapheneOS -->
<project path="external/hardened_malloc" name="GrapheneOS/hardened_malloc" remote="github" revision="d3152b8e8ff5070f69e7c991d34f32a429e6a894" />
<!-- OpenEUICC
<!-- OpenEUICC -->
<project path="packages/apps/OpenEUICC" name="PeterCxy/OpenEUICC" remote="angry" revision="6add8c89ac141f177cd8d124a0a955232f4222f9" />
<project path="prebuilts/openeuicc-deps" name="PeterCxy/android_prebuilts_openeuicc-deps" remote="angry" revision="55f3e2c7ab26484f7478b26540fa14392d0c2cd7" /> -->
<project path="prebuilts/openeuicc-deps" name="PeterCxy/android_prebuilts_openeuicc-deps" remote="angry" revision="55f3e2c7ab26484f7478b26540fa14392d0c2cd7" />
<!-- END OF ADDITIONAL REPOS -->
<!-- START OF DEVICE REPOS -->

View File

@ -13,10 +13,10 @@ PRODUCT_PACKAGES += \
# OpenCamera
#endif
#ifneq ($(filter crosshatch blueline bonito sargo coral flame sunfish barbet redfin bluejay oriole raven panther cheetah FP4,$(TARGET_DEVICE)),)
#PRODUCT_PACKAGES += \
# OpenEUICC
#endif
ifeq (,$(filter crosshatch blueline bonito sargo coral flame sunfish barbet redfin bluejay oriole raven panther cheetah FP4,$(TARGET_PRODUCT)))
PRODUCT_PACKAGES += \
OpenEUICC
endif
# Extras
PRODUCT_PACKAGES += \

View File

@ -0,0 +1,132 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Mon, 21 Aug 2023 08:07:40 -0400
Subject: [PATCH] Hacky fix for misidentifying physical SIM
Signed-off-by: Tad <tad@spotco.us>
---
app/src/main/java/im/angry/openeuicc/core/EuiccChannel.kt | 4 +++-
.../java/im/angry/openeuicc/core/EuiccChannelManager.kt | 7 ++++---
.../java/im/angry/openeuicc/service/OpenEuiccService.kt | 3 ++-
.../java/im/angry/openeuicc/ui/EuiccManagementFragment.kt | 4 ++--
app/src/main/java/im/angry/openeuicc/ui/MainActivity.kt | 6 ++++--
5 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/app/src/main/java/im/angry/openeuicc/core/EuiccChannel.kt b/app/src/main/java/im/angry/openeuicc/core/EuiccChannel.kt
index 53fd3c7..0067996 100644
--- a/app/src/main/java/im/angry/openeuicc/core/EuiccChannel.kt
+++ b/app/src/main/java/im/angry/openeuicc/core/EuiccChannel.kt
@@ -8,7 +8,8 @@ data class EuiccChannelInfo(
val cardId: Int,
val name: String,
val imei: String,
- val removable: Boolean
+ val removable: Boolean,
+ val ignore: Boolean
)
abstract class EuiccChannel(
@@ -19,6 +20,7 @@ abstract class EuiccChannel(
val name = info.name
val imei = info.imei
val removable = info.removable
+ val ignore = info.ignore
abstract val lpa: LocalProfileAssistant
abstract val valid: Boolean
diff --git a/app/src/main/java/im/angry/openeuicc/core/EuiccChannelManager.kt b/app/src/main/java/im/angry/openeuicc/core/EuiccChannelManager.kt
index c710c9d..4e709ae 100644
--- a/app/src/main/java/im/angry/openeuicc/core/EuiccChannelManager.kt
+++ b/app/src/main/java/im/angry/openeuicc/core/EuiccChannelManager.kt
@@ -67,12 +67,13 @@ class EuiccChannelManager(private val context: Context) {
uiccInfo.cardId,
"SIM ${uiccInfo.slotIndex}",
tm.getImei(uiccInfo.slotIndex) ?: return null,
- uiccInfo.isRemovable
+ uiccInfo.isRemovable,
+ (uiccInfo.getEid() == null || uiccInfo.getEid().matches("^[0]+$".toRegex()))
)
var euiccChannel: EuiccChannel? = null
- if (uiccInfo.isEuicc && !uiccInfo.isRemovable) {
+ if (uiccInfo.isEuicc && !uiccInfo.isRemovable && !channelInfo.ignore) {
Log.d(TAG, "Using TelephonyManager for slot ${uiccInfo.slotIndex}")
// TODO: On Tiramisu, we should also connect all available "ports" for MEP support
euiccChannel = TelephonyManagerChannel.tryConnect(tm, channelInfo)
@@ -141,4 +142,4 @@ class EuiccChannelManager(private val context: Context) {
}
}
}
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/im/angry/openeuicc/service/OpenEuiccService.kt b/app/src/main/java/im/angry/openeuicc/service/OpenEuiccService.kt
index eb41e7c..be94316 100644
--- a/app/src/main/java/im/angry/openeuicc/service/OpenEuiccService.kt
+++ b/app/src/main/java/im/angry/openeuicc/service/OpenEuiccService.kt
@@ -58,6 +58,7 @@ class OpenEuiccService : EuiccService() {
override fun onGetEuiccProfileInfoList(slotId: Int): GetEuiccProfileInfoListResult? {
val channel = findChannel(slotId) ?: return null
+ if(findChannel(slotId)!!.ignore) { return null }
val profiles = channel.lpa.profiles.operational.map {
EuiccProfileInfo.Builder(it.iccid).apply {
setProfileName(it.name)
@@ -179,4 +180,4 @@ class OpenEuiccService : EuiccService() {
// No-op -- we do not care
return RESULT_FIRST_USER
}
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/im/angry/openeuicc/ui/EuiccManagementFragment.kt b/app/src/main/java/im/angry/openeuicc/ui/EuiccManagementFragment.kt
index 6a3b253..e261cac 100644
--- a/app/src/main/java/im/angry/openeuicc/ui/EuiccManagementFragment.kt
+++ b/app/src/main/java/im/angry/openeuicc/ui/EuiccManagementFragment.kt
@@ -80,7 +80,7 @@ class EuiccManagementFragment : Fragment(), EuiccFragmentMarker, EuiccProfilesCh
@SuppressLint("NotifyDataSetChanged")
private fun refresh() {
swipeRefresh.isRefreshing = true
-
+ if(channel!!.ignore) { return }
lifecycleScope.launch {
val profiles = withContext(Dispatchers.IO) {
openEuiccApplication.subscriptionManager.tryRefreshCachedEuiccInfo(channel.cardId)
@@ -221,4 +221,4 @@ class EuiccManagementFragment : Fragment(), EuiccFragmentMarker, EuiccProfilesCh
override fun getItemCount(): Int = profiles.size
}
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/im/angry/openeuicc/ui/MainActivity.kt b/app/src/main/java/im/angry/openeuicc/ui/MainActivity.kt
index d0f7465..b286cde 100644
--- a/app/src/main/java/im/angry/openeuicc/ui/MainActivity.kt
+++ b/app/src/main/java/im/angry/openeuicc/ui/MainActivity.kt
@@ -95,15 +95,17 @@ class MainActivity : AppCompatActivity() {
manager.enumerateEuiccChannels()
manager.knownChannels.forEach {
Log.d(TAG, it.name)
- Log.d(TAG, it.lpa.eid)
+ //Log.d(TAG, it.lpa.eid)
openEuiccApplication.subscriptionManager.tryRefreshCachedEuiccInfo(it.cardId)
}
}
withContext(Dispatchers.Main) {
manager.knownChannels.forEach { channel ->
+ if(!channel!!.ignore) {
spinnerAdapter.add(channel.name)
fragments.add(EuiccManagementFragment.newInstance(channel.slotId))
+ }
}
if (fragments.isNotEmpty()) {
@@ -112,4 +114,4 @@ class MainActivity : AppCompatActivity() {
}
}
}
-}
\ No newline at end of file
+}

View File

@ -293,6 +293,10 @@ if enterAndClear "packages/apps/Nfc"; then
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_packages_apps_Nfc/0001-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
fi;
if enterAndClear "packages/apps/OpenEUICC"; then
applyPatch "$DOS_PATCHES/android_packages_apps_OpenEUICC/0001-hacky-fix.patch"; #Hacky fix for misidentifying physical SIM (DivestOS)
fi;
if enterAndClear "packages/apps/Settings"; then
git revert --no-edit 41b4ed345a91da1dd46c00ee11a151c2b5ff4f43;
applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0004-Private_DNS.patch"; #More 'Private DNS' options (heavily based off of a CalyxOS patch)

View File

@ -48,7 +48,7 @@ export DOS_DEBLOBBER_REMOVE_DPP=false; #Set true to remove all Display Post Proc
export DOS_DEBLOBBER_REMOVE_FP=false; #Set true to remove all fingerprint reader blobs
export DOS_DEBLOBBER_REMOVE_GRAPHICS=false; #Set true to remove all graphics blobs and use SwiftShader CPU renderer #TODO: Needs work
export DOS_DEBLOBBER_REMOVE_EUICC=true; #Set true to remove all Google eUICC blobs
export DOS_DEBLOBBER_REMOVE_EUICC_FULL=true; #Set true to remove all hardware eUICC blobs #TODO: needs work
export DOS_DEBLOBBER_REMOVE_EUICC_FULL=false; #Set true to remove all hardware eUICC blobs
export DOS_DEBLOBBER_REMOVE_IMS=false; #Set true to remove all IMS blobs #XXX: Carriers are phasing out 3G, making IMS mandatory for calls
export DOS_DEBLOBBER_REMOVE_IPA=false; #Set true to remove all IPA blobs
export DOS_DEBLOBBER_REMOVE_IR=false; #Set true to remove all IR blobs