diff --git a/Patches/LineageOS-18.1/android_packages_apps_Updater/0003-Server_Choices.patch b/Patches/LineageOS-18.1/android_packages_apps_Updater/0003-Server_Choices.patch new file mode 100644 index 00000000..048a880d --- /dev/null +++ b/Patches/LineageOS-18.1/android_packages_apps_Updater/0003-Server_Choices.patch @@ -0,0 +1,207 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tavi +Date: Sat, 18 May 2024 11:21:24 -0400 +Subject: [PATCH] Add server choices + +Change-Id: I43524f0567eabff163ce81c4a93cf145542a3d5d +Signed-off-by: Tavi +--- + AndroidManifest.xml | 3 ++- + res/layout/preferences_dialog.xml | 22 +++++++++++++++ + res/values/arrays.xml | 7 +++++ + res/values/strings.xml | 5 ++++ + res/xml/network_security_config.xml | 8 ++++++ + .../lineageos/updater/UpdatesActivity.java | 4 +++ + src/org/lineageos/updater/misc/Constants.java | 11 ++++++++ + src/org/lineageos/updater/misc/Utils.java | 27 ++++++++++++++++--- + 8 files changed, 82 insertions(+), 5 deletions(-) + create mode 100644 res/xml/network_security_config.xml + +diff --git a/AndroidManifest.xml b/AndroidManifest.xml +index 91e85a3..d953252 100644 +--- a/AndroidManifest.xml ++++ b/AndroidManifest.xml +@@ -23,7 +23,8 @@ + android:requestLegacyExternalStorage="true" + android:supportsRtl="true" + android:theme="@style/AppTheme" +- android:usesCleartextTraffic="false"> ++ android:usesCleartextTraffic="false" ++ android:networkSecurityConfig="@xml/network_security_config"> + + + + ++ ++ ++ ++ ++ ++ ++ + @string/menu_auto_updates_check_interval_weekly + @string/menu_auto_updates_check_interval_monthly + ++ ++ ++ @string/menu_server_choice_primary ++ @string/menu_server_choice_secondary ++ @string/menu_server_choice_onion_primary ++ @string/menu_server_choice_onion_secondary ++ + +diff --git a/res/values/strings.xml b/res/values/strings.xml +index 916e1e6..73f3979 100644 +--- a/res/values/strings.xml ++++ b/res/values/strings.xml +@@ -70,6 +70,11 @@ + Once a week + Once a month + Never ++ Server Choice ++ Primary ++ 0OTA_SERVER_CLEARNET_SECONDARY_NAME0 ++ Onion #1 ++ Onion #2 + Perform requests over Tor + Delete updates when installed + Delete +diff --git a/res/xml/network_security_config.xml b/res/xml/network_security_config.xml +new file mode 100644 +index 0000000..09b655b +--- /dev/null ++++ b/res/xml/network_security_config.xml +@@ -0,0 +1,8 @@ ++ ++ ++ ++ 0OTA_SERVER_ONION_DOMAIN_PRIMARY0 ++ 0OTA_SERVER_ONION_DOMAIN_SECONDARY0 ++ ++ ++ +diff --git a/src/org/lineageos/updater/UpdatesActivity.java b/src/org/lineageos/updater/UpdatesActivity.java +index 7fddc87..76db22a 100644 +--- a/src/org/lineageos/updater/UpdatesActivity.java ++++ b/src/org/lineageos/updater/UpdatesActivity.java +@@ -448,6 +448,7 @@ public class UpdatesActivity extends UpdatesListActivity { + private void showPreferencesDialog() { + View view = LayoutInflater.from(this).inflate(R.layout.preferences_dialog, null); + Spinner autoCheckInterval = view.findViewById(R.id.preferences_auto_updates_check_interval); ++ Spinner serverChoice = view.findViewById(R.id.preferences_server_choice); + SwitchCompat onionRouting = view.findViewById(R.id.preferences_onion_routing); + SwitchCompat autoDelete = view.findViewById(R.id.preferences_auto_delete_updates); + SwitchCompat dataWarning = view.findViewById(R.id.preferences_mobile_data_warning); +@@ -460,6 +461,7 @@ public class UpdatesActivity extends UpdatesListActivity { + + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); + autoCheckInterval.setSelection(Utils.getUpdateCheckSetting(this)); ++ serverChoice.setSelection(Utils.getServerChoiceSetting(this)); + onionRouting.setChecked(prefs.getBoolean(Constants.PREF_ONION_ROUTING, false)); + autoDelete.setChecked(prefs.getBoolean(Constants.PREF_AUTO_DELETE_UPDATES, false)); + dataWarning.setChecked(prefs.getBoolean(Constants.PREF_MOBILE_DATA_WARNING, true)); +@@ -500,6 +502,8 @@ public class UpdatesActivity extends UpdatesListActivity { + prefs.edit() + .putInt(Constants.PREF_AUTO_UPDATES_CHECK_INTERVAL, + autoCheckInterval.getSelectedItemPosition()) ++ .putInt(Constants.PREF_SERVER_CHOICE, ++ serverChoice.getSelectedItemPosition()) + .putBoolean(Constants.PREF_ONION_ROUTING, + onionRouting.isChecked() && Utils.isOrbotInstalled(getApplicationContext())) + .putBoolean(Constants.PREF_AUTO_DELETE_UPDATES, autoDelete.isChecked()) +diff --git a/src/org/lineageos/updater/misc/Constants.java b/src/org/lineageos/updater/misc/Constants.java +index 37e81d8..d6f22d2 100644 +--- a/src/org/lineageos/updater/misc/Constants.java ++++ b/src/org/lineageos/updater/misc/Constants.java +@@ -28,8 +28,19 @@ public final class Constants { + public static final int AUTO_UPDATES_CHECK_INTERVAL_WEEKLY = 2; + public static final int AUTO_UPDATES_CHECK_INTERVAL_MONTHLY = 3; + ++ public static final int PREF_SERVER_CHOICE_PRIMARY = 0; ++ public static final int PREF_SERVER_CHOICE_SECONDARY = 1; ++ public static final int PREF_SERVER_CHOICE_ONION_PRIMARY = 2; ++ public static final int PREF_SERVER_CHOICE_ONION_SECONDARY = 3; ++ ++ public static final String PREF_SERVER_CHOICE_PRIMARY_ACTUAL = "0OTA_SERVER_CLEARNET_PRIMARY0"; ++ public static final String PREF_SERVER_CHOICE_SECONDARY_ACTUAL = "0OTA_SERVER_CLEARNET_SECONDARY0"; ++ public static final String PREF_SERVER_CHOICE_ONION_PRIMARY_ACTUAL = "0OTA_SERVER_ONION_PRIMARY0"; ++ public static final String PREF_SERVER_CHOICE_ONION_SECONDARY_ACTUAL = "0OTA_SERVER_ONION_SECONDARY0"; ++ + public static final String PREF_LAST_UPDATE_CHECK = "last_update_check"; + public static final String PREF_AUTO_UPDATES_CHECK_INTERVAL = "auto_updates_check_interval"; ++ public static final String PREF_SERVER_CHOICE = "server_choice"; + public static final String PREF_ONION_ROUTING = "onion_routing"; + public static final String PREF_AUTO_DELETE_UPDATES = "auto_delete_updates"; + public static final String PREF_AB_PERF_MODE = "ab_perf_mode"; +diff --git a/src/org/lineageos/updater/misc/Utils.java b/src/org/lineageos/updater/misc/Utils.java +index 2b42726..1577b3d 100644 +--- a/src/org/lineageos/updater/misc/Utils.java ++++ b/src/org/lineageos/updater/misc/Utils.java +@@ -210,14 +210,33 @@ public class Utils { + return listening; + } + ++ public static int getServerChoiceSetting(Context context) { ++ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); ++ return preferences.getInt(Constants.PREF_SERVER_CHOICE, ++ Constants.PREF_SERVER_CHOICE_PRIMARY); ++ } ++ ++ public static String getServerBaseUrl(Context context) { ++ switch (Utils.getServerChoiceSetting(context)) { ++ case Constants.PREF_SERVER_CHOICE_PRIMARY: ++ default: ++ return Constants.PREF_SERVER_CHOICE_PRIMARY_ACTUAL; ++ case Constants.PREF_SERVER_CHOICE_SECONDARY: ++ return Constants.PREF_SERVER_CHOICE_SECONDARY_ACTUAL; ++ case Constants.PREF_SERVER_CHOICE_ONION_PRIMARY: ++ return Constants.PREF_SERVER_CHOICE_ONION_PRIMARY_ACTUAL; ++ case Constants.PREF_SERVER_CHOICE_ONION_SECONDARY: ++ return Constants.PREF_SERVER_CHOICE_ONION_SECONDARY_ACTUAL; ++ } ++ } ++ + public static String getServerURL(Context context) { + String incrementalVersion = SystemProperties.get(Constants.PROP_BUILD_VERSION_INCREMENTAL); + String device = SystemProperties.get(Constants.PROP_NEXT_DEVICE, + SystemProperties.get(Constants.PROP_DEVICE)); +- String server = "0OTA_SERVER_CLEARNET0"; +- String serverOnion = "0OTA_SERVER_ONION0"; +- if(serverOnion.toLowerCase().startsWith("http") && isOnionRoutingEnabled(context)) { +- server = serverOnion; ++ String server = getServerBaseUrl(context); ++ if (!isOnionRoutingEnabled(context) && server.toLowerCase().startsWith("http://") && server.toLowerCase().contains(".onion/")) { ++ server = Constants.PREF_SERVER_CHOICE_PRIMARY_ACTUAL; + } + + return server + "?base=LineageOS&device=" + device + "&inc=" + incrementalVersion; diff --git a/Patches/LineageOS-19.1/android_packages_apps_Updater/0003-Server_Choices.patch b/Patches/LineageOS-19.1/android_packages_apps_Updater/0003-Server_Choices.patch new file mode 100644 index 00000000..5fb30ffe --- /dev/null +++ b/Patches/LineageOS-19.1/android_packages_apps_Updater/0003-Server_Choices.patch @@ -0,0 +1,207 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tavi +Date: Sat, 18 May 2024 11:21:24 -0400 +Subject: [PATCH] Add server choices + +Change-Id: I43524f0567eabff163ce81c4a93cf145542a3d5d +Signed-off-by: Tavi +--- + AndroidManifest.xml | 3 ++- + res/layout/preferences_dialog.xml | 22 +++++++++++++++ + res/values/arrays.xml | 7 +++++ + res/values/strings.xml | 5 ++++ + res/xml/network_security_config.xml | 8 ++++++ + .../lineageos/updater/UpdatesActivity.java | 4 +++ + src/org/lineageos/updater/misc/Constants.java | 11 ++++++++ + src/org/lineageos/updater/misc/Utils.java | 27 ++++++++++++++++--- + 8 files changed, 82 insertions(+), 5 deletions(-) + create mode 100644 res/xml/network_security_config.xml + +diff --git a/AndroidManifest.xml b/AndroidManifest.xml +index 91e85a3..d953252 100644 +--- a/AndroidManifest.xml ++++ b/AndroidManifest.xml +@@ -23,7 +23,8 @@ + android:requestLegacyExternalStorage="true" + android:supportsRtl="true" + android:theme="@style/AppTheme" +- android:usesCleartextTraffic="false"> ++ android:usesCleartextTraffic="false" ++ android:networkSecurityConfig="@xml/network_security_config"> + + + + ++ ++ ++ ++ ++ ++ ++ + @string/menu_auto_updates_check_interval_weekly + @string/menu_auto_updates_check_interval_monthly + ++ ++ ++ @string/menu_server_choice_primary ++ @string/menu_server_choice_secondary ++ @string/menu_server_choice_onion_primary ++ @string/menu_server_choice_onion_secondary ++ + +diff --git a/res/values/strings.xml b/res/values/strings.xml +index 916e1e6..73f3979 100644 +--- a/res/values/strings.xml ++++ b/res/values/strings.xml +@@ -70,6 +70,11 @@ + Once a week + Once a month + Never ++ Server Choice ++ Primary ++ 0OTA_SERVER_CLEARNET_SECONDARY_NAME0 ++ Onion #1 ++ Onion #2 + Perform requests over Tor + Delete updates when installed + Delete +diff --git a/res/xml/network_security_config.xml b/res/xml/network_security_config.xml +new file mode 100644 +index 0000000..09b655b +--- /dev/null ++++ b/res/xml/network_security_config.xml +@@ -0,0 +1,8 @@ ++ ++ ++ ++ 0OTA_SERVER_ONION_DOMAIN_PRIMARY0 ++ 0OTA_SERVER_ONION_DOMAIN_SECONDARY0 ++ ++ ++ +diff --git a/src/org/lineageos/updater/UpdatesActivity.java b/src/org/lineageos/updater/UpdatesActivity.java +index 766fb83..6afd4ca 100644 +--- a/src/org/lineageos/updater/UpdatesActivity.java ++++ b/src/org/lineageos/updater/UpdatesActivity.java +@@ -484,6 +484,7 @@ public class UpdatesActivity extends UpdatesListActivity { + private void showPreferencesDialog() { + View view = LayoutInflater.from(this).inflate(R.layout.preferences_dialog, null); + Spinner autoCheckInterval = view.findViewById(R.id.preferences_auto_updates_check_interval); ++ Spinner serverChoice = view.findViewById(R.id.preferences_server_choice); + SwitchCompat onionRouting = view.findViewById(R.id.preferences_onion_routing); + SwitchCompat autoDelete = view.findViewById(R.id.preferences_auto_delete_updates); + SwitchCompat dataWarning = view.findViewById(R.id.preferences_mobile_data_warning); +@@ -496,6 +497,7 @@ public class UpdatesActivity extends UpdatesListActivity { + + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); + autoCheckInterval.setSelection(Utils.getUpdateCheckSetting(this)); ++ serverChoice.setSelection(Utils.getServerChoiceSetting(this)); + onionRouting.setChecked(prefs.getBoolean(Constants.PREF_ONION_ROUTING, false)); + autoDelete.setChecked(prefs.getBoolean(Constants.PREF_AUTO_DELETE_UPDATES, false)); + dataWarning.setChecked(prefs.getBoolean(Constants.PREF_MOBILE_DATA_WARNING, true)); +@@ -536,6 +538,8 @@ public class UpdatesActivity extends UpdatesListActivity { + prefs.edit() + .putInt(Constants.PREF_AUTO_UPDATES_CHECK_INTERVAL, + autoCheckInterval.getSelectedItemPosition()) ++ .putInt(Constants.PREF_SERVER_CHOICE, ++ serverChoice.getSelectedItemPosition()) + .putBoolean(Constants.PREF_ONION_ROUTING, + onionRouting.isChecked() && Utils.isOrbotInstalled(getApplicationContext())) + .putBoolean(Constants.PREF_AUTO_DELETE_UPDATES, autoDelete.isChecked()) +diff --git a/src/org/lineageos/updater/misc/Constants.java b/src/org/lineageos/updater/misc/Constants.java +index 37e81d8..d6f22d2 100644 +--- a/src/org/lineageos/updater/misc/Constants.java ++++ b/src/org/lineageos/updater/misc/Constants.java +@@ -28,8 +28,19 @@ public final class Constants { + public static final int AUTO_UPDATES_CHECK_INTERVAL_WEEKLY = 2; + public static final int AUTO_UPDATES_CHECK_INTERVAL_MONTHLY = 3; + ++ public static final int PREF_SERVER_CHOICE_PRIMARY = 0; ++ public static final int PREF_SERVER_CHOICE_SECONDARY = 1; ++ public static final int PREF_SERVER_CHOICE_ONION_PRIMARY = 2; ++ public static final int PREF_SERVER_CHOICE_ONION_SECONDARY = 3; ++ ++ public static final String PREF_SERVER_CHOICE_PRIMARY_ACTUAL = "0OTA_SERVER_CLEARNET_PRIMARY0"; ++ public static final String PREF_SERVER_CHOICE_SECONDARY_ACTUAL = "0OTA_SERVER_CLEARNET_SECONDARY0"; ++ public static final String PREF_SERVER_CHOICE_ONION_PRIMARY_ACTUAL = "0OTA_SERVER_ONION_PRIMARY0"; ++ public static final String PREF_SERVER_CHOICE_ONION_SECONDARY_ACTUAL = "0OTA_SERVER_ONION_SECONDARY0"; ++ + public static final String PREF_LAST_UPDATE_CHECK = "last_update_check"; + public static final String PREF_AUTO_UPDATES_CHECK_INTERVAL = "auto_updates_check_interval"; ++ public static final String PREF_SERVER_CHOICE = "server_choice"; + public static final String PREF_ONION_ROUTING = "onion_routing"; + public static final String PREF_AUTO_DELETE_UPDATES = "auto_delete_updates"; + public static final String PREF_AB_PERF_MODE = "ab_perf_mode"; +diff --git a/src/org/lineageos/updater/misc/Utils.java b/src/org/lineageos/updater/misc/Utils.java +index 2b42726..7ba5f48 100644 +--- a/src/org/lineageos/updater/misc/Utils.java ++++ b/src/org/lineageos/updater/misc/Utils.java +@@ -210,14 +210,33 @@ public class Utils { + return listening; + } + ++ public static int getServerChoiceSetting(Context context) { ++ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); ++ return preferences.getInt(Constants.PREF_SERVER_CHOICE, ++ Constants.PREF_SERVER_CHOICE_PRIMARY); ++ } ++ ++ public static String getServerBaseUrl(Context context) { ++ switch (Utils.getServerChoiceSetting(context)) { ++ case Constants.PREF_SERVER_CHOICE_PRIMARY: ++ default: ++ return Constants.PREF_SERVER_CHOICE_PRIMARY_ACTUAL; ++ case Constants.PREF_SERVER_CHOICE_SECONDARY: ++ return Constants.PREF_SERVER_CHOICE_SECONDARY_ACTUAL; ++ case Constants.PREF_SERVER_CHOICE_ONION_PRIMARY: ++ return Constants.PREF_SERVER_CHOICE_ONION_PRIMARY_ACTUAL; ++ case Constants.PREF_SERVER_CHOICE_ONION_SECONDARY: ++ return Constants.PREF_SERVER_CHOICE_ONION_SECONDARY_ACTUAL; ++ } ++ } ++ + public static String getServerURL(Context context) { + String incrementalVersion = SystemProperties.get(Constants.PROP_BUILD_VERSION_INCREMENTAL); + String device = SystemProperties.get(Constants.PROP_NEXT_DEVICE, + SystemProperties.get(Constants.PROP_DEVICE)); +- String server = "0OTA_SERVER_CLEARNET0"; +- String serverOnion = "0OTA_SERVER_ONION0"; +- if(serverOnion.toLowerCase().startsWith("http") && isOnionRoutingEnabled(context)) { +- server = serverOnion; ++ String server = getServerBaseUrl(context); ++ if (!isOnionRoutingEnabled(context) && server.toLowerCase().startsWith("http://") && server.toLowerCase().contains(".onion/")) { ++ server = Constants.PREF_SERVER_CHOICE_PRIMARY_ACTUAL; + } + + return server + "?base=LineageOS&device=" + device + "&inc=" + incrementalVersion; diff --git a/Patches/LineageOS-20.0/android_packages_apps_Updater/0003-Server_Choices.patch b/Patches/LineageOS-20.0/android_packages_apps_Updater/0003-Server_Choices.patch index dde5915d..47806792 100644 --- a/Patches/LineageOS-20.0/android_packages_apps_Updater/0003-Server_Choices.patch +++ b/Patches/LineageOS-20.0/android_packages_apps_Updater/0003-Server_Choices.patch @@ -104,7 +104,7 @@ index 3d4aab9..28c8fe5 100644 + default: + return Constants.PREF_SERVER_CHOICE_PRIMARY_ACTUAL; + case Constants.PREF_SERVER_CHOICE_SECONDARY: -+ return Constants.PREF_SERVER_CHOICE_PRIMARY_ACTUAL; ++ return Constants.PREF_SERVER_CHOICE_SECONDARY_ACTUAL; + case Constants.PREF_SERVER_CHOICE_ONION_PRIMARY: + return Constants.PREF_SERVER_CHOICE_ONION_PRIMARY_ACTUAL; + case Constants.PREF_SERVER_CHOICE_ONION_SECONDARY: diff --git a/Scripts/LineageOS-18.1/Patch.sh b/Scripts/LineageOS-18.1/Patch.sh index aa8b7b64..c8dca053 100644 --- a/Scripts/LineageOS-18.1/Patch.sh +++ b/Scripts/LineageOS-18.1/Patch.sh @@ -381,6 +381,7 @@ fi; if enterAndClear "packages/apps/Updater"; then applyPatch "$DOS_PATCHES/android_packages_apps_Updater/0001-Server.patch"; #Switch to our server (DivestOS) applyPatch "$DOS_PATCHES/android_packages_apps_Updater/0002-Tor_Support.patch"; #Add Tor support (DivestOS) +if [ "$DOS_OTA_SERVER_EXTENDED" = true ]; then applyPatch "$DOS_PATCHES/android_packages_apps_Updater/0003-Server_Choices.patch"; fi; #Add server choices (DivestOS) applyPatch "$DOS_PATCHES/android_packages_apps_Updater/330099.patch"; #Add prop for allowing major updates (erfanoabdi) sed -i 's/PROP_BUILD_VERSION_INCREMENTAL);/PROP_BUILD_VERSION_INCREMENTAL).replaceAll("\\\\.", "");/' src/org/lineageos/updater/misc/Utils.java; #Remove periods from incremental version #TODO: Remove changelog diff --git a/Scripts/LineageOS-18.1/Rebrand.sh b/Scripts/LineageOS-18.1/Rebrand.sh index d481739a..b4c0a4b7 100644 --- a/Scripts/LineageOS-18.1/Rebrand.sh +++ b/Scripts/LineageOS-18.1/Rebrand.sh @@ -76,8 +76,20 @@ sed -i '/.*update_recovery/s/Lineage/'"$DOS_BRANDING_NAME"'/g' res/values*/strin fi; if enter "packages/apps/Updater"; then -sed -i 's|0OTA_SERVER_CLEARNET0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java; -sed -i 's|0OTA_SERVER_ONION0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java; +if [ "$DOS_OTA_SERVER_EXTENDED" = true ]; then + sed -i 's|0OTA_SERVER_CLEARNET_PRIMARY0|'"$DOS_OTA_SERVER_PRIMARY"'|' src/org/lineageos/updater/misc/Constants.java; + sed -i 's|0OTA_SERVER_CLEARNET_SECONDARY0|'"$DOS_OTA_SERVER_SECONDARY"'|' src/org/lineageos/updater/misc/Constants.java; + sed -i 's|0OTA_SERVER_ONION_PRIMARY0|'"$DOS_OTA_SERVER_ONION_PRIMARY"'|' src/org/lineageos/updater/misc/Constants.java; + sed -i 's|0OTA_SERVER_ONION_SECONDARY0|'"$DOS_OTA_SERVER_ONION_SECONDARY"'|' src/org/lineageos/updater/misc/Constants.java; + + sed -i 's|0OTA_SERVER_CLEARNET_SECONDARY_NAME0|'"$DOS_OTA_SERVER_SECONDARY_NAME"'|' res/values/strings.xml; + + sed -i 's|0OTA_SERVER_ONION_DOMAIN_PRIMARY0|'"$DOS_OTA_SERVER_ONION_DOMAIN_PRIMARY"'|' res/xml/network_security_config.xml; + sed -i 's|0OTA_SERVER_ONION_DOMAIN_SECONDARY0|'"$DOS_OTA_SERVER_ONION_DOMAIN_SECONDARY"'|' res/xml/network_security_config.xml; +else + sed -i 's|0OTA_SERVER_CLEARNET0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java; + sed -i 's|0OTA_SERVER_ONION0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java; +fi; sed -i 's|>LineageOS|>'"$DOS_BRANDING_NAME"'|' res/values*/strings.xml; sed -i '/.*toast_forced_update_recovery/s/Lineage/'"$DOS_BRANDING_NAME"'/g' res/values*/strings.xml; sed -i '/.*info_dialog_message/s/Lineage/'"$DOS_BRANDING_NAME"'/g' res/values*/strings.xml; diff --git a/Scripts/LineageOS-19.1/Patch.sh b/Scripts/LineageOS-19.1/Patch.sh index fe408918..29296966 100644 --- a/Scripts/LineageOS-19.1/Patch.sh +++ b/Scripts/LineageOS-19.1/Patch.sh @@ -345,6 +345,7 @@ fi; if enterAndClear "packages/apps/Updater"; then applyPatch "$DOS_PATCHES/android_packages_apps_Updater/0001-Server.patch"; #Switch to our server (DivestOS) applyPatch "$DOS_PATCHES/android_packages_apps_Updater/0002-Tor_Support.patch"; #Add Tor support (DivestOS) +if [ "$DOS_OTA_SERVER_EXTENDED" = true ]; then applyPatch "$DOS_PATCHES/android_packages_apps_Updater/0003-Server_Choices.patch"; fi; #Add server choices (DivestOS) sed -i 's/PROP_BUILD_VERSION_INCREMENTAL);/PROP_BUILD_VERSION_INCREMENTAL).replaceAll("\\\\.", "");/' src/org/lineageos/updater/misc/Utils.java; #Remove periods from incremental version #TODO: Remove changelog fi; diff --git a/Scripts/LineageOS-19.1/Rebrand.sh b/Scripts/LineageOS-19.1/Rebrand.sh index 3191a4be..8ad85351 100644 --- a/Scripts/LineageOS-19.1/Rebrand.sh +++ b/Scripts/LineageOS-19.1/Rebrand.sh @@ -76,8 +76,20 @@ sed -i '/.*update_recovery/s/Lineage/'"$DOS_BRANDING_NAME"'/g' res/values*/strin fi; if enter "packages/apps/Updater"; then -sed -i 's|0OTA_SERVER_CLEARNET0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java; -sed -i 's|0OTA_SERVER_ONION0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java; +if [ "$DOS_OTA_SERVER_EXTENDED" = true ]; then + sed -i 's|0OTA_SERVER_CLEARNET_PRIMARY0|'"$DOS_OTA_SERVER_PRIMARY"'|' src/org/lineageos/updater/misc/Constants.java; + sed -i 's|0OTA_SERVER_CLEARNET_SECONDARY0|'"$DOS_OTA_SERVER_SECONDARY"'|' src/org/lineageos/updater/misc/Constants.java; + sed -i 's|0OTA_SERVER_ONION_PRIMARY0|'"$DOS_OTA_SERVER_ONION_PRIMARY"'|' src/org/lineageos/updater/misc/Constants.java; + sed -i 's|0OTA_SERVER_ONION_SECONDARY0|'"$DOS_OTA_SERVER_ONION_SECONDARY"'|' src/org/lineageos/updater/misc/Constants.java; + + sed -i 's|0OTA_SERVER_CLEARNET_SECONDARY_NAME0|'"$DOS_OTA_SERVER_SECONDARY_NAME"'|' res/values/strings.xml; + + sed -i 's|0OTA_SERVER_ONION_DOMAIN_PRIMARY0|'"$DOS_OTA_SERVER_ONION_DOMAIN_PRIMARY"'|' res/xml/network_security_config.xml; + sed -i 's|0OTA_SERVER_ONION_DOMAIN_SECONDARY0|'"$DOS_OTA_SERVER_ONION_DOMAIN_SECONDARY"'|' res/xml/network_security_config.xml; +else + sed -i 's|0OTA_SERVER_CLEARNET0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java; + sed -i 's|0OTA_SERVER_ONION0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java; +fi; sed -i 's|>LineageOS|>'"$DOS_BRANDING_NAME"'|' res/values*/strings.xml; sed -i '/.*toast_forced_update_recovery/s/Lineage/'"$DOS_BRANDING_NAME"'/g' res/values*/strings.xml; sed -i '/.*info_dialog_message/s/Lineage/'"$DOS_BRANDING_NAME"'/g' res/values*/strings.xml;