From: Nolen Johnson Date: Thu, 21 Nov 2024 05:26:36 +0000 (-0500) Subject: exynos9610: Patch IMS APKs at extract-time X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e8b5fb03562c0f35d7b6f6953f789c85af76b909;p=GitHub%2FLineageOS%2Fandroid_device_motorola_exynos9610-common.git exynos9610: Patch IMS APKs at extract-time Change-Id: Id320b5a5c4a1c649eb864933f26bdf6d15dce74a --- diff --git a/blob-patches/ShannonDataService/0001-exynos9610-Patch-Shannon-applications-calls-to-getSi.patch b/blob-patches/ShannonDataService/0001-exynos9610-Patch-Shannon-applications-calls-to-getSi.patch new file mode 100644 index 0000000..00f9013 --- /dev/null +++ b/blob-patches/ShannonDataService/0001-exynos9610-Patch-Shannon-applications-calls-to-getSi.patch @@ -0,0 +1,49 @@ +From 01fd69a4fb0f908690c7b288a1104097cdc8cd47 Mon Sep 17 00:00:00 2001 +From: Nolen Johnson +Date: Mon, 1 Jan 2024 02:41:10 -0500 +Subject: [PATCH] exynos9610: Patch Shannon applications calls to + getSimStateForSlotIndex + +* Account for getSimStateForSlotIndex moving from SubscriptionManager to + TelephonyManager. +* Simply apktool d *.apk, then grep for `getSimStateForSlotIndex`, and + then replace all references to that to call from `TelephonyManager` + instead of the existing call to `SubscriptionManager`. +* apktool b *.apk, and boom - functional IMS. + +Reference: https://android-review.googlesource.com/c/platform/frameworks/base/+/2484178 +Change-Id: I7574369d2a73d8751db8bef940fe8c3271c002ea +--- + .../dataservice/SimManager$SimStateBroadcastReceiver.smali | 2 +- + smali/com/shannon/dataservice/SimManager.smali | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/smali/com/shannon/dataservice/SimManager$SimStateBroadcastReceiver.smali b/smali/com/shannon/dataservice/SimManager$SimStateBroadcastReceiver.smali +index 0f50a72..987fa20 100644 +--- a/smali/com/shannon/dataservice/SimManager$SimStateBroadcastReceiver.smali ++++ b/smali/com/shannon/dataservice/SimManager$SimStateBroadcastReceiver.smali +@@ -141,7 +141,7 @@ + + .line 80 + :cond_4 +- invoke-static {p1}, Landroid/telephony/SubscriptionManager;->getSimStateForSlotIndex(I)I ++ invoke-static {p1}, Landroid/telephony/TelephonyManager;->getSimStateForSlotIndex(I)I + + move-result p2 + +diff --git a/smali/com/shannon/dataservice/SimManager.smali b/smali/com/shannon/dataservice/SimManager.smali +index d70605d..d31854e 100644 +--- a/smali/com/shannon/dataservice/SimManager.smali ++++ b/smali/com/shannon/dataservice/SimManager.smali +@@ -188,7 +188,7 @@ + if-ge p1, v0, :cond_1 + + .line 134 +- invoke-static {p1}, Landroid/telephony/SubscriptionManager;->getSimStateForSlotIndex(I)I ++ invoke-static {p1}, Landroid/telephony/TelephonyManager;->getSimStateForSlotIndex(I)I + + move-result v0 + +-- +2.43.0 + diff --git a/blob-patches/ShannonIms/0001-exynos9610-Patch-Shannon-applications-calls-to-getSi.patch b/blob-patches/ShannonIms/0001-exynos9610-Patch-Shannon-applications-calls-to-getSi.patch new file mode 100644 index 0000000..2b2f4e8 --- /dev/null +++ b/blob-patches/ShannonIms/0001-exynos9610-Patch-Shannon-applications-calls-to-getSi.patch @@ -0,0 +1,72 @@ +From a6b802e1743a6b91e5f77352cda9cfee3e231f0c Mon Sep 17 00:00:00 2001 +From: Nolen Johnson +Date: Mon, 1 Jan 2024 02:41:10 -0500 +Subject: [PATCH] exynos9610: Patch Shannon applications calls to + getSimStateForSlotIndex + +* Account for getSimStateForSlotIndex moving from SubscriptionManager to + TelephonyManager. +* Simply apktool d *.apk, then grep for `getSimStateForSlotIndex`, and + then replace all references to that to call from `TelephonyManager` + instead of the existing call to `SubscriptionManager`. +* apktool b *.apk, and boom - functional IMS. + +Reference: https://android-review.googlesource.com/c/platform/frameworks/base/+/2484178 +Change-Id: I7574369d2a73d8751db8bef940fe8c3271c002ea +--- + smali/com/shannon/imsservice/conn/ConnListener.smali | 2 +- + smali/com/shannon/imsservice/conn/ImsConnectivityMgr.smali | 2 +- + smali/com/shannon/imsservice/util/SubscriptionWrapper.smali | 4 ++-- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/smali/com/shannon/imsservice/conn/ConnListener.smali b/smali/com/shannon/imsservice/conn/ConnListener.smali +index 4ca5886..2dbc1f7 100644 +--- a/smali/com/shannon/imsservice/conn/ConnListener.smali ++++ b/smali/com/shannon/imsservice/conn/ConnListener.smali +@@ -2378,7 +2378,7 @@ + iget v0, v0, Lcom/shannon/imsservice/conn/ImsConnectivityMgr;->mSlotId:I + + .line 1044 +- invoke-static {v0}, Landroid/telephony/SubscriptionManager;->getSimStateForSlotIndex(I)I ++ invoke-static {v0}, Landroid/telephony/TelephonyManager;->getSimStateForSlotIndex(I)I + + move-result v0 + +diff --git a/smali/com/shannon/imsservice/conn/ImsConnectivityMgr.smali b/smali/com/shannon/imsservice/conn/ImsConnectivityMgr.smali +index 97b3880..2897205 100644 +--- a/smali/com/shannon/imsservice/conn/ImsConnectivityMgr.smali ++++ b/smali/com/shannon/imsservice/conn/ImsConnectivityMgr.smali +@@ -1786,7 +1786,7 @@ + .line 553 + iget v0, p0, Lcom/shannon/imsservice/conn/ImsConnectivityMgr;->mSlotId:I + +- invoke-static {v0}, Landroid/telephony/SubscriptionManager;->getSimStateForSlotIndex(I)I ++ invoke-static {v0}, Landroid/telephony/TelephonyManager;->getSimStateForSlotIndex(I)I + + move-result v0 + +diff --git a/smali/com/shannon/imsservice/util/SubscriptionWrapper.smali b/smali/com/shannon/imsservice/util/SubscriptionWrapper.smali +index d74d120..328d36c 100644 +--- a/smali/com/shannon/imsservice/util/SubscriptionWrapper.smali ++++ b/smali/com/shannon/imsservice/util/SubscriptionWrapper.smali +@@ -220,7 +220,7 @@ + .param p0, "slotId" # I + + .line 73 +- invoke-static {p0}, Landroid/telephony/SubscriptionManager;->getSimStateForSlotIndex(I)I ++ invoke-static {p0}, Landroid/telephony/TelephonyManager;->getSimStateForSlotIndex(I)I + + move-result v0 + +@@ -562,7 +562,7 @@ + .param p0, "slotId" # I + + .line 67 +- invoke-static {p0}, Landroid/telephony/SubscriptionManager;->getSimStateForSlotIndex(I)I ++ invoke-static {p0}, Landroid/telephony/TelephonyManager;->getSimStateForSlotIndex(I)I + + move-result v0 + +-- +2.43.0 + diff --git a/blob-patches/ShannonIms/0001-exynos9610-Patch-ShannonIms-to-use-updated-method-fo.patch b/blob-patches/ShannonIms/0001-exynos9610-Patch-ShannonIms-to-use-updated-method-fo.patch new file mode 100644 index 0000000..0899f21 --- /dev/null +++ b/blob-patches/ShannonIms/0001-exynos9610-Patch-ShannonIms-to-use-updated-method-fo.patch @@ -0,0 +1,29 @@ +From 2a5c0c559a020289bb7782a5822ae065ff64c794 Mon Sep 17 00:00:00 2001 +From: Jan Altensen +Date: Thu, 14 Apr 2022 11:45:22 -0400 +Subject: [PATCH] exynos9610: Patch ShannonIms to use updated method for + Android S + +* `sed -i 's/getDataConnectionNetworkType/getNetworkType/g' ShannonIms/smali/com/shannon/imsservice/conn/proxy/ImsConnectivityProxyListener*` + +Change-Id: Ief3ffd2a13e4e263240017e9a60d626e00853a6d +--- + .../ImsConnectivityProxyListener$ImsPhoneStateListener.smali | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/smali/com/shannon/imsservice/conn/proxy/ImsConnectivityProxyListener$ImsPhoneStateListener.smali b/smali/com/shannon/imsservice/conn/proxy/ImsConnectivityProxyListener$ImsPhoneStateListener.smali +index a6c7d71..8eb6882 100644 +--- a/smali/com/shannon/imsservice/conn/proxy/ImsConnectivityProxyListener$ImsPhoneStateListener.smali ++++ b/smali/com/shannon/imsservice/conn/proxy/ImsConnectivityProxyListener$ImsPhoneStateListener.smali +@@ -434,7 +434,7 @@ + + .line 353 + .local v4, "failCause":Lcom/shannon/imsservice/constants/PdnFailCause; +- invoke-virtual {p1}, Landroid/telephony/PreciseDataConnectionState;->getDataConnectionNetworkType()I ++ invoke-virtual {p1}, Landroid/telephony/PreciseDataConnectionState;->getNetworkType()I + + move-result v5 + +-- +2.43.0 + diff --git a/blob-patches/ShannonNetworkService/0001-exynos9610-Patch-Shannon-applications-calls-to-getSi.patch b/blob-patches/ShannonNetworkService/0001-exynos9610-Patch-Shannon-applications-calls-to-getSi.patch new file mode 100644 index 0000000..6d44e0f --- /dev/null +++ b/blob-patches/ShannonNetworkService/0001-exynos9610-Patch-Shannon-applications-calls-to-getSi.patch @@ -0,0 +1,49 @@ +From f37abd56ccfb6c9f1a0182410e65b0a45c62e3b7 Mon Sep 17 00:00:00 2001 +From: Nolen Johnson +Date: Mon, 1 Jan 2024 02:41:10 -0500 +Subject: [PATCH] exynos9610: Patch Shannon applications calls to + getSimStateForSlotIndex + +* Account for getSimStateForSlotIndex moving from SubscriptionManager to + TelephonyManager. +* Simply apktool d *.apk, then grep for `getSimStateForSlotIndex`, and + then replace all references to that to call from `TelephonyManager` + instead of the existing call to `SubscriptionManager`. +* apktool b *.apk, and boom - functional IMS. + +Reference: https://android-review.googlesource.com/c/platform/frameworks/base/+/2484178 +Change-Id: I7574369d2a73d8751db8bef940fe8c3271c002ea +--- + .../networkservice/SimManager$SimStateBroadcastReceiver.smali | 2 +- + smali/com/shannon/networkservice/SimManager.smali | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/smali/com/shannon/networkservice/SimManager$SimStateBroadcastReceiver.smali b/smali/com/shannon/networkservice/SimManager$SimStateBroadcastReceiver.smali +index 84e2714..b67f2eb 100644 +--- a/smali/com/shannon/networkservice/SimManager$SimStateBroadcastReceiver.smali ++++ b/smali/com/shannon/networkservice/SimManager$SimStateBroadcastReceiver.smali +@@ -149,7 +149,7 @@ + invoke-static {v0, p2}, Lcom/shannon/networkservice/SimManager;->access$100(Lcom/shannon/networkservice/SimManager;Ljava/lang/String;)V + + .line 123 +- invoke-static {p1}, Landroid/telephony/SubscriptionManager;->getSimStateForSlotIndex(I)I ++ invoke-static {p1}, Landroid/telephony/TelephonyManager;->getSimStateForSlotIndex(I)I + + move-result p2 + +diff --git a/smali/com/shannon/networkservice/SimManager.smali b/smali/com/shannon/networkservice/SimManager.smali +index 63e269b..e95a1b8 100644 +--- a/smali/com/shannon/networkservice/SimManager.smali ++++ b/smali/com/shannon/networkservice/SimManager.smali +@@ -132,7 +132,7 @@ + if-ge v1, v2, :cond_3 + + .line 176 +- invoke-static {v1}, Landroid/telephony/SubscriptionManager;->getSimStateForSlotIndex(I)I ++ invoke-static {v1}, Landroid/telephony/TelephonyManager;->getSimStateForSlotIndex(I)I + + move-result v2 + +-- +2.43.0 + diff --git a/blob-patches/ShannonQualifiedNetworksService/0001-exynos9610-Patch-Shannon-applications-calls-to-getSi.patch b/blob-patches/ShannonQualifiedNetworksService/0001-exynos9610-Patch-Shannon-applications-calls-to-getSi.patch new file mode 100644 index 0000000..9b1aa5f --- /dev/null +++ b/blob-patches/ShannonQualifiedNetworksService/0001-exynos9610-Patch-Shannon-applications-calls-to-getSi.patch @@ -0,0 +1,72 @@ +From a731271d37977f777f1f9e3bc6c48070a63cbfc6 Mon Sep 17 00:00:00 2001 +From: Nolen Johnson +Date: Mon, 1 Jan 2024 02:41:10 -0500 +Subject: [PATCH] exynos9610: Patch Shannon applications calls to + getSimStateForSlotIndex + +* Account for getSimStateForSlotIndex moving from SubscriptionManager to + TelephonyManager. +* Simply apktool d *.apk, then grep for `getSimStateForSlotIndex`, and + then replace all references to that to call from `TelephonyManager` + instead of the existing call to `SubscriptionManager`. +* apktool b *.apk, and boom - functional IMS. + +Reference: https://android-review.googlesource.com/c/platform/frameworks/base/+/2484178 +Change-Id: I7574369d2a73d8751db8bef940fe8c3271c002ea +--- + .../SimManager$SimBroadcastReceiver.smali | 2 +- + smali/com/shannon/qualifiednetworksservice/SimManager.smali | 2 +- + ...ShannonVendorCarrierConfig$SimStateBroadcastReceiver.smali | 4 ++-- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/smali/com/shannon/qualifiednetworksservice/SimManager$SimBroadcastReceiver.smali b/smali/com/shannon/qualifiednetworksservice/SimManager$SimBroadcastReceiver.smali +index 9920a63..1bbf9ab 100644 +--- a/smali/com/shannon/qualifiednetworksservice/SimManager$SimBroadcastReceiver.smali ++++ b/smali/com/shannon/qualifiednetworksservice/SimManager$SimBroadcastReceiver.smali +@@ -122,7 +122,7 @@ + + .line 49 + :cond_4 +- invoke-static {p1}, Landroid/telephony/SubscriptionManager;->getSimStateForSlotIndex(I)I ++ invoke-static {p1}, Landroid/telephony/TelephonyManager;->getSimStateForSlotIndex(I)I + + move-result p2 + +diff --git a/smali/com/shannon/qualifiednetworksservice/SimManager.smali b/smali/com/shannon/qualifiednetworksservice/SimManager.smali +index 8a0d1f0..05296b9 100644 +--- a/smali/com/shannon/qualifiednetworksservice/SimManager.smali ++++ b/smali/com/shannon/qualifiednetworksservice/SimManager.smali +@@ -186,7 +186,7 @@ + if-ge p1, v0, :cond_1 + + .line 128 +- invoke-static {p1}, Landroid/telephony/SubscriptionManager;->getSimStateForSlotIndex(I)I ++ invoke-static {p1}, Landroid/telephony/TelephonyManager;->getSimStateForSlotIndex(I)I + + move-result v0 + +diff --git a/smali/com/shannon/vendorcarrierconfig/ShannonVendorCarrierConfig$SimStateBroadcastReceiver.smali b/smali/com/shannon/vendorcarrierconfig/ShannonVendorCarrierConfig$SimStateBroadcastReceiver.smali +index 608b9db..b4657b7 100644 +--- a/smali/com/shannon/vendorcarrierconfig/ShannonVendorCarrierConfig$SimStateBroadcastReceiver.smali ++++ b/smali/com/shannon/vendorcarrierconfig/ShannonVendorCarrierConfig$SimStateBroadcastReceiver.smali +@@ -242,7 +242,7 @@ + + .line 266 + :cond_4 +- invoke-static {p1}, Landroid/telephony/SubscriptionManager;->getSimStateForSlotIndex(I)I ++ invoke-static {p1}, Landroid/telephony/TelephonyManager;->getSimStateForSlotIndex(I)I + + move-result v0 + +@@ -475,7 +475,7 @@ + if-ge v2, v3, :cond_5 + + .line 326 +- invoke-static {v2}, Landroid/telephony/SubscriptionManager;->getSimStateForSlotIndex(I)I ++ invoke-static {v2}, Landroid/telephony/TelephonyManager;->getSimStateForSlotIndex(I)I + + move-result v3 + +-- +2.43.0 + diff --git a/extract-files.sh b/extract-files.sh index 9d414b3..9fc5a64 100755 --- a/extract-files.sh +++ b/extract-files.sh @@ -69,11 +69,23 @@ fi function blob_fixup() { case "${1}" in + system/app/ShannonIms/ShannonIms.apk) + apktool_patch "${2}" "${MY_DIR}/blob-patches/ShannonIms" -r + ;; # libmedia symbols moved system/lib64/libmediaadaptor.so) [ "$2" = "" ] && return 0 "${PATCHELF}" --replace-needed "libmedia.so" "libmedia_ims.so" "${2}" ;; + system_ext/app/ShannonDataService/ShannonDataService.apk) + apktool_patch "${2}" "${MY_DIR}/blob-patches/ShannonDataService" -r + ;; + system_ext/app/ShannonNetworkService/ShannonNetworkService.apk) + apktool_patch "${2}" "${MY_DIR}/blob-patches/ShannonNetworkService" -r + ;; + system_ext/app/ShannonQualifiedNetworksService/ShannonQualifiedNetworksService.apk) + apktool_patch "${2}" "${MY_DIR}/blob-patches/ShannonQualifiedNetworksService" -r + ;; # libnetutils shim vendor/bin/wfc-pkt-router) [ "$2" = "" ] && return 0 diff --git a/proprietary-files.txt b/proprietary-files.txt index be5b9cd..0d9d018 100644 --- a/proprietary-files.txt +++ b/proprietary-files.txt @@ -134,13 +134,13 @@ vendor/lib/hw/keystore.exynos9610.so vendor/lib64/hw/keystore.exynos9610.so ## IMS -system/app/ShannonIms/ShannonIms.apk|e85ce47d7cdfc7dbf0b68eb8ee5ed1bc3de2841a +system/app/ShannonIms/ShannonIms.apk system/lib64/libmedia.so:system/lib64/libmedia_ims.so system/lib64/libmediaadaptor.so system/priv-app/OemRilService/OemRilService.apk -system_ext/app/ShannonDataService/ShannonDataService.apk|2d3856523a463738bff9cffd12f4c5a94de28e44 -system_ext/app/ShannonNetworkService/ShannonNetworkService.apk|507e83f2e419866cac9c5c750c92bf4bd126e249 -system_ext/app/ShannonQualifiedNetworksService/ShannonQualifiedNetworksService.apk|be7a4a6ce5534fcc7bcde7018bf7f060c2b0f2ed +system_ext/app/ShannonDataService/ShannonDataService.apk +system_ext/app/ShannonNetworkService/ShannonNetworkService.apk +system_ext/app/ShannonQualifiedNetworksService/ShannonQualifiedNetworksService.apk system_ext/etc/permissions/com.android.hotwordenrollment.common.util.xml system_ext/framework/com.android.hotwordenrollment.common.util.jar vendor/bin/charon