Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c37d7cf2 authored by Alexandre Roux's avatar Alexandre Roux
Browse files

Merge branch 'v1-r-dont-crash-when-receiving-maintenance-number' into 'v1-r'

R dont crash when receiving maintenance number

See merge request !77
parents f59d4616 257da67d
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
package org.lineageos.updater.download;

import android.os.SystemClock;
import android.os.SystemProperties;

import android.util.Log;

import java.io.File;
@@ -33,6 +35,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";
@@ -61,7 +65,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;
+1 −3
Original line number Diff line number Diff line
@@ -281,10 +281,8 @@ public class Utils {
    public static boolean checkForNewUpdates(File newJson)
            throws IOException, JSONException {
        List<UpdateInfo> newList = parseJson(newJson, true);
        float currentVersion = Float.parseFloat(BuildInfoUtils.getBuildVersion());

        for (UpdateInfo update : newList) {
            if (Float.parseFloat(update.getVersion()) > currentVersion) {
            if (isCompatible(update)) {
                Log.d(TAG, "New compatiable update available");
                return true;
            }