Loading src/org/lineageos/updater/misc/Utils.java +21 −3 Original line number Diff line number Diff line Loading @@ -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; } } /** Loading Loading
src/org/lineageos/updater/misc/Utils.java +21 −3 Original line number Diff line number Diff line Loading @@ -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; } } /** Loading