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

Commit 69ffa6ff authored by Alexandre Roux's avatar Alexandre Roux
Browse files

fix build issue

parent 186a5a19
Loading
Loading
Loading
Loading
+21 −3
Original line number Diff line number Diff line
@@ -274,14 +274,32 @@ public class Utils {
    public static boolean checkForNewUpdates(File newJson, Context context)
            throws IOException, JSONException {
        List<UpdateInfo> newList = parseJson(newJson, true);
        int[] deviceVersionParts = parseSemVer(SystemProperties.get(Constants.PROP_BUILD_VERSION));
        int deviceMajorVersion = deviceVersionParts[0];
        int deviceMinorVersion = deviceVersionParts[1];
        final float currentVersion = Float.parseFloat(deviceMajorVersion + "." + deviceMinorVersion);
        float highestAvailableVersion = currentVersion;
		boolean hasUpdate = false;
        for (UpdateInfo update : newList) {
            if (isCompatible(update)) {
                Log.d(TAG, "New compatible update available");
                updateSystemUpdaterService(context, STATUS_WAITING_DOWNLOAD, highestAvailableVersion);
                return true;
				int[] updateVersionParts = parseSemVer(update.getVersion());
				int updateMajorVersion = updateVersionParts[0];
				int updateMinorVersion = updateVersionParts[1];
				float thisUpdate = Float.parseFloat(updateMajorVersion + "." + updateMinorVersion)
				if (thisUpdate > highestAvailableVersion) {
					highestAvailableVersion = thisUpdate;
				}
				hasUpdate = true;
            }
        }
        if (hasUpdate) {
           updateSystemUpdaterService(context, STATUS_WAITING_DOWNLOAD, highestAvailableVersion);
           return true;
        } else {
           updateSystemUpdaterService(context, STATUS_IDLE, highestAvailableVersion);
           return false;
        }
    }

    /**