From e96e53ff681fb68a149ba993db44c92a721fd47a Mon Sep 17 00:00:00 2001 From: Tavi Date: Tue, 25 Jun 2024 08:40:49 -0400 Subject: [PATCH] Backport CarrierConfig2 to 18.1 and 19.1 Signed-off-by: Tavi --- Logs/resetWorkspace-LineageOS-18.1.txt | 5 +- Logs/resetWorkspace-LineageOS-19.1.txt | 13 +- Logs/resetWorkspace-LineageOS-20.0.txt | 2 +- Manifests/Manifest_LAOS-18.1.xml | 1 + Manifests/Manifest_LAOS-19.1.xml | 1 + .../0001-Legacy-compat.patch | 211 ++++++++++++++++++ .../0016-CC2_Toggle.patch | 173 ++++++++++++++ .../0001-CC2.patch | 40 ++++ .../0001-Legacy-compat.patch | 185 +++++++++++++++ .../0017-CC2_Toggle.patch | 173 ++++++++++++++ .../0001-CC2.patch | 40 ++++ .../0017-OpenEUICC_Toggle.patch | 2 +- .../0018-CC2_Toggle.patch | 4 +- Scripts/LineageOS-18.1/Patch.sh | 20 ++ Scripts/LineageOS-19.1/Patch.sh | 20 ++ Scripts/LineageOS-20.0/Patch.sh | 3 +- 16 files changed, 879 insertions(+), 14 deletions(-) create mode 100644 Patches/LineageOS-18.1/android_packages_apps_CarrierConfig2/0001-Legacy-compat.patch create mode 100644 Patches/LineageOS-18.1/android_packages_apps_Settings/0016-CC2_Toggle.patch create mode 100644 Patches/LineageOS-18.1/android_packages_services_Telephony/0001-CC2.patch create mode 100644 Patches/LineageOS-19.1/android_packages_apps_CarrierConfig2/0001-Legacy-compat.patch create mode 100644 Patches/LineageOS-19.1/android_packages_apps_Settings/0017-CC2_Toggle.patch create mode 100644 Patches/LineageOS-19.1/android_packages_services_Telephony/0001-CC2.patch diff --git a/Logs/resetWorkspace-LineageOS-18.1.txt b/Logs/resetWorkspace-LineageOS-18.1.txt index 1459a7cc..ee108090 100644 --- a/Logs/resetWorkspace-LineageOS-18.1.txt +++ b/Logs/resetWorkspace-LineageOS-18.1.txt @@ -52,7 +52,7 @@ device/lineage/atv 101a8ddd11f53ff37fa8f106fc12d08b3d19ddc0 device/lineage/car ac49fa77109148dfe3d6e433e179b09d83aa1e69 device/lineage/sepolicy 02f04d2b0a57f1c7435dc9f2ce8fac2640b38782 device/moto/shamu 80fa688a3b208992b698a2d59a9a1fec85b1400f -device/motorola/griffin 6cccefc9100816f51d962e767559ffa8e050a7e3 +device/motorola/griffin 5ad859a57dc0bcd3054a308353e380cfab7e725f device/motorola/victara 83ac9229460343760ca08e77fd55bbd2a0b54b9b device/nextbit/ether 5bf4b4df6305d1b04740c1e73b3f41557ad859bb device/oneplus/bacon 7a4af4ba210049a291a0e4bd0ad5f5637384a2b3 @@ -135,7 +135,7 @@ external/cblas d82c5f4ae14b2a5468303985070f7dadc15d4094 external/cbor-java f81e576298790c97498311e99a0b0b34653c3dd8 external/chromium-libpac 169c93e00a00605346a68d39d3f4713735bdb61e external/chromium-trace e524766cad26d677a9a1ec8c00c512d4cac2cf5e -external/chromium-webview ef62acbe255f65218a2122885a27624a0178ba14 +external/chromium-webview 55628131e0608ae5877fd6934719369e5002b679 external/clang 0a1c53a5d295109bd4702ad13c0f2a5510ca1b26 external/cldr 38850463abd624d5b2293be75fddc43cf6b55ae2 external/cn-cbor 696530332036f5518681d3c450cdbc3ee412004a @@ -642,6 +642,7 @@ packages/apps/Car/SystemUpdater d7af3a403665186388ae86628fa0a956201e69c1 packages/apps/Car/libs bda7ad4939fbafbf309f2b045f3631ed396d4dbf packages/apps/Car/tests ae3c42557453a2cd94ae4b76f8cb95d8f501dda9 packages/apps/CarrierConfig 58658ef55f4eb1c4873da1c377dda28c88be8435 +packages/apps/CarrierConfig2 e710a67ed64620fc11f62520cceef4bba64dc2a6 packages/apps/CellBroadcastReceiver 635d157f8452ac501438e41af3ff11a706a9f0ba packages/apps/CertInstaller ffe481d82dc74913c8e71117e9db700bd4ec7e1b packages/apps/Contacts 5bd98569ce02bc5c350756a8a61af3f68d288881 diff --git a/Logs/resetWorkspace-LineageOS-19.1.txt b/Logs/resetWorkspace-LineageOS-19.1.txt index 82a78d1e..67a64487 100644 --- a/Logs/resetWorkspace-LineageOS-19.1.txt +++ b/Logs/resetWorkspace-LineageOS-19.1.txt @@ -1,11 +1,11 @@ -android 189bd25828578a06fc80e5834848afb3c0062c80 +android d1466a5db009b2c9cc513f885b7d2bbfbe2a86e7 art f192ca3ca279cadc41aecd225c6b4d555bce6360 bionic 6e6ed4d6cd4081f0c755d2548a4752d9fcc157a2 bootable/libbootloader b44eeefd365e023a96ea36682cc60b46827a47cc bootable/recovery 7c1eb300fbcf789024da690c96adb167d31aa5a5 build/bazel f3015c3bbd520d95216123e6761a2860e17acebf build/blueprint c24408d5ae37cbcbec15205a02812b7d6c563b90 -build/make 722c54d2ddc48d914e10769348ae4381b4f47427 +build/make 1898ccd7b908d245803d94ead1356f6885422085 build/pesto 0f35caa8191635ace102f6d8c96318c5ed52dfe3 build/soong 59d5b37cce358e0d300392676d64191d3938608f compatibility/cdd 43611a0b6d2c62ae1d08d951fccf8f2ab8dc60c6 @@ -94,7 +94,7 @@ external/catch2 2b2e0e9540defee10f28ea0fc97750490fa238b5 external/cblas 2b24922070cb6d45edd5f5b533db0637099a2b17 external/cbor-java 00c4a382dd3810f9c1b363eaad339cff34a3f6fe external/chromium-trace 138ade68f9d3388a1b0a6d9ce5e091ff6f7e7448 -external/chromium-webview ef62acbe255f65218a2122885a27624a0178ba14 +external/chromium-webview 55628131e0608ae5877fd6934719369e5002b679 external/clang f1cef8e77ae220c9379303bdc9896e0c2366bd6f external/cldr 242ecd0dcb21f3376f825119ec0b36fcb15e7bb8 external/cn-cbor 6a0f6a5375b8cd9b495e91c11d21ed257ec9a905 @@ -621,7 +621,7 @@ external/zopfli 8637d0c2c9bad61506e1633cb221a418421c9f02 external/zstd 72b884f7fb33ebdebc0f61b5d0fb00fd6ca4713f external/zxing c52e3ef5b428edbd4d4b2d51f67e673fe04ce09e frameworks/av 923916e8261b7211d1c8639ff401ecb2b46ea292 -frameworks/base 408a024e388169dd4c5c759197f950d44c219420 +frameworks/base 8aa3a65b5c3e924391f7556ed72be06da5481b89 frameworks/compile/libbcc 879916155c7757ba3a77c880ab1e949e8c6ed74b frameworks/compile/mclinker 3f42d04145e3c2f6bd6f236bc4eb4630d84fb3b7 frameworks/compile/slang 5ad64063eeff6dd6c6affce457ed169e0e7b2a03 @@ -827,6 +827,7 @@ packages/apps/Car/libs 0fb4e0fe9f5a1dca37eb3be2ab279601af2336de packages/apps/Car/systemlibs 82b5844b33cf4863c9f061d408dd201ffb086ae3 packages/apps/Car/tests 70ef61a08c5df9cb9d7877f8e8fdd2b0e8d18710 packages/apps/CarrierConfig 9243eff9cafbe6c03d9749db006a55a534acb58a +packages/apps/CarrierConfig2 e710a67ed64620fc11f62520cceef4bba64dc2a6 packages/apps/CellBroadcastReceiver bc578faca0bbc3bd1a5e783a42257255d646c3cc packages/apps/CertInstaller 2ddda133cf8cfd6393c4ec175a2709f29ba4bcc5 packages/apps/Contacts 2d6e0b126a6e40f467a036ee62bb6edf76e7be82 @@ -899,7 +900,7 @@ packages/modules/Permission d18fe94fdd8d38f2b801c43f92a4f2566d69b4ef packages/modules/RuntimeI18n 2ce6cc4e8d868fd9b87b5a180086359b5cb2266e packages/modules/Scheduling c525da7006edd882bd18065af7b2ce5b72222edd packages/modules/SdkExtensions 157c361197f1902b4432533e9f9f63c497f28cee -packages/modules/StatsD f2b43a1f96a9e5ea7d077452e286c1dc084b607c +packages/modules/StatsD 965353fa0c3a240d9190026245d13f6432ad1aca packages/modules/TestModule 3523a2f0f9b12d4e60374af63aae14f75a2b4c10 packages/modules/Virtualization 45efe0613b1847da5b140dc456fae05bc54d884e packages/modules/Wifi 9a90c04570a91cbe7ca8cf4e9f203e509ac98be5 @@ -1010,7 +1011,7 @@ system/iorap 335322f998c35d18645439e41bafd11414fa8e7f system/keymaster 32611b307bcc7ce1898eb3a37fba8c85bec31809 system/libartpalette 829e1c6b9ec82e99a3831f6765a41169c8f72f0b system/libbase d78d20d2d1afb349f17feec1e7ea7be623c46dfd -system/libfmq 810ac7a95c3aa0602a341122b27a109ce01d1152 +system/libfmq b7a5d150fd0a1d9fdb0ea97f444ccb2f9e0b6ea2 system/libhidl c147bfaed9b2f42afb1b5ab928c0b6719b3fe24a system/libhwbinder acfb7ba075d32c7ea8bf6c64a9d57870ef856ab6 system/libprocinfo b237810fa63b9c79b99cb37c0af5d48e635a6a04 diff --git a/Logs/resetWorkspace-LineageOS-20.0.txt b/Logs/resetWorkspace-LineageOS-20.0.txt index b403bf0b..2132082f 100644 --- a/Logs/resetWorkspace-LineageOS-20.0.txt +++ b/Logs/resetWorkspace-LineageOS-20.0.txt @@ -201,7 +201,7 @@ external/catch2 5f8628024c5a9219caa004d6a9547aacd9ba94c1 external/cblas 4fdeda64177f60e1b226349885b3c0ea016f3068 external/cbor-java 6b4b6adc5ff8f91e2ddef14adf510e14aaf90204 external/chromium-trace 9456b95a6d4b95c765c9f2264a71b0334f6cf8d7 -external/chromium-webview ef62acbe255f65218a2122885a27624a0178ba14 +external/chromium-webview 55628131e0608ae5877fd6934719369e5002b679 external/clang 9fae335badf26813486d207b69928d38b979e522 external/cldr 7518f37169bd87d6977244e4d7471bc48fcd62e0 external/cn-cbor 7b581886d1830f50c3ab104a56b7ab931779466f diff --git a/Manifests/Manifest_LAOS-18.1.xml b/Manifests/Manifest_LAOS-18.1.xml index 2f1f3d72..e8e6eb78 100644 --- a/Manifests/Manifest_LAOS-18.1.xml +++ b/Manifests/Manifest_LAOS-18.1.xml @@ -75,6 +75,7 @@ + diff --git a/Manifests/Manifest_LAOS-19.1.xml b/Manifests/Manifest_LAOS-19.1.xml index 761308e5..2e775d17 100644 --- a/Manifests/Manifest_LAOS-19.1.xml +++ b/Manifests/Manifest_LAOS-19.1.xml @@ -51,6 +51,7 @@ + diff --git a/Patches/LineageOS-18.1/android_packages_apps_CarrierConfig2/0001-Legacy-compat.patch b/Patches/LineageOS-18.1/android_packages_apps_CarrierConfig2/0001-Legacy-compat.patch new file mode 100644 index 00000000..5ea34ec3 --- /dev/null +++ b/Patches/LineageOS-18.1/android_packages_apps_CarrierConfig2/0001-Legacy-compat.patch @@ -0,0 +1,211 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tavi +Date: Tue, 25 Jun 2024 07:48:24 -0400 +Subject: [PATCH] Legacy compat + +Change-Id: Ic564f35a7d694cc99fc810b776bb6389efbfe3f1 +Signed-off-by: Tavi +--- + .../grapheneos/carrierconfig2/ApnServiceImpl.java | 2 +- + .../carrierconfig2/CarrierServiceImpl.java | 12 +++--------- + src/app/grapheneos/carrierconfig2/Utils.java | 6 +++--- + src/app/grapheneos/carrierconfig2/loader/Apns.java | 9 +++------ + .../carrierconfig2/loader/CarrierConfigLoader.java | 8 ++++---- + .../grapheneos/carrierconfig2/loader/Filters.java | 7 ++----- + 6 files changed, 16 insertions(+), 28 deletions(-) + +diff --git a/src/app/grapheneos/carrierconfig2/ApnServiceImpl.java b/src/app/grapheneos/carrierconfig2/ApnServiceImpl.java +index 1fc2339..1ac28fc 100644 +--- a/src/app/grapheneos/carrierconfig2/ApnServiceImpl.java ++++ b/src/app/grapheneos/carrierconfig2/ApnServiceImpl.java +@@ -21,7 +21,7 @@ public class ApnServiceImpl extends ApnService { + public List onRestoreApns(int subId) { + Log.d(TAG, "onRestoreApns: subId " + subId); + +- var csd = CSettingsDir.getDefault(); ++ CSettingsDir csd = CSettingsDir.getDefault(); + if (csd == null) { + Log.e(TAG, "CSettingsDir is missing"); + return emptyList(); +diff --git a/src/app/grapheneos/carrierconfig2/CarrierServiceImpl.java b/src/app/grapheneos/carrierconfig2/CarrierServiceImpl.java +index 166272f..37b430c 100644 +--- a/src/app/grapheneos/carrierconfig2/CarrierServiceImpl.java ++++ b/src/app/grapheneos/carrierconfig2/CarrierServiceImpl.java +@@ -14,10 +14,10 @@ public class CarrierServiceImpl extends CarrierService { + + @Nullable + @Override +- public PersistableBundle onLoadConfig(int subId, @Nullable CarrierIdentifier carrierId) { +- Log.d(TAG, "subId " + subId + "; carrierId " + carrierId); ++ public PersistableBundle onLoadConfig(@Nullable CarrierIdentifier carrierId) { ++ Log.d(TAG, "carrierId " + carrierId); + +- var csd = CSettingsDir.getDefault(); ++ CSettingsDir csd = CSettingsDir.getDefault(); + if (csd == null) { + Log.e(TAG, "missing CSettingsDir"); + return null; +@@ -25,10 +25,4 @@ public class CarrierServiceImpl extends CarrierService { + + return new CarrierConfigLoader(getApplicationContext(), csd).load(carrierId); + } +- +- @Override +- public PersistableBundle onLoadConfig(CarrierIdentifier id) { +- // this method is deprecated and should never be called by the OS +- throw new IllegalStateException(String.valueOf(id)); +- } + } +diff --git a/src/app/grapheneos/carrierconfig2/Utils.java b/src/app/grapheneos/carrierconfig2/Utils.java +index 7300925..06abf09 100644 +--- a/src/app/grapheneos/carrierconfig2/Utils.java ++++ b/src/app/grapheneos/carrierconfig2/Utils.java +@@ -22,7 +22,7 @@ public class Utils { + return null; + } + +- var tm = ctx.getSystemService(TelephonyManager.class).createForSubscriptionId(subId); ++ TelephonyManager tm = ctx.getSystemService(TelephonyManager.class).createForSubscriptionId(subId); + String simOperator = tm.getSimOperator(); + + if (simOperator == null) { +@@ -46,13 +46,13 @@ public class Utils { + String imsi = tm.getSubscriberId(); + String gid1 = tm.getGroupIdLevel1(); + +- var res = new CarrierIdentifier(mcc, mnc, spn, imsi, gid1, null); ++ CarrierIdentifier res = new CarrierIdentifier(mcc, mnc, spn, imsi, gid1, null); + Log.d(TAG, "subId " + subId + "; " + res); + return res; + } + + public static String printStackTraceToString(Throwable t) { +- var baos = new ByteArrayOutputStream(1000); ++ ByteArrayOutputStream baos = new ByteArrayOutputStream(1000); + t.printStackTrace(new PrintStream(baos)); + return baos.toString(); + } +diff --git a/src/app/grapheneos/carrierconfig2/loader/Apns.java b/src/app/grapheneos/carrierconfig2/loader/Apns.java +index ff0082f..357e6ea 100644 +--- a/src/app/grapheneos/carrierconfig2/loader/Apns.java ++++ b/src/app/grapheneos/carrierconfig2/loader/Apns.java +@@ -39,7 +39,7 @@ public class Apns { + } + + private static ContentValues apnItemToContentValues(ApnItem i, CarrierId protoCarrierId) { +- var cv = new ContentValues(); ++ ContentValues cv = new ContentValues(); + cv.put(Telephony.Carriers.APN, i.getValue()); + cv.put(Telephony.Carriers.NAME, i.getName()); + +@@ -114,9 +114,6 @@ public class Apns { + + int lntBitmask = i.hasLingeringNetworkTypeBitmask() ? + parseBitmaskString(i.getLingeringNetworkTypeBitmask()) : 0; +- cv.put(Telephony.Carriers.LINGERING_NETWORK_TYPE_BITMASK, lntBitmask); +- cv.put(Telephony.Carriers.ALWAYS_ON, i.getAlwaysOn()); +- cv.put(Telephony.Carriers.MTU_V6, i.getMtuV6()); + + return cv; + } +@@ -164,7 +161,7 @@ public class Apns { + private static List getApnContentValues(CSettings cs) { + List list = cs.protoCSettings.getApns().getApnList(); + +- var result = new ArrayList(list.size()); ++ ArrayList result = new ArrayList(list.size()); + + for (ApnItem apnItem : list) { + result.add(apnItemToContentValues(apnItem, cs.carrierId2.protoCarrierId)); +@@ -185,7 +182,7 @@ public class Apns { + } + + private static String typesListToString(List list) { +- var b = new StringBuilder(list.size() * 5); ++ StringBuilder b = new StringBuilder(list.size() * 5); + boolean skipComma = true; + + for (ApnItem.ApnType apnType : list) { +diff --git a/src/app/grapheneos/carrierconfig2/loader/CarrierConfigLoader.java b/src/app/grapheneos/carrierconfig2/loader/CarrierConfigLoader.java +index 1d77aac..97a07be 100644 +--- a/src/app/grapheneos/carrierconfig2/loader/CarrierConfigLoader.java ++++ b/src/app/grapheneos/carrierconfig2/loader/CarrierConfigLoader.java +@@ -65,7 +65,7 @@ public class CarrierConfigLoader { + + CSettings defaults = CSettings.get(csd, DEFAULT_CARRIER_ID); + +- var bundle = new PersistableBundle(); ++ PersistableBundle bundle = new PersistableBundle(); + if (defaults != null) { + // settings for default carrier ID are used as a base, carrier-specific settings are + // applied on top +@@ -89,7 +89,7 @@ public class CarrierConfigLoader { + + private PersistableBundle carrierConfigToBundle(CarrierConfig cc) { + List configs = cc.getConfigList(); +- var bundle = new PersistableBundle(configs.size()); ++ PersistableBundle bundle = new PersistableBundle(configs.size()); + + String TAG = "carrierConfigToBundle"; + +@@ -174,7 +174,7 @@ public class CarrierConfigLoader { + private void storeApnCSettingsVersion(CSettings cs) { + String k = cs.carrierId2.canonicalName; + SharedPreferences p = Prefs.get(context, Prefs.Namespace.APN_CSETTINGS_VERSIONS); +- var ed = p.edit(); ++ SharedPreferences.Editor ed = p.edit(); + if (p.getAll().size() > 100) { + // remove old values + ed.clear(); +@@ -186,7 +186,7 @@ public class CarrierConfigLoader { + private void addVersionString(CSettings cSettings, boolean isDefault, PersistableBundle dest) { + CarrierSettings cs = cSettings.protoCSettings; + +- var b = new StringBuilder(); ++ StringBuilder b = new StringBuilder(); + b.append(cs.getCanonicalName()); + b.append('-'); + b.append(cs.getVersion()); +diff --git a/src/app/grapheneos/carrierconfig2/loader/Filters.java b/src/app/grapheneos/carrierconfig2/loader/Filters.java +index 75764db..02b92a9 100644 +--- a/src/app/grapheneos/carrierconfig2/loader/Filters.java ++++ b/src/app/grapheneos/carrierconfig2/loader/Filters.java +@@ -23,12 +23,10 @@ class Filters { + case CarrierConfigManager.KEY_EDITABLE_ENHANCED_4G_LTE_BOOL: + case CarrierConfigManager.KEY_EDITABLE_WFC_MODE_BOOL: + case CarrierConfigManager.KEY_EDITABLE_WFC_ROAMING_MODE_BOOL: +- case CarrierConfigManager.KEY_HIDE_ENABLE_2G: + case CarrierConfigManager.KEY_HIDE_ENHANCED_4G_LTE_BOOL: + case CarrierConfigManager.KEY_HIDE_IMS_APN_BOOL: + case CarrierConfigManager.KEY_HIDE_PRESET_APN_DETAILS_BOOL: + case CarrierConfigManager.KEY_SHOW_APN_SETTING_CDMA_BOOL: +- case CarrierConfigManager.KEY_VONR_SETTING_VISIBILITY_BOOL: + case "com.google.android.dialer.display_wifi_calling_button_bool": + return null; + } +@@ -52,7 +50,6 @@ class Filters { + return null; + } + break; +- case CarrierConfigManager.KEY_CARRIER_PROVISIONING_APP_STRING: + case CarrierConfigManager.KEY_CARRIER_SETTINGS_ACTIVITY_COMPONENT_NAME_STRING: + case CarrierConfigManager.KEY_CARRIER_SETUP_APP_STRING: + case CarrierConfigManager.KEY_SMART_FORWARDING_CONFIG_COMPONENT_NAME_STRING: +@@ -107,7 +104,7 @@ class Filters { + } + + private static boolean isSystemComponentName(Context ctx, String name) { +- var cn = ComponentName.unflattenFromString(name); ++ ComponentName cn = ComponentName.unflattenFromString(name); + if (cn == null) { + Log.w(TAG, "malformed ComponentName " + name); + return false; +@@ -117,7 +114,7 @@ class Filters { + + private static boolean isSystemApp(Context ctx, String packageName) { + ApplicationInfo ai; +- var pm = ctx.getPackageManager(); ++ PackageManager pm = ctx.getPackageManager(); + try { + ai = pm.getApplicationInfo(packageName, 0); + } catch (PackageManager.NameNotFoundException e) { diff --git a/Patches/LineageOS-18.1/android_packages_apps_Settings/0016-CC2_Toggle.patch b/Patches/LineageOS-18.1/android_packages_apps_Settings/0016-CC2_Toggle.patch new file mode 100644 index 00000000..1bb488f0 --- /dev/null +++ b/Patches/LineageOS-18.1/android_packages_apps_Settings/0016-CC2_Toggle.patch @@ -0,0 +1,173 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tad +Date: Wed, 20 Apr 2022 01:04:27 -0400 +Subject: [PATCH] Add a toggle for CarrierConfig2 enablement + +Copy and pasted from the GrapheneOS exec spawning toggle patch +TODO: MOVE OUT OF SECURITY CATEGORY + +Change-Id: Ibea6ea9bed1c2ae3491f403d9e5c17c1d1c403f1 +Signed-off-by: Tad +--- + res/values/strings.xml | 3 + + res/xml/security_dashboard_settings.xml | 6 + + .../CarrierConfig2PreferenceController.java | 106 ++++++++++++++++++ + .../settings/security/SecuritySettings.java | 1 + + 4 files changed, 116 insertions(+) + create mode 100644 src/com/android/settings/security/CarrierConfig2PreferenceController.java + +diff --git a/res/values/strings.xml b/res/values/strings.xml +index 3d2b61cc580..e07fd234aa0 100644 +--- a/res/values/strings.xml ++++ b/res/values/strings.xml +@@ -11981,6 +11981,9 @@ + Unprivileged microG enablement + Allows official builds of microG apps to function. Not supported, not recommended. May break apps and/or degrade their security model. Notes: 1) microG connects directly to Google, 2) apps talking to microG do so using proprietary Google libraries, 3) microG can download/execute proprietary code from Google. + ++ Enable CarrierConfig2 ++ Use a larger Google database instead of the AOSP database for carrier specific configurations. May improve cellular network compatibility & functionality. Requires reboot. ++ + + Privacy + +diff --git a/res/xml/security_dashboard_settings.xml b/res/xml/security_dashboard_settings.xml +index 21ce054889c..892ea57cf20 100644 +--- a/res/xml/security_dashboard_settings.xml ++++ b/res/xml/security_dashboard_settings.xml +@@ -87,6 +87,12 @@ + android:title="@string/sig_spoof_title" + android:summary="@string/sig_spoof_summary" + android:persistent="false" /> ++ ++ + + + +diff --git a/src/com/android/settings/security/CarrierConfig2PreferenceController.java b/src/com/android/settings/security/CarrierConfig2PreferenceController.java +new file mode 100644 +index 00000000000..a3e5aa17591 +--- /dev/null ++++ b/src/com/android/settings/security/CarrierConfig2PreferenceController.java +@@ -0,0 +1,106 @@ ++/* ++ * Copyright (C) 2022 The Android Open Source Project ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License ++ */ ++ ++package com.android.settings.security; ++ ++import android.content.Context; ++ ++import android.os.UserHandle; ++import android.os.UserManager; ++import android.os.SystemProperties; ++ ++import android.provider.Settings; ++ ++import androidx.preference.Preference; ++import androidx.preference.PreferenceCategory; ++import androidx.preference.PreferenceGroup; ++import androidx.preference.PreferenceScreen; ++import androidx.preference.TwoStatePreference; ++import androidx.preference.SwitchPreference; ++ ++import com.android.internal.widget.LockPatternUtils; ++import com.android.settings.core.PreferenceControllerMixin; ++import com.android.settingslib.core.AbstractPreferenceController; ++import com.android.settingslib.core.lifecycle.events.OnResume; ++ ++public class CarrierConfig2PreferenceController extends AbstractPreferenceController ++ implements PreferenceControllerMixin, OnResume, Preference.OnPreferenceChangeListener { ++ ++ private static final String SYS_KEY_CARRIERCONFIG2_ENABLE = "persist.security.carrierconfig2"; ++ private static final String PREF_KEY_CARRIERCONFIG2_ENABLE = "carrierconfig2"; ++ private static final String PREF_KEY_SECURITY_CATEGORY = "security_category"; ++ ++ private PreferenceCategory mSecurityCategory; ++ private SwitchPreference mCarrierConfig2Enable; ++ private boolean mIsAdmin; ++ private UserManager mUm; ++ ++ public CarrierConfig2PreferenceController(Context context) { ++ super(context); ++ mUm = UserManager.get(context); ++ } ++ ++ @Override ++ public void displayPreference(PreferenceScreen screen) { ++ super.displayPreference(screen); ++ mSecurityCategory = screen.findPreference(PREF_KEY_SECURITY_CATEGORY); ++ updatePreferenceState(); ++ } ++ ++ @Override ++ public boolean isAvailable() { ++ mIsAdmin = mUm.isAdminUser(); ++ return mIsAdmin; ++ } ++ ++ @Override ++ public String getPreferenceKey() { ++ return PREF_KEY_CARRIERCONFIG2_ENABLE; ++ } ++ ++ // TODO: should we use onCreatePreferences() instead? ++ private void updatePreferenceState() { ++ if (mSecurityCategory == null) { ++ return; ++ } ++ ++ if (mIsAdmin) { ++ mCarrierConfig2Enable = (SwitchPreference) mSecurityCategory.findPreference(PREF_KEY_CARRIERCONFIG2_ENABLE); ++ mCarrierConfig2Enable.setChecked(SystemProperties.getInt(SYS_KEY_CARRIERCONFIG2_ENABLE, 0) == 1); ++ } else { ++ mSecurityCategory.removePreference(mSecurityCategory.findPreference(PREF_KEY_CARRIERCONFIG2_ENABLE)); ++ } ++ } ++ ++ @Override ++ public void onResume() { ++ updatePreferenceState(); ++ if (mCarrierConfig2Enable != null) { ++ boolean mode = mCarrierConfig2Enable.isChecked(); ++ SystemProperties.set(SYS_KEY_CARRIERCONFIG2_ENABLE, mode ? "1" : "0"); ++ } ++ } ++ ++ @Override ++ public boolean onPreferenceChange(Preference preference, Object value) { ++ final String key = preference.getKey(); ++ if (PREF_KEY_CARRIERCONFIG2_ENABLE.equals(key)) { ++ final boolean mode = !mCarrierConfig2Enable.isChecked(); ++ SystemProperties.set(SYS_KEY_CARRIERCONFIG2_ENABLE, mode ? "1" : "0"); ++ } ++ return true; ++ } ++} +diff --git a/src/com/android/settings/security/SecuritySettings.java b/src/com/android/settings/security/SecuritySettings.java +index 5248d74c376..fcf244e720b 100644 +--- a/src/com/android/settings/security/SecuritySettings.java ++++ b/src/com/android/settings/security/SecuritySettings.java +@@ -123,6 +123,7 @@ public class SecuritySettings extends DashboardFragment { + securityPreferenceControllers.add(new NativeDebugPreferenceController(context)); + securityPreferenceControllers.add(new HostsPreferenceController(context)); + securityPreferenceControllers.add(new SigSpoofPreferenceController(context)); ++ securityPreferenceControllers.add(new CarrierConfig2PreferenceController(context)); + controllers.add(new PreferenceCategoryController(context, SECURITY_CATEGORY) + .setChildren(securityPreferenceControllers)); + controllers.addAll(securityPreferenceControllers); diff --git a/Patches/LineageOS-18.1/android_packages_services_Telephony/0001-CC2.patch b/Patches/LineageOS-18.1/android_packages_services_Telephony/0001-CC2.patch new file mode 100644 index 00000000..c846f2b8 --- /dev/null +++ b/Patches/LineageOS-18.1/android_packages_services_Telephony/0001-CC2.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tavi +Date: Tue, 25 Jun 2024 02:39:28 -0400 +Subject: [PATCH] Runtime control of platform carrier config package + +Change-Id: I8cc8f2bda264bd42fe83d5c96fa6382e63a88410 +Signed-off-by: Tavi +--- + src/com/android/phone/CarrierConfigLoader.java | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java +index 8d5b3307c..4ed2d20a4 100644 +--- a/src/com/android/phone/CarrierConfigLoader.java ++++ b/src/com/android/phone/CarrierConfigLoader.java +@@ -41,6 +41,7 @@ import android.os.PersistableBundle; + import android.os.Process; + import android.os.RemoteException; + import android.os.ResultReceiver; ++import android.os.SystemProperties; + import android.os.UserHandle; + import android.preference.PreferenceManager; + import android.service.carrier.CarrierIdentifier; +@@ -645,8 +646,14 @@ public class CarrierConfigLoader extends ICarrierConfigLoader.Stub { + */ + private CarrierConfigLoader(Context context) { + mContext = context; +- mPlatformCarrierConfigPackage = +- mContext.getString(R.string.platform_carrier_config_package); ++ if (SystemProperties.getBoolean("persist.security.carrierconfig2", false)) { ++ mPlatformCarrierConfigPackage = "app.grapheneos.carrierconfig2"; ++ } else { ++ //mPlatformCarrierConfigPackage = "com.android.carrierconfig"; ++ mPlatformCarrierConfigPackage = ++ mContext.getString(R.string.platform_carrier_config_package); ++ } ++ Log.d("CarrierConfigPackageOverride", "Provider: " + mPlatformCarrierConfigPackage); + mHandler = new ConfigHandler(); + + IntentFilter bootFilter = new IntentFilter(); diff --git a/Patches/LineageOS-19.1/android_packages_apps_CarrierConfig2/0001-Legacy-compat.patch b/Patches/LineageOS-19.1/android_packages_apps_CarrierConfig2/0001-Legacy-compat.patch new file mode 100644 index 00000000..b66f29fd --- /dev/null +++ b/Patches/LineageOS-19.1/android_packages_apps_CarrierConfig2/0001-Legacy-compat.patch @@ -0,0 +1,185 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tavi +Date: Tue, 25 Jun 2024 07:48:24 -0400 +Subject: [PATCH] Legacy compat + +Change-Id: Ic564f35a7d694cc99fc810b776bb6389efbfe3f1 +Signed-off-by: Tavi +--- + .../grapheneos/carrierconfig2/ApnServiceImpl.java | 2 +- + .../carrierconfig2/CarrierServiceImpl.java | 12 +++--------- + src/app/grapheneos/carrierconfig2/Utils.java | 6 +++--- + src/app/grapheneos/carrierconfig2/loader/Apns.java | 9 +++------ + .../carrierconfig2/loader/CarrierConfigLoader.java | 8 ++++---- + .../grapheneos/carrierconfig2/loader/Filters.java | 7 ++----- + 6 files changed, 16 insertions(+), 28 deletions(-) + +diff --git a/src/app/grapheneos/carrierconfig2/ApnServiceImpl.java b/src/app/grapheneos/carrierconfig2/ApnServiceImpl.java +index 1fc2339..1ac28fc 100644 +--- a/src/app/grapheneos/carrierconfig2/ApnServiceImpl.java ++++ b/src/app/grapheneos/carrierconfig2/ApnServiceImpl.java +@@ -21,7 +21,7 @@ public class ApnServiceImpl extends ApnService { + public List onRestoreApns(int subId) { + Log.d(TAG, "onRestoreApns: subId " + subId); + +- var csd = CSettingsDir.getDefault(); ++ CSettingsDir csd = CSettingsDir.getDefault(); + if (csd == null) { + Log.e(TAG, "CSettingsDir is missing"); + return emptyList(); +diff --git a/src/app/grapheneos/carrierconfig2/CarrierServiceImpl.java b/src/app/grapheneos/carrierconfig2/CarrierServiceImpl.java +--- a/src/app/grapheneos/carrierconfig2/CarrierServiceImpl.java ++++ b/src/app/grapheneos/carrierconfig2/CarrierServiceImpl.java +@@ -14,10 +14,10 @@ public class CarrierServiceImpl extends CarrierService { + + @Nullable + @Override +- public PersistableBundle onLoadConfig(int subId, @Nullable CarrierIdentifier carrierId) { +- Log.d(TAG, "subId " + subId + "; carrierId " + carrierId); ++ public PersistableBundle onLoadConfig(@Nullable CarrierIdentifier carrierId) { ++ Log.d(TAG, "carrierId " + carrierId); + +- var csd = CSettingsDir.getDefault(); ++ CSettingsDir csd = CSettingsDir.getDefault(); + if (csd == null) { + Log.e(TAG, "missing CSettingsDir"); + return null; +@@ -25,10 +25,4 @@ public class CarrierServiceImpl extends CarrierService { + + return new CarrierConfigLoader(getApplicationContext(), csd).load(carrierId); + } +- +- @Override +- public PersistableBundle onLoadConfig(CarrierIdentifier id) { +- // this method is deprecated and should never be called by the OS +- throw new IllegalStateException(String.valueOf(id)); +- } + } +diff --git a/src/app/grapheneos/carrierconfig2/Utils.java b/src/app/grapheneos/carrierconfig2/Utils.java +--- a/src/app/grapheneos/carrierconfig2/Utils.java ++++ b/src/app/grapheneos/carrierconfig2/Utils.java +@@ -22,7 +22,7 @@ public class Utils { + return null; + } + +- var tm = ctx.getSystemService(TelephonyManager.class).createForSubscriptionId(subId); ++ TelephonyManager tm = ctx.getSystemService(TelephonyManager.class).createForSubscriptionId(subId); + String simOperator = tm.getSimOperator(); + + if (simOperator == null) { +@@ -46,13 +46,13 @@ public class Utils { + String imsi = tm.getSubscriberId(); + String gid1 = tm.getGroupIdLevel1(); + +- var res = new CarrierIdentifier(mcc, mnc, spn, imsi, gid1, null); ++ CarrierIdentifier res = new CarrierIdentifier(mcc, mnc, spn, imsi, gid1, null); + Log.d(TAG, "subId " + subId + "; " + res); + return res; + } + + public static String printStackTraceToString(Throwable t) { +- var baos = new ByteArrayOutputStream(1000); ++ ByteArrayOutputStream baos = new ByteArrayOutputStream(1000); + t.printStackTrace(new PrintStream(baos)); + return baos.toString(); + } +diff --git a/src/app/grapheneos/carrierconfig2/loader/Apns.java b/src/app/grapheneos/carrierconfig2/loader/Apns.java +--- a/src/app/grapheneos/carrierconfig2/loader/Apns.java ++++ b/src/app/grapheneos/carrierconfig2/loader/Apns.java +@@ -39,7 +39,7 @@ public class Apns { + } + + private static ContentValues apnItemToContentValues(ApnItem i, CarrierId protoCarrierId) { +- var cv = new ContentValues(); ++ ContentValues cv = new ContentValues(); + cv.put(Telephony.Carriers.APN, i.getValue()); + cv.put(Telephony.Carriers.NAME, i.getName()); + +@@ -114,9 +114,6 @@ public class Apns { + + int lntBitmask = i.hasLingeringNetworkTypeBitmask() ? + parseBitmaskString(i.getLingeringNetworkTypeBitmask()) : 0; +- cv.put(Telephony.Carriers.LINGERING_NETWORK_TYPE_BITMASK, lntBitmask); +- cv.put(Telephony.Carriers.ALWAYS_ON, i.getAlwaysOn()); +- cv.put(Telephony.Carriers.MTU_V6, i.getMtuV6()); + + return cv; + } +@@ -164,7 +161,7 @@ public class Apns { + private static List getApnContentValues(CSettings cs) { + List list = cs.protoCSettings.getApns().getApnList(); + +- var result = new ArrayList(list.size()); ++ ArrayList result = new ArrayList(list.size()); + + for (ApnItem apnItem : list) { + result.add(apnItemToContentValues(apnItem, cs.carrierId2.protoCarrierId)); +@@ -185,7 +182,7 @@ public class Apns { + } + + private static String typesListToString(List list) { +- var b = new StringBuilder(list.size() * 5); ++ StringBuilder b = new StringBuilder(list.size() * 5); + boolean skipComma = true; + + for (ApnItem.ApnType apnType : list) { +diff --git a/src/app/grapheneos/carrierconfig2/loader/CarrierConfigLoader.java b/src/app/grapheneos/carrierconfig2/loader/CarrierConfigLoader.java +--- a/src/app/grapheneos/carrierconfig2/loader/CarrierConfigLoader.java ++++ b/src/app/grapheneos/carrierconfig2/loader/CarrierConfigLoader.java +@@ -65,7 +65,7 @@ public class CarrierConfigLoader { + + CSettings defaults = CSettings.get(csd, DEFAULT_CARRIER_ID); + +- var bundle = new PersistableBundle(); ++ PersistableBundle bundle = new PersistableBundle(); + if (defaults != null) { + // settings for default carrier ID are used as a base, carrier-specific settings are + // applied on top +@@ -89,7 +89,7 @@ public class CarrierConfigLoader { + + private PersistableBundle carrierConfigToBundle(CarrierConfig cc) { + List configs = cc.getConfigList(); +- var bundle = new PersistableBundle(configs.size()); ++ PersistableBundle bundle = new PersistableBundle(configs.size()); + + String TAG = "carrierConfigToBundle"; + +@@ -174,7 +174,7 @@ public class CarrierConfigLoader { + private void storeApnCSettingsVersion(CSettings cs) { + String k = cs.carrierId2.canonicalName; + SharedPreferences p = Prefs.get(context, Prefs.Namespace.APN_CSETTINGS_VERSIONS); +- var ed = p.edit(); ++ SharedPreferences.Editor ed = p.edit(); + if (p.getAll().size() > 100) { + // remove old values + ed.clear(); +@@ -186,7 +186,7 @@ public class CarrierConfigLoader { + private void addVersionString(CSettings cSettings, boolean isDefault, PersistableBundle dest) { + CarrierSettings cs = cSettings.protoCSettings; + +- var b = new StringBuilder(); ++ StringBuilder b = new StringBuilder(); + b.append(cs.getCanonicalName()); + b.append('-'); + b.append(cs.getVersion()); +diff --git a/src/app/grapheneos/carrierconfig2/loader/Filters.java b/src/app/grapheneos/carrierconfig2/loader/Filters.java +--- a/src/app/grapheneos/carrierconfig2/loader/Filters.java ++++ b/src/app/grapheneos/carrierconfig2/loader/Filters.java +@@ -107,7 +107,7 @@ class Filters { + } + + private static boolean isSystemComponentName(Context ctx, String name) { +- var cn = ComponentName.unflattenFromString(name); ++ ComponentName cn = ComponentName.unflattenFromString(name); + if (cn == null) { + Log.w(TAG, "malformed ComponentName " + name); + return false; +@@ -117,7 +117,7 @@ class Filters { + + private static boolean isSystemApp(Context ctx, String packageName) { + ApplicationInfo ai; +- var pm = ctx.getPackageManager(); ++ PackageManager pm = ctx.getPackageManager(); + try { + ai = pm.getApplicationInfo(packageName, 0); + } catch (PackageManager.NameNotFoundException e) { diff --git a/Patches/LineageOS-19.1/android_packages_apps_Settings/0017-CC2_Toggle.patch b/Patches/LineageOS-19.1/android_packages_apps_Settings/0017-CC2_Toggle.patch new file mode 100644 index 00000000..3ccb9401 --- /dev/null +++ b/Patches/LineageOS-19.1/android_packages_apps_Settings/0017-CC2_Toggle.patch @@ -0,0 +1,173 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tad +Date: Wed, 20 Apr 2022 01:04:27 -0400 +Subject: [PATCH] Add a toggle for CarrierConfig2 enablement + +Copy and pasted from the GrapheneOS exec spawning toggle patch +TODO: MOVE OUT OF SECURITY CATEGORY + +Change-Id: Ibea6ea9bed1c2ae3491f403d9e5c17c1d1c403f1 +Signed-off-by: Tad +--- + res/values/strings.xml | 3 + + res/xml/security_dashboard_settings.xml | 6 + + .../CarrierConfig2PreferenceController.java | 106 ++++++++++++++++++ + .../settings/security/SecuritySettings.java | 1 + + 4 files changed, 116 insertions(+) + create mode 100644 src/com/android/settings/security/CarrierConfig2PreferenceController.java + +diff --git a/res/values/strings.xml b/res/values/strings.xml +index 6191f0a147..1d46451503 100644 +--- a/res/values/strings.xml ++++ b/res/values/strings.xml +@@ -13136,6 +13136,9 @@ + Unprivileged microG enablement + Allows official builds of microG apps to function. Not supported, not recommended. May break apps and/or degrade their security model. Notes: 1) microG connects directly to Google, 2) apps talking to microG do so using proprietary Google libraries, 3) microG can download/execute proprietary code from Google. + ++ Enable CarrierConfig2 ++ Use a larger Google database instead of the AOSP database for carrier specific configurations. May improve cellular network compatibility & functionality. Requires reboot. ++ + + Privacy + +diff --git a/res/xml/security_dashboard_settings.xml b/res/xml/security_dashboard_settings.xml +index f5384fa104..0a18a8b8a7 100644 +--- a/res/xml/security_dashboard_settings.xml ++++ b/res/xml/security_dashboard_settings.xml +@@ -87,6 +87,12 @@ + android:summary="@string/sig_spoof_summary" + android:persistent="false" /> + ++ ++ + +Date: Tue, 25 Jun 2024 02:39:28 -0400 +Subject: [PATCH] Runtime control of platform carrier config package + +Change-Id: I8cc8f2bda264bd42fe83d5c96fa6382e63a88410 +Signed-off-by: Tavi +--- + src/com/android/phone/CarrierConfigLoader.java | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java +index 77c989715..6e2b12bc8 100644 +--- a/src/com/android/phone/CarrierConfigLoader.java ++++ b/src/com/android/phone/CarrierConfigLoader.java +@@ -42,6 +42,7 @@ import android.os.PersistableBundle; + import android.os.Process; + import android.os.RemoteException; + import android.os.ResultReceiver; ++import android.os.SystemProperties; + import android.os.UserHandle; + import android.preference.PreferenceManager; + import android.service.carrier.CarrierIdentifier; +@@ -686,8 +687,14 @@ public class CarrierConfigLoader extends ICarrierConfigLoader.Stub { + /* package */ CarrierConfigLoader(Context context, + SubscriptionInfoUpdater subscriptionInfoUpdater, @NonNull Looper looper) { + mContext = context; +- mPlatformCarrierConfigPackage = +- mContext.getString(R.string.platform_carrier_config_package); ++ if (SystemProperties.getBoolean("persist.security.carrierconfig2", false)) { ++ mPlatformCarrierConfigPackage = "app.grapheneos.carrierconfig2"; ++ } else { ++ //mPlatformCarrierConfigPackage = "com.android.carrierconfig"; ++ mPlatformCarrierConfigPackage = ++ mContext.getString(R.string.platform_carrier_config_package); ++ } ++ Log.d("CarrierConfigPackageOverride", "Provider: " + mPlatformCarrierConfigPackage); + mHandler = new ConfigHandler(looper); + + IntentFilter bootFilter = new IntentFilter(); diff --git a/Patches/LineageOS-20.0/android_packages_apps_Settings/0017-OpenEUICC_Toggle.patch b/Patches/LineageOS-20.0/android_packages_apps_Settings/0017-OpenEUICC_Toggle.patch index 4066c784..b627ce2c 100644 --- a/Patches/LineageOS-20.0/android_packages_apps_Settings/0017-OpenEUICC_Toggle.patch +++ b/Patches/LineageOS-20.0/android_packages_apps_Settings/0017-OpenEUICC_Toggle.patch @@ -22,7 +22,7 @@ index ce056d7ab0..751f4a4037 100644 +++ b/res/values/strings.xml @@ -759,6 +759,9 @@ Unprivileged microG enablement - Allows official builds of microG apps to function. Not supported, not recommended. May break apps and/or degrade their security model. Notes: 1) microG connects directly to Google, 2) apps talking to microG do so using proprietary Google libraries, 3) microG can download/execute proprietary code from Google. + Allows official builds of microG apps to function. Not supported, not recommended. May break apps and/or degrade their security model. Notes: 1) microG connects directly to Google, 2) apps talking to microG do so using proprietary Google libraries, 3) microG can download/execute proprietary code from Google. Requires reboot. + Enable eUICC management + Enables the OpenEUICC app to allow management of virtual (eSIM) and physical eUICC cards. Reboot required after toggling. diff --git a/Patches/LineageOS-20.0/android_packages_apps_Settings/0018-CC2_Toggle.patch b/Patches/LineageOS-20.0/android_packages_apps_Settings/0018-CC2_Toggle.patch index a4f4b8c7..d1992616 100644 --- a/Patches/LineageOS-20.0/android_packages_apps_Settings/0018-CC2_Toggle.patch +++ b/Patches/LineageOS-20.0/android_packages_apps_Settings/0018-CC2_Toggle.patch @@ -17,7 +17,7 @@ Signed-off-by: Tad create mode 100644 src/com/android/settings/security/CarrierConfig2PreferenceController.java diff --git a/res/values/strings.xml b/res/values/strings.xml -index 751f4a4037..d8f4ed191a 100644 +index 751f4a4037..3ac2ac4763 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -762,6 +762,9 @@ @@ -25,7 +25,7 @@ index 751f4a4037..d8f4ed191a 100644 Enables the OpenEUICC app to allow management of virtual (eSIM) and physical eUICC cards. Reboot required after toggling. + Enable CarrierConfig2 -+ Use a larger Google database instead of the AOSP database for carrier specific configurations. May improve cellular network compatibility & functionality. ++ Use a larger Google database instead of the AOSP database for carrier specific configurations. May improve cellular network compatibility & functionality. Requires reboot. + Lock screen when trust is lost diff --git a/Scripts/LineageOS-18.1/Patch.sh b/Scripts/LineageOS-18.1/Patch.sh index 23995b87..b087b987 100644 --- a/Scripts/LineageOS-18.1/Patch.sh +++ b/Scripts/LineageOS-18.1/Patch.sh @@ -304,6 +304,14 @@ if enterAndClear "packages/apps/Bluetooth"; then applyPatch "$DOS_PATCHES/android_packages_apps_Bluetooth/0001-constify_JNINativeMethod.patch"; #Constify JNINativeMethod tables (GrapheneOS) fi; +if enterAndClear "packages/apps/CarrierConfig2"; then +applyPatch "$DOS_PATCHES/android_packages_apps_CarrierConfig2/0001-Legacy-compat.patch"; #Fixup (DivestOS) +awk -i inplace '!/overrides/' Android.bp; #Don't replace CarrierConfig +sed -i -e '31,35d;' AndroidManifest.xml; #Fixups +rm src/app/grapheneos/carrierconfig2/TestActivity.java src/app/grapheneos/carrierconfig2/loader/CmpTest.java; +if [ -d "$DOS_BUILD_BASE"/vendor/divested-carriersettings ]; then sed -i 's|etc/CarrierSettings|etc/CarrierSettings2|' src/app/grapheneos/carrierconfig2/loader/CSettingsDir.java; fi; #Alter the search path +fi; + if enterAndClear "packages/apps/Contacts"; then applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0001-No_Google_Links.patch"; #Remove Privacy Policy and Terms of Service links (GrapheneOS) applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0002-No_Google_Backup.patch"; #Backups are not sent to Google (GrapheneOS) @@ -361,6 +369,7 @@ applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0013-LTE_Only_Mode-2.pat applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0013-LTE_Only_Mode-3.patch"; #Add LTE only entry when carrier enables world mode (GrapheneOS) applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0014-SUPL_Toggle.patch"; #Add a toggle for forcibly disabling SUPL (GrapheneOS) applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0015-microG_Toggle.patch"; #Add a toggle for microG enablement (heavily based off of a GrapheneOS patch) +if [ -d "$DOS_BUILD_BASE"/vendor/divested-carriersettings ]; then applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0016-CC2_Toggle.patch"; fi; #Add a toggle for CarrierConfig2 enablement (heavily based off of a GrapheneOS patch) applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Settings/0001-disable_apps.patch"; #Add an ability to disable non-system apps from the "App info" screen (GrapheneOS) sed -i 's/if (isFullDiskEncrypted()) {/if (false) {/' src/com/android/settings/accessibility/*AccessibilityService*.java; #Never disable secure start-up when enabling an accessibility service fi; @@ -404,6 +413,10 @@ applyPatch "$DOS_PATCHES/android_packages_providers_TelephonyProvider/304614.pat applyPatch "$DOS_PATCHES/android_packages_providers_TelephonyProvider/312102.patch"; #mnc fix (Sony) fi; +if enterAndClear "packages/services/Telephony"; then +if [ -d "$DOS_BUILD_BASE"/vendor/divested-carriersettings ]; then applyPatch "$DOS_PATCHES/android_packages_services_Telephony/0001-CC2.patch"; fi; #Runtime control of platform carrier config package (DivestOS) +fi; + if enterAndClear "system/bt"; then applyPatch "$DOS_PATCHES/android_system_bt/385557.patch"; #R_asb_2024-03 Fix an OOB bug in smp_proc_sec_req applyPatch "$DOS_PATCHES/android_system_bt/385558.patch"; #R_asb_2024-03 Reland: Fix an OOB write bug in attp_build_value_cmd @@ -490,6 +503,13 @@ awk -i inplace '!/_lookup/' overlay/common/lineage-sdk/packages/LineageSettingsP echo "PRODUCT_PACKAGES += vendor.lineage.trust@1.0-service" >> packages.mk; #Add deny usb service, all of our kernels have the necessary patch echo "PRODUCT_PACKAGES += eSpeakNG" >> packages.mk; #PicoTTS needs work to compile on 18.1, use eSpeak-NG instead awk -i inplace '!/speed-profile/' build/target/product/lowram.mk; #breaks compile on some dexpreopt devices +if [ -d "$DOS_BUILD_BASE"/vendor/divested-carriersettings ]; then +echo "Including CarrierConfig2 & CarrierSettings2"; +echo 'ifneq ($(BOARD_WITHOUT_RADIO),true)' >> divestos.mk; +echo "PRODUCT_PACKAGES += CarrierConfig2" >> divestos.mk; +echo "include vendor/divested-carriersettings/CarrierSettings2.mk" >> divestos.mk; +echo "endif" >> divestos.mk; +fi; fi; # #END OF ROM CHANGES diff --git a/Scripts/LineageOS-19.1/Patch.sh b/Scripts/LineageOS-19.1/Patch.sh index 835b2444..7859e88d 100644 --- a/Scripts/LineageOS-19.1/Patch.sh +++ b/Scripts/LineageOS-19.1/Patch.sh @@ -261,6 +261,14 @@ if enterAndClear "packages/apps/Bluetooth"; then applyPatch "$DOS_PATCHES/android_packages_apps_Bluetooth/0001-constify_JNINativeMethod.patch"; #Constify JNINativeMethod tables (GrapheneOS) fi; +if enterAndClear "packages/apps/CarrierConfig2"; then +applyPatch "$DOS_PATCHES/android_packages_apps_CarrierConfig2/0001-Legacy-compat.patch"; #Fixup (DivestOS) +awk -i inplace '!/overrides/' Android.bp; #Don't replace CarrierConfig +sed -i -e '31,35d;' AndroidManifest.xml; #Fixups +rm src/app/grapheneos/carrierconfig2/TestActivity.java src/app/grapheneos/carrierconfig2/loader/CmpTest.java; +if [ -d "$DOS_BUILD_BASE"/vendor/divested-carriersettings ]; then sed -i 's|etc/CarrierSettings|etc/CarrierSettings2|' src/app/grapheneos/carrierconfig2/loader/CSettingsDir.java; fi; #Alter the search path +fi; + if enterAndClear "packages/apps/Contacts"; then applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0001-No_Google_Links.patch"; #Remove Privacy Policy and Terms of Service links (GrapheneOS) applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0002-No_Google_Backup.patch"; #Backups are not sent to Google (GrapheneOS) @@ -304,6 +312,7 @@ applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0013-Captive_Portal_Togg applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0014-LTE_Only_Mode.patch"; #Add LTE only setting (GrapheneOS) applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0015-SUPL_Toggle.patch"; #Add a toggle for forcibly disabling SUPL (GrapheneOS) applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0016-microG_Toggle.patch"; #Add a toggle for microG enablement (heavily based off of a GrapheneOS patch) +if [ -d "$DOS_BUILD_BASE"/vendor/divested-carriersettings ]; then applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0017-CC2_Toggle.patch"; fi; #Add a toggle for CarrierConfig2 enablement (heavily based off of a GrapheneOS patch) applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Settings/0001-disable_apps.patch"; #Add an ability to disable non-system apps from the "App info" screen (GrapheneOS) sed -i 's/if (isFullDiskEncrypted()) {/if (false) {/' src/com/android/settings/accessibility/*AccessibilityService*.java; #Never disable secure start-up when enabling an accessibility service fi; @@ -373,6 +382,10 @@ if enterAndClear "packages/providers/DownloadProvider"; then applyPatch "$DOS_PATCHES/android_packages_providers_DownloadProvider/0001-Network_Permission.patch"; #Expose the NETWORK permission (GrapheneOS) fi; +if enterAndClear "packages/services/Telephony"; then +if [ -d "$DOS_BUILD_BASE"/vendor/divested-carriersettings ]; then applyPatch "$DOS_PATCHES/android_packages_services_Telephony/0001-CC2.patch"; fi; #Runtime control of platform carrier config package (DivestOS) +fi; + if enterAndClear "system/bt"; then applyPatch "$DOS_PATCHES_COMMON/android_system_bt/0001-alloc_size.patch"; #Add alloc_size attributes to the allocator (GrapheneOS) fi; @@ -449,6 +462,13 @@ awk -i inplace '!/speed-profile/' build/target/product/lowram.mk; #breaks compil awk -i inplace '!/persist.traced.enable/' build/target/product/lowram.mk; #breaks compile due to duplicate sed -i 's/wifi,cell/internet/' overlay/common/frameworks/base/packages/SystemUI/res/values/config.xml; #Use the modern quick tile sed -i 's|system/etc|$(TARGET_COPY_OUT_PRODUCT)/etc|' divestos.mk; +if [ -d "$DOS_BUILD_BASE"/vendor/divested-carriersettings ]; then +echo "Including CarrierConfig2 & CarrierSettings2"; +echo 'ifneq ($(BOARD_WITHOUT_RADIO),true)' >> divestos.mk; +echo "PRODUCT_PACKAGES += CarrierConfig2" >> divestos.mk; +echo "include vendor/divested-carriersettings/CarrierSettings2.mk" >> divestos.mk; +echo "endif" >> divestos.mk; +fi; fi; # #END OF ROM CHANGES diff --git a/Scripts/LineageOS-20.0/Patch.sh b/Scripts/LineageOS-20.0/Patch.sh index 34629edb..c3f32e86 100644 --- a/Scripts/LineageOS-20.0/Patch.sh +++ b/Scripts/LineageOS-20.0/Patch.sh @@ -389,7 +389,6 @@ if enterAndClear "packages/services/Telephony"; then if [ -d "$DOS_BUILD_BASE"/vendor/divested-carriersettings ]; then applyPatch "$DOS_PATCHES/android_packages_services_Telephony/0001-CC2.patch"; fi; #Runtime control of platform carrier config package (DivestOS) fi; - if enterAndClear "system/ca-certificates"; then rm -rf files; #Remove old certs cp -r "$DOS_PATCHES_COMMON/android_system_ca-certificates/files" .; #Copy the new ones into place @@ -463,7 +462,7 @@ echo 'ifneq ($(BOARD_WITHOUT_RADIO),true)' >> divestos.mk; echo "PRODUCT_PACKAGES += CarrierConfig2" >> divestos.mk; echo "include vendor/divested-carriersettings/CarrierSettings2.mk" >> divestos.mk; echo "endif" >> divestos.mk; -fi +fi; fi; # #END OF ROM CHANGES