diff --git a/src/org/lineageos/updater/download/HttpURLConnectionClient.java b/src/org/lineageos/updater/download/HttpURLConnectionClient.java index a3d54c229996aab4e6969257358b617c2c0736bd..df6283b5cb8bdc40f043a4d459c04a98e3f6619a 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; @@ -32,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"; @@ -60,7 +64,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; diff --git a/src/org/lineageos/updater/misc/Utils.java b/src/org/lineageos/updater/misc/Utils.java index 8aa0582e64f943e0204ee21ea03fec6a99301aa8..aca2b04d16ee4fa3307ee157ee1ada39fb4be85a 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); } /**