From 26f172a777c5227379d8dda9d31c8acd7b0b2082 Mon Sep 17 00:00:00 2001 From: Alexandre Roux D'Anzi Date: Mon, 12 Sep 2022 18:09:44 +0200 Subject: [PATCH 1/4] remove eels from agent string + adding /e/ version --- .../lineageos/updater/download/HttpURLConnectionClient.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/org/lineageos/updater/download/HttpURLConnectionClient.java b/src/org/lineageos/updater/download/HttpURLConnectionClient.java index a3d54c22..7f73a79a 100644 --- a/src/org/lineageos/updater/download/HttpURLConnectionClient.java +++ b/src/org/lineageos/updater/download/HttpURLConnectionClient.java @@ -16,6 +16,8 @@ package org.lineageos.updater.download; import android.os.SystemClock; +import android.os.SystemProperties; + import android.util.Log; import java.io.File; @@ -60,7 +62,7 @@ public class HttpURLConnectionClient implements DownloadClient { mClient = (HttpURLConnection) new URL(url).openConnection(); String defaultUserAgent = mClient.getRequestProperty("User-Agent"); - String newUserAgent = defaultUserAgent+" ota_007_eels"; + String newUserAgent = defaultUserAgent+" eOS v"+SystemProperties.get(Constants.PROP_BUILD_VERSION); mClient.setRequestProperty("User-Agent", newUserAgent); mDestination = destination; -- GitLab From af41b37d9922aa93fb8f4b655657025d15fdb3fe Mon Sep 17 00:00:00 2001 From: Alexandre Roux D'Anzi Date: Mon, 12 Sep 2022 18:11:40 +0200 Subject: [PATCH 2/4] don't crash when receiving maintenance number --- src/org/lineageos/updater/misc/Utils.java | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/org/lineageos/updater/misc/Utils.java b/src/org/lineageos/updater/misc/Utils.java index 8aa0582e..aca2b04d 100644 --- a/src/org/lineageos/updater/misc/Utils.java +++ b/src/org/lineageos/updater/misc/Utils.java @@ -274,22 +274,14 @@ public class Utils { public static boolean checkForNewUpdates(File newJson, Context context) throws IOException, JSONException { List newList = parseJson(newJson, true); - final float currentVersion = Float.parseFloat(BuildInfoUtils.getBuildVersion()); - float highestAvailableVersion = currentVersion; for (UpdateInfo update : newList) { - float availableversion = Float.parseFloat(update.getVersion()); - if (availableversion > highestAvailableVersion) { - highestAvailableVersion = availableversion; + if (isCompatible(update)) { + Log.d(TAG, "New compatible update available"); + updateSystemUpdaterService(context, STATUS_WAITING_DOWNLOAD, highestAvailableVersion); + return true; } } - - if (highestAvailableVersion > currentVersion) { - updateSystemUpdaterService(context, STATUS_WAITING_DOWNLOAD, highestAvailableVersion); - return true; - } else { - updateSystemUpdaterService(context, STATUS_IDLE, highestAvailableVersion); - return false; - } + updateSystemUpdaterService(context, STATUS_IDLE, highestAvailableVersion); } /** -- GitLab From 32f987954be9e0082857fccc954dbb3afa731eb0 Mon Sep 17 00:00:00 2001 From: Phie Date: Tue, 13 Sep 2022 11:26:17 +0200 Subject: [PATCH 3/4] forgotten import --- src/org/lineageos/updater/download/HttpURLConnectionClient.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/org/lineageos/updater/download/HttpURLConnectionClient.java b/src/org/lineageos/updater/download/HttpURLConnectionClient.java index 7f73a79a..5c64b296 100644 --- a/src/org/lineageos/updater/download/HttpURLConnectionClient.java +++ b/src/org/lineageos/updater/download/HttpURLConnectionClient.java @@ -34,6 +34,8 @@ import java.util.PriorityQueue; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.lineageos.updater.misc.Constants; + public class HttpURLConnectionClient implements DownloadClient { private final static String TAG = "HttpURLConnectionClient"; -- GitLab From 3d9d81e840eccd89bf5f08bae5553d03e9257345 Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Thu, 13 Oct 2022 12:54:00 +0000 Subject: [PATCH 4/4] Apply 1 suggestion(s) to 1 file(s) --- src/org/lineageos/updater/download/HttpURLConnectionClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/lineageos/updater/download/HttpURLConnectionClient.java b/src/org/lineageos/updater/download/HttpURLConnectionClient.java index 5c64b296..df6283b5 100644 --- a/src/org/lineageos/updater/download/HttpURLConnectionClient.java +++ b/src/org/lineageos/updater/download/HttpURLConnectionClient.java @@ -64,7 +64,7 @@ public class HttpURLConnectionClient implements DownloadClient { mClient = (HttpURLConnection) new URL(url).openConnection(); String defaultUserAgent = mClient.getRequestProperty("User-Agent"); - String newUserAgent = defaultUserAgent+" eOS v"+SystemProperties.get(Constants.PROP_BUILD_VERSION); + String newUserAgent = defaultUserAgent + " eOS v" + SystemProperties.get(Constants.PROP_BUILD_VERSION); mClient.setRequestProperty("User-Agent", newUserAgent); mDestination = destination; -- GitLab