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

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

Update src/org/lineageos/updater/misc/Utils.java

parent f5c10552
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -147,7 +147,10 @@ public class Utils {
        String[] versionParts = versionCode.split(Pattern.quote("."));
        int major = Integer.parseInt(versionParts[0]);
        int minor = Integer.parseInt(versionParts[1]);
        return new int[]{ major, minor };
        int patch = 0;
        if(versionParts.length >=3)
            patch = Integer.parseInt(versionParts[2]);
        return new int[]{ major, minor, patch };
    }

    public static boolean canInstall(UpdateBaseInfo update) {
@@ -273,10 +276,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;
            }