diff --git a/Patches/Common/android_packages_apps_Messaging/0001-null-fix.patch b/Patches/Common/android_packages_apps_Messaging/0001-null-fix.patch new file mode 100644 index 00000000..6c071b19 --- /dev/null +++ b/Patches/Common/android_packages_apps_Messaging/0001-null-fix.patch @@ -0,0 +1,31 @@ +From fc22d2d5b977de8a148677ad5a15b20f97f1bd49 Mon Sep 17 00:00:00 2001 +From: Pratyush +Date: Fri, 22 Sep 2023 12:22:01 +0530 +Subject: [PATCH] [bugfixes] handle null case + +android docs doesn't state if SubscriptionInfo.getDisplayName() can return null, according to crash log it is returning null. +--- + src/com/android/messaging/datamodel/ParticipantRefresh.java | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/com/android/messaging/datamodel/ParticipantRefresh.java b/src/com/android/messaging/datamodel/ParticipantRefresh.java +index 55d439bd..1726d69e 100644 +--- a/src/com/android/messaging/datamodel/ParticipantRefresh.java ++++ b/src/com/android/messaging/datamodel/ParticipantRefresh.java +@@ -46,6 +46,7 @@ + import java.util.HashSet; + import java.util.List; + import java.util.Locale; ++import java.util.Objects; + import java.util.Set; + import java.util.concurrent.atomic.AtomicBoolean; + +@@ -391,7 +392,7 @@ private static void refreshSelfParticipantList() { + for (final Integer subId : activeSubscriptionIdToRecordMap.keySet()) { + final SubscriptionInfo record = activeSubscriptionIdToRecordMap.get(subId); + final String displayName = +- DatabaseUtils.sqlEscapeString(record.getDisplayName().toString()); ++ DatabaseUtils.sqlEscapeString(Objects.toString(record.getDisplayName(), "")); + db.execSQL(getUpdateSelfParticipantSubscriptionInfoSql(record.getSimSlotIndex(), + record.getIconTint(), displayName, + ParticipantColumns.SUB_ID + " = " + subId)); diff --git a/Patches/LineageOS-20.0/ASB-2023-10/apksig-01.patch b/Patches/LineageOS-20.0/ASB-2023-10/apksig-01.patch new file mode 100644 index 00000000..b139e961 --- /dev/null +++ b/Patches/LineageOS-20.0/ASB-2023-10/apksig-01.patch @@ -0,0 +1,50 @@ +From 039f815895f62c9f8af23df66622b66246f3f61e Mon Sep 17 00:00:00 2001 +From: Michael Groover +Date: Tue, 20 Jun 2023 11:51:03 -0500 +Subject: [PATCH] Add errors from signature verify result to returned result + +During APK signature verification, the apksig library will maintain +an internal Result instance for the current signature version being +verified; any errors / warnings from the specific version signer(s) +verification will then be copied to a Result instance that is +returned to the caller containing details for each of the signature +versions that the library attempted to verify. The internal Result +instance can also contain more general errors / warnings abut the +verification; these are currently not merged with the Result to be +returned to the caller, so some APKs may fail to verify without a +valid error returned. This commit resolves this by merging all +general errors / warnings with the Result to be returned to the +caller. + +Bug: 266580022 +Test: gradlew test +(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:0b086bdc130e1e6216fcbc5436fe8e3cdc9ec011) +Merged-In: Id0f4ee47a964a3bb5d30916808a3108858e6a0cf +Change-Id: Id0f4ee47a964a3bb5d30916808a3108858e6a0cf +--- + src/main/java/com/android/apksig/ApkVerifier.java | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/src/main/java/com/android/apksig/ApkVerifier.java b/src/main/java/com/android/apksig/ApkVerifier.java +index 8ae5f78..0b04ef9 100644 +--- a/src/main/java/com/android/apksig/ApkVerifier.java ++++ b/src/main/java/com/android/apksig/ApkVerifier.java +@@ -1276,6 +1276,15 @@ public class ApkVerifier { + } + + private void mergeFrom(ApkSigningBlockUtils.Result source) { ++ if (source == null) { ++ return; ++ } ++ if (source.containsErrors()) { ++ mErrors.addAll(source.getErrors()); ++ } ++ if (source.containsWarnings()) { ++ mWarnings.addAll(source.getWarnings()); ++ } + switch (source.signatureSchemeVersion) { + case ApkSigningBlockUtils.VERSION_APK_SIGNATURE_SCHEME_V2: + mVerifiedUsingV2Scheme = source.verified; +-- +GitLab + diff --git a/Scripts/LineageOS-14.1/Patch.sh b/Scripts/LineageOS-14.1/Patch.sh index 99785611..a7ecccd7 100644 --- a/Scripts/LineageOS-14.1/Patch.sh +++ b/Scripts/LineageOS-14.1/Patch.sh @@ -375,6 +375,10 @@ applyPatch "$DOS_PATCHES/android_packages_apps_KeyChain/319990.patch"; #n-asb-20 applyPatch "$DOS_PATCHES/android_packages_apps_KeyChain/334036.patch"; #n-asb-2022-07 Encode authority part of uri before showing in UI fi; +if enterAndClear "packages/apps/Messaging"; then +applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Messaging/0001-null-fix.patch"; #Handle null case (GrapheneOS) +fi; + if enterAndClear "packages/apps/Nfc"; then applyPatch "$DOS_PATCHES/android_packages_apps_Nfc/315715.patch"; #n-asb-2021-09 Add HIDE_NON_SYSTEM_OVERLAY_WINDOWS permission to Nfc applyPatch "$DOS_PATCHES/android_packages_apps_Nfc/328308.patch"; #n-asb-2022-04 Do not set default contactless application without user interaction diff --git a/Scripts/LineageOS-15.1/Patch.sh b/Scripts/LineageOS-15.1/Patch.sh index 7babfb7e..da766880 100644 --- a/Scripts/LineageOS-15.1/Patch.sh +++ b/Scripts/LineageOS-15.1/Patch.sh @@ -330,6 +330,10 @@ applyPatch "$DOS_PATCHES/android_packages_apps_LineageParts/0001-Remove_Analytic cp -f "$DOS_PATCHES_COMMON/contributors.db" assets/contributors.db; #Update contributors cloud fi; +if enterAndClear "packages/apps/Messaging"; then +applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Messaging/0001-null-fix.patch"; #Handle null case (GrapheneOS) +fi; + if enterAndClear "packages/apps/PackageInstaller"; then applyPatch "$DOS_PATCHES/android_packages_apps_PackageInstaller/344181.patch"; #P_asb_2022-11 Hide overlays on ReviewPermissionsAtivity fi; diff --git a/Scripts/LineageOS-16.0/Patch.sh b/Scripts/LineageOS-16.0/Patch.sh index 27affc2b..ee3438fd 100644 --- a/Scripts/LineageOS-16.0/Patch.sh +++ b/Scripts/LineageOS-16.0/Patch.sh @@ -322,6 +322,10 @@ applyPatch "$DOS_PATCHES/android_packages_apps_LineageParts/0001-Remove_Analytic cp -f "$DOS_PATCHES_COMMON/contributors.db" assets/contributors.db; #Update contributors cloud fi; +if enterAndClear "packages/apps/Messaging"; then +applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Messaging/0001-null-fix.patch"; #Handle null case (GrapheneOS) +fi; + if enterAndClear "packages/apps/Nfc"; then #applyPatch "$DOS_PATCHES/android_packages_apps_Nfc/365970.patch"; #R_asb_2023-09 Ensure that SecureNFC setting cannot be bypassed if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_packages_apps_Nfc/0001-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS) diff --git a/Scripts/LineageOS-17.1/Patch.sh b/Scripts/LineageOS-17.1/Patch.sh index 2dd3c37d..b49f9d31 100644 --- a/Scripts/LineageOS-17.1/Patch.sh +++ b/Scripts/LineageOS-17.1/Patch.sh @@ -344,6 +344,10 @@ applyPatch "$DOS_PATCHES/android_packages_apps_LineageParts/0001-Remove_Analytic cp -f "$DOS_PATCHES_COMMON/contributors.db" assets/contributors.db; #Update contributors cloud fi; +if enterAndClear "packages/apps/Messaging"; then +applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Messaging/0001-null-fix.patch"; #Handle null case (GrapheneOS) +fi; + if enterAndClear "packages/apps/Nfc"; then applyPatch "$DOS_PATCHES/android_packages_apps_Nfc/365970.patch"; #R_asb_2023-09 Ensure that SecureNFC setting cannot be bypassed if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_packages_apps_Nfc/0001-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS) diff --git a/Scripts/LineageOS-18.1/Patch.sh b/Scripts/LineageOS-18.1/Patch.sh index da768ba8..16f8a3cf 100644 --- a/Scripts/LineageOS-18.1/Patch.sh +++ b/Scripts/LineageOS-18.1/Patch.sh @@ -302,6 +302,10 @@ applyPatch "$DOS_PATCHES/android_packages_apps_LineageParts/0001-Remove_Analytic cp -f "$DOS_PATCHES_COMMON/contributors.db" assets/contributors.db; #Update contributors cloud fi; +if enterAndClear "packages/apps/Messaging"; then +applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Messaging/0001-null-fix.patch"; #Handle null case (GrapheneOS) +fi; + 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; diff --git a/Scripts/LineageOS-19.1/Patch.sh b/Scripts/LineageOS-19.1/Patch.sh index 27764814..5884ce52 100644 --- a/Scripts/LineageOS-19.1/Patch.sh +++ b/Scripts/LineageOS-19.1/Patch.sh @@ -293,6 +293,10 @@ applyPatch "$DOS_PATCHES/android_packages_apps_LineageParts/0001-Remove_Analytic cp -f "$DOS_PATCHES_COMMON/contributors.db" assets/contributors.db; #Update contributors cloud fi; +if enterAndClear "packages/apps/Messaging"; then +applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Messaging/0001-null-fix.patch"; #Handle null case (GrapheneOS) +fi; + 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; diff --git a/Scripts/LineageOS-20.0/Patch.sh b/Scripts/LineageOS-20.0/Patch.sh index c56fb24f..babbb9b6 100644 --- a/Scripts/LineageOS-20.0/Patch.sh +++ b/Scripts/LineageOS-20.0/Patch.sh @@ -307,6 +307,10 @@ applyPatch "$DOS_PATCHES/android_packages_apps_LineageParts/0001-Remove_Analytic cp -f "$DOS_PATCHES_COMMON/contributors.db" assets/contributors.db; #Update contributors cloud fi; +if enterAndClear "packages/apps/Messaging"; then +applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Messaging/0001-null-fix.patch"; #Handle null case (GrapheneOS) +fi; + 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; @@ -443,6 +447,11 @@ if enterAndClear "system/update_engine"; then git revert --no-edit ac104e8990f3be3a3f111241e9328e7f98bfb912; #Do not skip payload signature verification fi; +if enterAndClear "tools/apksig"; then +git am $DOS_PATCHES/ASB-2023-10/apksig-*.patch; +fi; + + if enterAndClear "vendor/lineage"; then rm build/target/product/security/lineage.x509.pem; #Remove Lineage keys rm -rf overlay/common/lineage-sdk/packages/LineageSettingsProvider/res/values/defaults.xml; #Remove analytics