diff --git a/Patches/LineageOS-18.1/android_packages_apps_Updater/0001-Server.patch b/Patches/LineageOS-18.1/android_packages_apps_Updater/0001-Server.patch
index 63e4e465..374e514a 100644
--- a/Patches/LineageOS-18.1/android_packages_apps_Updater/0001-Server.patch
+++ b/Patches/LineageOS-18.1/android_packages_apps_Updater/0001-Server.patch
@@ -9,10 +9,10 @@ Change-Id: I26dc2942736cf0cfe4e7b92ddfdd04b9d74dbae5
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/src/org/lineageos/updater/misc/Utils.java b/src/org/lineageos/updater/misc/Utils.java
-index 0aa5fd5..0b41c25 100644
+index 79ded8f..69a5252 100644
--- a/src/org/lineageos/updater/misc/Utils.java
+++ b/src/org/lineageos/updater/misc/Utils.java
-@@ -154,16 +154,9 @@ public class Utils {
+@@ -153,16 +153,9 @@ public class Utils {
String incrementalVersion = SystemProperties.get(Constants.PROP_BUILD_VERSION_INCREMENTAL);
String device = SystemProperties.get(Constants.PROP_NEXT_DEVICE,
SystemProperties.get(Constants.PROP_DEVICE));
diff --git a/Patches/LineageOS-18.1/android_packages_apps_Updater/0002-Tor_Support.patch b/Patches/LineageOS-18.1/android_packages_apps_Updater/0002-Tor_Support.patch
index 3cea4d68..6162627e 100644
--- a/Patches/LineageOS-18.1/android_packages_apps_Updater/0002-Tor_Support.patch
+++ b/Patches/LineageOS-18.1/android_packages_apps_Updater/0002-Tor_Support.patch
@@ -18,12 +18,12 @@ Change-Id: Ibfe080c3d801af34fb64fda1b6b8f4f39a2b1ccf
10 files changed, 134 insertions(+), 5 deletions(-)
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
-index d4d24c0..cb74219 100644
+index 693ded4..91e85a3 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -12,6 +12,10 @@
+
-
+
+
@@ -33,14 +33,14 @@ index d4d24c0..cb74219 100644
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
diff --git a/res/layout/preferences_dialog.xml b/res/layout/preferences_dialog.xml
-index d78f873..389f99b 100644
+index c586f44..b1536ea 100644
--- a/res/layout/preferences_dialog.xml
+++ b/res/layout/preferences_dialog.xml
@@ -29,6 +29,14 @@
android:entries="@array/menu_auto_updates_check_interval_entries" />
-+
+
- This update can\'t be installed on top of the current build.
diff --git a/src/org/lineageos/updater/UpdatesActivity.java b/src/org/lineageos/updater/UpdatesActivity.java
-index 32d31f9..43bf475 100644
+index 395e801..7fddc87 100644
--- a/src/org/lineageos/updater/UpdatesActivity.java
+++ b/src/org/lineageos/updater/UpdatesActivity.java
-@@ -372,10 +372,14 @@ public class UpdatesActivity extends UpdatesListActivity {
+@@ -361,10 +361,14 @@ public class UpdatesActivity extends UpdatesListActivity {
final DownloadClient downloadClient;
try {
@@ -90,15 +90,15 @@ index 32d31f9..43bf475 100644
.build();
} catch (IOException exception) {
Log.e(TAG, "Could not build download client");
-@@ -455,6 +459,7 @@ public class UpdatesActivity extends UpdatesListActivity {
+@@ -444,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);
-+ Switch onionRouting = view.findViewById(R.id.preferences_onion_routing);
- Switch autoDelete = view.findViewById(R.id.preferences_auto_delete_updates);
- Switch dataWarning = view.findViewById(R.id.preferences_mobile_data_warning);
- Switch abPerfMode = view.findViewById(R.id.preferences_ab_perf_mode);
-@@ -466,6 +471,7 @@ public class UpdatesActivity extends UpdatesListActivity {
+ Spinner autoCheckInterval = view.findViewById(R.id.preferences_auto_updates_check_interval);
++ 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);
+ SwitchCompat abPerfMode = view.findViewById(R.id.preferences_ab_perf_mode);
+@@ -455,6 +460,7 @@ public class UpdatesActivity extends UpdatesListActivity {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
autoCheckInterval.setSelection(Utils.getUpdateCheckSetting(this));
@@ -106,16 +106,16 @@ index 32d31f9..43bf475 100644
autoDelete.setChecked(prefs.getBoolean(Constants.PREF_AUTO_DELETE_UPDATES, false));
dataWarning.setChecked(prefs.getBoolean(Constants.PREF_MOBILE_DATA_WARNING, true));
abPerfMode.setChecked(prefs.getBoolean(Constants.PREF_AB_PERF_MODE, false));
-@@ -505,6 +511,8 @@ public class UpdatesActivity extends UpdatesListActivity {
+@@ -494,6 +500,8 @@ public class UpdatesActivity extends UpdatesListActivity {
prefs.edit()
.putInt(Constants.PREF_AUTO_UPDATES_CHECK_INTERVAL,
autoCheckInterval.getSelectedItemPosition())
+ .putBoolean(Constants.PREF_ONION_ROUTING,
+ onionRouting.isChecked() && Utils.isOrbotInstalled(getApplicationContext()))
- .putBoolean(Constants.PREF_AUTO_DELETE_UPDATES,
- autoDelete.isChecked())
- .putBoolean(Constants.PREF_MOBILE_DATA_WARNING,
-@@ -520,6 +528,10 @@ public class UpdatesActivity extends UpdatesListActivity {
+ .putBoolean(Constants.PREF_AUTO_DELETE_UPDATES, autoDelete.isChecked())
+ .putBoolean(Constants.PREF_MOBILE_DATA_WARNING, dataWarning.isChecked())
+ .putBoolean(Constants.PREF_AB_PERF_MODE, abPerfMode.isChecked())
+@@ -506,6 +514,10 @@ public class UpdatesActivity extends UpdatesListActivity {
UpdatesCheckReceiver.cancelUpdatesCheck(this);
}
@@ -127,7 +127,7 @@ index 32d31f9..43bf475 100644
boolean enableABPerfMode = abPerfMode.isChecked();
mUpdaterService.getUpdaterController().setPerformanceMode(enableABPerfMode);
diff --git a/src/org/lineageos/updater/UpdatesCheckReceiver.java b/src/org/lineageos/updater/UpdatesCheckReceiver.java
-index 288cd1a..5769a21 100644
+index 7fa9cd5..962fd00 100644
--- a/src/org/lineageos/updater/UpdatesCheckReceiver.java
+++ b/src/org/lineageos/updater/UpdatesCheckReceiver.java
@@ -110,10 +110,14 @@ public class UpdatesCheckReceiver extends BroadcastReceiver {
@@ -146,10 +146,10 @@ index 288cd1a..5769a21 100644
downloadClient.start();
} catch (IOException e) {
diff --git a/src/org/lineageos/updater/controller/UpdaterController.java b/src/org/lineageos/updater/controller/UpdaterController.java
-index 62f8ca7..07f9a61 100644
+index 5d7d51a..7ac5f5b 100644
--- a/src/org/lineageos/updater/controller/UpdaterController.java
+++ b/src/org/lineageos/updater/controller/UpdaterController.java
-@@ -358,12 +358,16 @@ public class UpdaterController {
+@@ -374,12 +374,16 @@ public class UpdaterController {
update.setFile(destination);
DownloadClient downloadClient;
try {
@@ -166,7 +166,7 @@ index 62f8ca7..07f9a61 100644
.build();
} catch (IOException exception) {
Log.e(TAG, "Could not build download client");
-@@ -398,6 +402,9 @@ public class UpdaterController {
+@@ -419,6 +423,9 @@ public class UpdaterController {
verifyUpdateAsync(downloadId);
notifyUpdateChange(downloadId);
} else {
@@ -176,7 +176,7 @@ index 62f8ca7..07f9a61 100644
DownloadClient downloadClient;
try {
downloadClient = new DownloadClient.Builder()
-@@ -406,6 +413,7 @@ public class UpdaterController {
+@@ -427,6 +434,7 @@ public class UpdaterController {
.setDownloadCallback(getDownloadCallback(downloadId))
.setProgressListener(getProgressListener(downloadId))
.setUseDuplicateLinks(true)
@@ -185,10 +185,10 @@ index 62f8ca7..07f9a61 100644
} catch (IOException exception) {
Log.e(TAG, "Could not build download client");
diff --git a/src/org/lineageos/updater/download/DownloadClient.java b/src/org/lineageos/updater/download/DownloadClient.java
-index 6a2a490..374e017 100644
+index 3494947..7a7f7cf 100644
--- a/src/org/lineageos/updater/download/DownloadClient.java
+++ b/src/org/lineageos/updater/download/DownloadClient.java
-@@ -64,6 +64,7 @@ public interface DownloadClient {
+@@ -60,6 +60,7 @@ public interface DownloadClient {
private DownloadClient.DownloadCallback mCallback;
private DownloadClient.ProgressListener mProgressListener;
private boolean mUseDuplicateLinks;
@@ -196,7 +196,7 @@ index 6a2a490..374e017 100644
public DownloadClient build() throws IOException {
if (mUrl == null) {
-@@ -74,7 +75,7 @@ public interface DownloadClient {
+@@ -70,7 +71,7 @@ public interface DownloadClient {
throw new IllegalStateException("No download callback defined");
}
return new HttpURLConnectionClient(mUrl, mDestination, mProgressListener, mCallback,
@@ -205,7 +205,7 @@ index 6a2a490..374e017 100644
}
public Builder setUrl(String url) {
-@@ -101,5 +102,10 @@ public interface DownloadClient {
+@@ -97,5 +98,10 @@ public interface DownloadClient {
mUseDuplicateLinks = useDuplicateLinks;
return this;
}
@@ -217,7 +217,7 @@ index 6a2a490..374e017 100644
}
}
diff --git a/src/org/lineageos/updater/download/HttpURLConnectionClient.java b/src/org/lineageos/updater/download/HttpURLConnectionClient.java
-index 2b7c80e..caeaf66 100644
+index b9c4b5d..b94fff0 100644
--- a/src/org/lineageos/updater/download/HttpURLConnectionClient.java
+++ b/src/org/lineageos/updater/download/HttpURLConnectionClient.java
@@ -18,12 +18,16 @@ package org.lineageos.updater.download;
@@ -245,7 +245,7 @@ index 2b7c80e..caeaf66 100644
private DownloadThread mDownloadThread;
-@@ -60,8 +65,14 @@ public class HttpURLConnectionClient implements DownloadClient {
+@@ -56,8 +61,14 @@ public class HttpURLConnectionClient implements DownloadClient {
HttpURLConnectionClient(String url, File destination,
DownloadClient.ProgressListener progressListener,
DownloadClient.DownloadCallback callback,
@@ -262,7 +262,7 @@ index 2b7c80e..caeaf66 100644
mDestination = destination;
mProgressListener = progressListener;
mCallback = callback;
-@@ -169,7 +180,12 @@ public class HttpURLConnectionClient implements DownloadClient {
+@@ -177,7 +188,12 @@ public class HttpURLConnectionClient implements DownloadClient {
private void changeClientUrl(URL newUrl) throws IOException {
String range = mClient.getRequestProperty("Range");
mClient.disconnect();
@@ -276,7 +276,7 @@ index 2b7c80e..caeaf66 100644
if (range != null) {
mClient.setRequestProperty("Range", range);
}
-@@ -224,7 +240,7 @@ public class HttpURLConnectionClient implements DownloadClient {
+@@ -232,7 +248,7 @@ public class HttpURLConnectionClient implements DownloadClient {
}
Log.d(TAG, "Downloading from " + newUrl);
changeClientUrl(url);
@@ -285,9 +285,9 @@ index 2b7c80e..caeaf66 100644
mClient.connect();
if (!isSuccessCode(mClient.getResponseCode())) {
throw new IOException("Server replied with " + mClient.getResponseCode());
-@@ -246,6 +262,9 @@ public class HttpURLConnectionClient implements DownloadClient {
- @Override
+@@ -257,6 +273,9 @@ public class HttpURLConnectionClient implements DownloadClient {
public void run() {
+ boolean justResumed = false;
try {
+ if(mUseOnionRouting) {
+ Utils.waitUntilOrbotIsAvailable();
@@ -296,7 +296,7 @@ index 2b7c80e..caeaf66 100644
mClient.connect();
int responseCode = mClient.getResponseCode();
diff --git a/src/org/lineageos/updater/misc/Constants.java b/src/org/lineageos/updater/misc/Constants.java
-index 0597eab..ea162e2 100644
+index 6144ed7..37e81d8 100644
--- a/src/org/lineageos/updater/misc/Constants.java
+++ b/src/org/lineageos/updater/misc/Constants.java
@@ -30,6 +30,7 @@ public final class Constants {
@@ -308,10 +308,10 @@ index 0597eab..ea162e2 100644
public static final String PREF_AB_PERF_MODE = "ab_perf_mode";
public static final String PREF_MOBILE_DATA_WARNING = "pref_mobile_data_warning";
diff --git a/src/org/lineageos/updater/misc/Utils.java b/src/org/lineageos/updater/misc/Utils.java
-index 0b41c25..022f549 100644
+index 69a5252..2b42726 100644
--- a/src/org/lineageos/updater/misc/Utils.java
+++ b/src/org/lineageos/updater/misc/Utils.java
-@@ -45,6 +45,7 @@ import java.io.BufferedReader;
+@@ -44,6 +44,7 @@ import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
@@ -319,7 +319,7 @@ index 0b41c25..022f549 100644
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;
-@@ -150,11 +151,75 @@ public class Utils {
+@@ -149,11 +150,75 @@ public class Utils {
return updates;
}
diff --git a/Scripts/LineageOS-18.1/Rebrand.sh b/Scripts/LineageOS-18.1/Rebrand.sh
index 215ab98d..a97e783b 100644
--- a/Scripts/LineageOS-18.1/Rebrand.sh
+++ b/Scripts/LineageOS-18.1/Rebrand.sh
@@ -80,6 +80,7 @@ sed -i 's|0OTA_SERVER_CLEARNET0|'"$DOS_BRANDING_SERVER_OTA"'|' src/org/lineageos
sed -i 's|0OTA_SERVER_ONION0|'"$DOS_BRANDING_SERVER_OTA_ONION"'|' src/org/lineageos/updater/misc/Utils.java;
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;
fi;
if enter "vendor/lineage"; then