From 1245d6fad38feae13bb69d317e4c3e530055586d Mon Sep 17 00:00:00 2001 From: Tavi Date: Sat, 7 Sep 2024 22:07:04 -0400 Subject: [PATCH] Churn + Fixes Fixes https://github.com/Divested-Mobile/DivestOS-Build/issues/338 Signed-off-by: Tavi --- .../316891059-20.patch | 150 ------------------ Scripts/Common/Fix_CVE_Patchers.sh | 4 +- Scripts/LineageOS-19.1/Patch.sh | 1 + .../android_kernel_samsung_exynos9810.sh | 4 +- .../android_kernel_xiaomi_vayu.sh | 12 +- Scripts/LineageOS-20.0/Functions.sh | 4 +- Scripts/LineageOS-20.0/Patch.sh | 1 - 7 files changed, 13 insertions(+), 163 deletions(-) delete mode 100644 Patches/LineageOS-20.0/android_packages_apps_Settings/316891059-20.patch diff --git a/Patches/LineageOS-20.0/android_packages_apps_Settings/316891059-20.patch b/Patches/LineageOS-20.0/android_packages_apps_Settings/316891059-20.patch deleted file mode 100644 index e575df69..00000000 --- a/Patches/LineageOS-20.0/android_packages_apps_Settings/316891059-20.patch +++ /dev/null @@ -1,150 +0,0 @@ -diff --git a/src/com/android/settings/search/SearchFeatureProvider.java b/src/com/android/settings/search/SearchFeatureProvider.java -index b14a4d7fbf..2fbaafd191 100644 ---- a/src/com/android/settings/search/SearchFeatureProvider.java -+++ b/src/com/android/settings/search/SearchFeatureProvider.java -@@ -56,7 +56,7 @@ public interface SearchFeatureProvider { - * @throws IllegalArgumentException when caller is null - * @throws SecurityException when caller is not allowed to launch search result page - */ -- void verifyLaunchSearchResultPageCaller(Context context, @NonNull ComponentName caller) -+ void verifyLaunchSearchResultPageCaller(@NonNull Context context, @NonNull String callerPackage) - throws SecurityException, IllegalArgumentException; - - /** -diff --git a/src/com/android/settings/search/SearchFeatureProviderImpl.java b/src/com/android/settings/search/SearchFeatureProviderImpl.java -index 6f90970905..3a62ddfb67 100644 ---- a/src/com/android/settings/search/SearchFeatureProviderImpl.java -+++ b/src/com/android/settings/search/SearchFeatureProviderImpl.java -@@ -17,13 +17,14 @@ - - package com.android.settings.search; - --import android.content.ComponentName; - import android.content.Context; - import android.content.Intent; - import android.net.Uri; - import android.provider.Settings; - import android.text.TextUtils; - -+import androidx.annotation.NonNull; -+ - import com.android.settingslib.search.SearchIndexableResources; - import com.android.settingslib.search.SearchIndexableResourcesMobile; - -@@ -32,21 +33,18 @@ import com.android.settingslib.search.SearchIndexableResourcesMobile; - */ - public class SearchFeatureProviderImpl implements SearchFeatureProvider { - -- private static final String TAG = "SearchFeatureProvider"; -- - private SearchIndexableResources mSearchIndexableResources; - - @Override -- public void verifyLaunchSearchResultPageCaller(Context context, ComponentName caller) { -- if (caller == null) { -+ public void verifyLaunchSearchResultPageCaller(@NonNull Context context, -+ @NonNull String callerPackage) { -+ if (TextUtils.isEmpty(callerPackage)) { - throw new IllegalArgumentException("ExternalSettingsTrampoline intents " - + "must be called with startActivityForResult"); - } -- final String packageName = caller.getPackageName(); -- final boolean isSettingsPackage = TextUtils.equals(packageName, context.getPackageName()) -- || TextUtils.equals(getSettingsIntelligencePkgName(context), packageName); -- final boolean isAllowlistedPackage = -- isSignatureAllowlisted(context, caller.getPackageName()); -+ final boolean isSettingsPackage = TextUtils.equals(callerPackage, context.getPackageName()) -+ || TextUtils.equals(getSettingsIntelligencePkgName(context), callerPackage); -+ final boolean isAllowlistedPackage = isSignatureAllowlisted(context, callerPackage); - if (isSettingsPackage || isAllowlistedPackage) { - return; - } -diff --git a/src/com/android/settings/search/SearchResultTrampoline.java b/src/com/android/settings/search/SearchResultTrampoline.java -index 5e710293c2..2c6fd67a2f 100644 ---- a/src/com/android/settings/search/SearchResultTrampoline.java -+++ b/src/com/android/settings/search/SearchResultTrampoline.java -@@ -20,7 +20,6 @@ import static com.android.settings.SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENT - import static com.android.settings.SettingsActivity.EXTRA_SHOW_FRAGMENT_TAB; - - import android.app.Activity; --import android.content.ComponentName; - import android.content.Intent; - import android.os.Bundle; - import android.provider.Settings; -@@ -51,11 +50,11 @@ public class SearchResultTrampoline extends Activity { - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - -- final ComponentName callingActivity = getCallingActivity(); -+ final String callerPackage = getLaunchedFromPackage(); - // First make sure caller has privilege to launch a search result page. - FeatureFactory.getFactory(this) - .getSearchFeatureProvider() -- .verifyLaunchSearchResultPageCaller(this, callingActivity); -+ .verifyLaunchSearchResultPageCaller(this, callerPackage); - // Didn't crash, proceed and launch the result as a subsetting. - Intent intent = getIntent(); - final String highlightMenuKey = intent.getStringExtra( -@@ -99,7 +98,7 @@ public class SearchResultTrampoline extends Activity { - - if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(this)) { - startActivity(intent); -- } else if (isSettingsIntelligence(callingActivity)) { -+ } else if (isSettingsIntelligence(callerPackage)) { - if (FeatureFlagUtils.isEnabled(this, FeatureFlags.SETTINGS_SEARCH_ALWAYS_EXPAND)) { - startActivity(SettingsActivity.getTrampolineIntent(intent, highlightMenuKey) - .setClass(this, DeepLinkHomepageActivityInternal.class) -@@ -132,9 +131,9 @@ public class SearchResultTrampoline extends Activity { - finish(); - } - -- private boolean isSettingsIntelligence(ComponentName callingActivity) { -- return callingActivity != null && TextUtils.equals( -- callingActivity.getPackageName(), -+ private boolean isSettingsIntelligence(String callerPackage) { -+ return TextUtils.equals( -+ callerPackage, - FeatureFactory.getFactory(this).getSearchFeatureProvider() - .getSettingsIntelligencePkgName(this)); - } -diff --git a/tests/robotests/src/com/android/settings/search/SearchFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/search/SearchFeatureProviderImplTest.java -index f3496001d0..8a7419bb1b 100644 ---- a/tests/robotests/src/com/android/settings/search/SearchFeatureProviderImplTest.java -+++ b/tests/robotests/src/com/android/settings/search/SearchFeatureProviderImplTest.java -@@ -20,7 +20,6 @@ package com.android.settings.search; - import static com.google.common.truth.Truth.assertThat; - - import android.app.settings.SettingsEnums; --import android.content.ComponentName; - import android.content.Intent; - import android.content.pm.ActivityInfo; - import android.content.pm.ResolveInfo; -@@ -131,20 +130,22 @@ public class SearchFeatureProviderImplTest { - - @Test(expected = SecurityException.class) - public void verifyLaunchSearchResultPageCaller_badCaller_shouldCrash() { -- final ComponentName cn = new ComponentName("pkg", "class"); -- mProvider.verifyLaunchSearchResultPageCaller(mActivity, cn); -+ final String packageName = "pkg"; -+ -+ mProvider.verifyLaunchSearchResultPageCaller(mActivity, packageName); - } - - @Test - public void verifyLaunchSearchResultPageCaller_settingsCaller_shouldNotCrash() { -- final ComponentName cn = new ComponentName(mActivity.getPackageName(), "class"); -- mProvider.verifyLaunchSearchResultPageCaller(mActivity, cn); -+ final String packageName = mActivity.getPackageName(); -+ -+ mProvider.verifyLaunchSearchResultPageCaller(mActivity, packageName); - } - - @Test - public void verifyLaunchSearchResultPageCaller_settingsIntelligenceCaller_shouldNotCrash() { - final String packageName = mProvider.getSettingsIntelligencePkgName(mActivity); -- final ComponentName cn = new ComponentName(packageName, "class"); -- mProvider.verifyLaunchSearchResultPageCaller(mActivity, cn); -+ -+ mProvider.verifyLaunchSearchResultPageCaller(mActivity, packageName); - } - } diff --git a/Scripts/Common/Fix_CVE_Patchers.sh b/Scripts/Common/Fix_CVE_Patchers.sh index 2bb963c2..7f29888d 100644 --- a/Scripts/Common/Fix_CVE_Patchers.sh +++ b/Scripts/Common/Fix_CVE_Patchers.sh @@ -96,7 +96,7 @@ commentPatches android_kernel_samsung_msm8930-common.sh "CVE-2017-11015/prima" " commentPatches android_kernel_samsung_smdk4412.sh "CVE-2012-2127" "CVE-2016-8463/ANY/0001.patch"; commentPatches android_kernel_samsung_tuna.sh "CVE-2012-2127"; commentPatches android_kernel_samsung_universal8890.sh "0008-Graphene-Kernel_Hardening-ro" "CVE-2016-7917" "CVE-2018-1092" "CVE-2018-17972" "CVE-2019-16746" "CVE-2020-0427" "CVE-2020-14381" "CVE-2020-16166" "CVE-2022-42896/4.9"; -commentPatches android_kernel_samsung_exynos9810.sh "CVE-2020-1749" "CVE-2019-ctnl-addr-leak" "CVE-2019-18282" "CVE-2019-11599" "CVE-2022-20566" "CVE-2019-16746" "CVE-2021-45469" "CVE-2020-0305" "CVE-2021-3506/4.19" "CVE-2024-26934/4.19"; +commentPatches android_kernel_samsung_exynos9810.sh "CVE-2020-1749" "CVE-2019-ctnl-addr-leak" "CVE-2019-18282" "CVE-2019-11599" "CVE-2022-20566" "CVE-2019-16746" "CVE-2021-45469" "CVE-2020-0305" "CVE-2021-3506/4.19" "CVE-2024-26934/4.19" "CVE-2024-26934" "CVE-2024-44944"; commentPatches android_kernel_samsung_universal9810.sh "CVE-2020-1749"; commentPatches android_kernel_sony_sdm660.sh "0008-Graphene-Kernel_Hardening-canaries/4.4/0002.patch" "CVE-2019-19319" "CVE-2020-0305" "CVE-2020-8992" "CVE-2020-16166"; commentPatches android_kernel_sony_sdm845.sh "CVE-2019-19319" "CVE-2020-1749" "CVE-2020-8992"; @@ -157,7 +157,7 @@ do done #4.14 -declare -a fourDotFourteen=("${fourDotNine[@]}" "android_kernel_google_msm-4.14.sh" "android_kernel_xiaomi_sm6150.sh" "android_kernel_oneplus_sm8150.sh" "android_kernel_xiaomi_sm8150.sh"); +declare -a fourDotFourteen=("${fourDotNine[@]}" "android_kernel_google_msm-4.14.sh" "android_kernel_xiaomi_sm6150.sh" "android_kernel_oneplus_sm8150.sh" "android_kernel_xiaomi_sm8150.sh" "android_kernel_xiaomi_vayu.sh"); for script in "${fourDotFourteen[@]}" do commentPatches $script "CVE-2019-19252/4.19" "CVE-2021-46921/4.19" "CVE-2023-51043/4.19" "CVE-2024-38618" "CVE-2023-52486/^6.7" "CVE-2024-35910"; diff --git a/Scripts/LineageOS-19.1/Patch.sh b/Scripts/LineageOS-19.1/Patch.sh index d4d9c74f..89025f12 100644 --- a/Scripts/LineageOS-19.1/Patch.sh +++ b/Scripts/LineageOS-19.1/Patch.sh @@ -128,6 +128,7 @@ sed -i -e '22,24d;' androidtest/Android.bp; #fix compile under A12 fi; if enterAndClear "external/SecureCamera"; then +git revert --no-edit 36f2dd34e1d0c2b7d26153969cca56a7ff665329; sed -i '/LOCAL_MODULE/s/Camera/SecureCamera/' Android.mk; #Change module name sed -i '11iLOCAL_OVERRIDES_PACKAGES := Camera Camera2 LegacyCamera Snap OpenCamera' Android.mk; #Replace the others fi; diff --git a/Scripts/LineageOS-20.0/CVE_Patchers/android_kernel_samsung_exynos9810.sh b/Scripts/LineageOS-20.0/CVE_Patchers/android_kernel_samsung_exynos9810.sh index d59e3e29..4da1bddd 100644 --- a/Scripts/LineageOS-20.0/CVE_Patchers/android_kernel_samsung_exynos9810.sh +++ b/Scripts/LineageOS-20.0/CVE_Patchers/android_kernel_samsung_exynos9810.sh @@ -912,7 +912,7 @@ git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-26880/4.14/0009.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-26889/4.14/0009.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-26894/4.14/0009.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-26901/4.14/0009.patch -git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-26934/4.14/0009.patch +#git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-26934/4.14/0009.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-26956/4.14/0009.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-26961/^6.7/0001.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-26965/4.14/0009.patch @@ -1064,7 +1064,7 @@ git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-43884/4.19/0004.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-43890/4.19/0002.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-43914/4.19/0002.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-44939/^6.9/0001.patch -git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-44944/4.19/0002.patch +#git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-44944/4.19/0002.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-44946/4.19/0004.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-44947/4.19/0004.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-44987/4.19/0002.patch diff --git a/Scripts/LineageOS-20.0/CVE_Patchers/android_kernel_xiaomi_vayu.sh b/Scripts/LineageOS-20.0/CVE_Patchers/android_kernel_xiaomi_vayu.sh index 9bbbccd4..c232022f 100644 --- a/Scripts/LineageOS-20.0/CVE_Patchers/android_kernel_xiaomi_vayu.sh +++ b/Scripts/LineageOS-20.0/CVE_Patchers/android_kernel_xiaomi_vayu.sh @@ -55,7 +55,7 @@ git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-16921/^4.16/0001.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-18786/4.14/0002.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-19051/4.14/0008.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-19068/4.14/0002.patch -git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-19252/4.19/0002.patch +#git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-19252/4.19/0002.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-19602/^5.4/0001.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-20908/^5.2/0001.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-11146/ANY/0001.patch @@ -72,7 +72,7 @@ git apply $DOS_PATCHES_LINUX_CVES/CVE-2021-33655/4.19/0005.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2021-33655/4.19/0006.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2021-35085/qca-wifi-host-cmn/0001.patch --directory=drivers/staging/qca-wifi-host-cmn git apply $DOS_PATCHES_LINUX_CVES/CVE-2021-46912/^5.12/0001.patch -git apply $DOS_PATCHES_LINUX_CVES/CVE-2021-46921/4.19/0002.patch +#git apply $DOS_PATCHES_LINUX_CVES/CVE-2021-46921/4.19/0002.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2021-46958/^5.12/0001.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2021-46982/^5.13/0001.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2021-46998/4.19/0002.patch @@ -126,7 +126,7 @@ git apply $DOS_PATCHES_LINUX_CVES/CVE-2023-45863/4.14/0002.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2023-46343/4.14/0003.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2023-46838/4.14/0009.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2023-47233/4.14/0009.patch -git apply $DOS_PATCHES_LINUX_CVES/CVE-2023-51043/4.19/0002.patch +#git apply $DOS_PATCHES_LINUX_CVES/CVE-2023-51043/4.19/0002.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2023-52429/4.14/0008.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2023-52435/4.19/0007.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2023-52436/4.14/0009.patch @@ -143,7 +143,7 @@ git apply $DOS_PATCHES_LINUX_CVES/CVE-2023-52475/4.14/0003.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2023-52477/4.14/0002.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2023-52478/4.14/0003.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2023-52486/4.14/0008.patch -git apply $DOS_PATCHES_LINUX_CVES/CVE-2023-52486/^6.7/0001.patch +#git apply $DOS_PATCHES_LINUX_CVES/CVE-2023-52486/^6.7/0001.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2023-52504/4.19/0002.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2023-52507/4.14/0003.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2023-52510/4.14/0002.patch @@ -327,7 +327,7 @@ git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-35877/4.14/0009.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-35879/^6.9/0001.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-35886/4.14/0009.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-35893/4.14/0008.patch -git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-35910/4.14/0008.patch +#git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-35910/4.14/0008.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-35915/4.14/0009.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-35922/4.14/0009.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-35925/4.14/0008.patch @@ -386,7 +386,7 @@ git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-38599/4.14/0009.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-38601/4.14/0009.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-38612/4.14/0008.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-38613/4.14/0009.patch -git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-38618/4.14/0008.patch +#git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-38618/4.14/0008.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-38619/4.14/0009.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-38621/4.14/0009.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2024-38627/4.14/0009.patch diff --git a/Scripts/LineageOS-20.0/Functions.sh b/Scripts/LineageOS-20.0/Functions.sh index b88490af..2df21f7a 100644 --- a/Scripts/LineageOS-20.0/Functions.sh +++ b/Scripts/LineageOS-20.0/Functions.sh @@ -53,6 +53,8 @@ buildAll() { #frontloaded for testing buildDevice bluejay avb; buildDevice taimen avb; + buildDevice fajita avb; + buildDevice flame avb; #SD820 buildDevice h830; buildDevice h850; @@ -85,7 +87,6 @@ buildAll() { buildDevice kirin; buildDevice mermaid; #SD845 - buildDevice fajita avb; buildDevice enchilada avb; buildDevice aura avb; buildDevice beryllium avb; @@ -107,7 +108,6 @@ buildAll() { buildDevice hotdog avb; buildDevice hotdogb avb; buildDevice coral avb; - buildDevice flame avb; #buildDevice vayu avb; #XXX: no Wi-Fi #SD730 buildDevice sunfish avb; diff --git a/Scripts/LineageOS-20.0/Patch.sh b/Scripts/LineageOS-20.0/Patch.sh index 3de5d0e2..a3141ee8 100644 --- a/Scripts/LineageOS-20.0/Patch.sh +++ b/Scripts/LineageOS-20.0/Patch.sh @@ -313,7 +313,6 @@ applyPatch "$DOS_PATCHES/android_packages_apps_Nfc/0001-constify_JNINativeMethod fi; if enterAndClear "packages/apps/Settings"; then -applyPatch "$DOS_PATCHES/android_packages_apps_Settings/316891059-20.patch"; #x-asb_2024-05 Replace getCallingActivity() with getLaunchedFromPackage() 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) applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0005-Automatic_Reboot.patch"; #Timeout for reboot (GrapheneOS)