Loading src/org/lineageos/updater/misc/Utils.java +36 −17 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ import java.util.Locale; import java.util.Set; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.regex.Pattern; public class Utils { Loading Loading @@ -96,8 +97,21 @@ public class Utils { } public static boolean isCompatible(UpdateBaseInfo update) { if (update.getVersion().compareTo("0.10") == 0){ Log.d(TAG, update.getName() + " version update is special"); String updateVersion = update.getVersion(); String[] updateVersionParts = updateVersion.split(Pattern.quote(".")); String updateMajorVersion = updateVersionParts[0]; String updateMinorVersion = updateVersionParts[1]; Log.d(TAG, "Update : Major "+updateMajorVersion +" Minor "+ updateMinorVersion ); String deviceVersion = SystemProperties.get(Constants.PROP_BUILD_VERSION); String[] deviceVersionParts = deviceVersion.split(Pattern.quote(".")); String deviceMajorVersion = deviceVersionParts[0]; String deviceMinorVersion = deviceVersionParts[1]; Log.d(TAG, "Device : Major "+ deviceMajorVersion +" Minor "+ deviceMinorVersion ); if(updateMajorVersion.compareTo(deviceMajorVersion) < 0){ Log.d(TAG, "" + " is older than current Android version"); if (!SystemProperties.getBoolean(Constants.PROP_UPDATER_ALLOW_DOWNGRADING, false) && update.getTimestamp() <= SystemProperties.getLong(Constants.PROP_BUILD_DATE, 0)) { Log.d(TAG, update.getName() + " is older than/equal to the current build"); Loading @@ -107,12 +121,11 @@ public class Utils { Log.d(TAG, update.getName() + " has type " + update.getType()); return false; } return true; } if (update.getVersion().compareTo(SystemProperties.get(Constants.PROP_BUILD_VERSION)) < 0) { Log.d(TAG, update.getName() + " is older than current Android version"); return false; } if(updateMinorVersion.compareTo(deviceMinorVersion) < 0){ Log.d(TAG, "" + " is older than current Android version"); if (!SystemProperties.getBoolean(Constants.PROP_UPDATER_ALLOW_DOWNGRADING, false) && update.getTimestamp() <= SystemProperties.getLong(Constants.PROP_BUILD_DATE, 0)) { Log.d(TAG, update.getName() + " is older than/equal to the current build"); Loading @@ -122,6 +135,8 @@ public class Utils { Log.d(TAG, update.getName() + " has type " + update.getType()); return false; } } return true; } Loading Loading @@ -185,10 +200,14 @@ public class Utils { } public static String getChangelogURL(Context context) { String device = SystemProperties.get(Constants.PROP_NEXT_DEVICE, SystemProperties.get(Constants.PROP_DEVICE)); String version = SystemProperties.get(Constants.PROP_VERSION); String buildVersion = SystemProperties.get(Constants.PROP_BUILD_VERSION); String releaseType = SystemProperties.get(Constants.PROP_RELEASE_TYPE); return context.getString(R.string.menu_changelog_url, buildVersion); return context.getString(R.string.menu_changelog_url, device, version, releaseType); } public static void triggerUpdate(Context context, String downloadId) { Loading Loading
src/org/lineageos/updater/misc/Utils.java +36 −17 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ import java.util.Locale; import java.util.Set; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.regex.Pattern; public class Utils { Loading Loading @@ -96,8 +97,21 @@ public class Utils { } public static boolean isCompatible(UpdateBaseInfo update) { if (update.getVersion().compareTo("0.10") == 0){ Log.d(TAG, update.getName() + " version update is special"); String updateVersion = update.getVersion(); String[] updateVersionParts = updateVersion.split(Pattern.quote(".")); String updateMajorVersion = updateVersionParts[0]; String updateMinorVersion = updateVersionParts[1]; Log.d(TAG, "Update : Major "+updateMajorVersion +" Minor "+ updateMinorVersion ); String deviceVersion = SystemProperties.get(Constants.PROP_BUILD_VERSION); String[] deviceVersionParts = deviceVersion.split(Pattern.quote(".")); String deviceMajorVersion = deviceVersionParts[0]; String deviceMinorVersion = deviceVersionParts[1]; Log.d(TAG, "Device : Major "+ deviceMajorVersion +" Minor "+ deviceMinorVersion ); if(updateMajorVersion.compareTo(deviceMajorVersion) < 0){ Log.d(TAG, "" + " is older than current Android version"); if (!SystemProperties.getBoolean(Constants.PROP_UPDATER_ALLOW_DOWNGRADING, false) && update.getTimestamp() <= SystemProperties.getLong(Constants.PROP_BUILD_DATE, 0)) { Log.d(TAG, update.getName() + " is older than/equal to the current build"); Loading @@ -107,12 +121,11 @@ public class Utils { Log.d(TAG, update.getName() + " has type " + update.getType()); return false; } return true; } if (update.getVersion().compareTo(SystemProperties.get(Constants.PROP_BUILD_VERSION)) < 0) { Log.d(TAG, update.getName() + " is older than current Android version"); return false; } if(updateMinorVersion.compareTo(deviceMinorVersion) < 0){ Log.d(TAG, "" + " is older than current Android version"); if (!SystemProperties.getBoolean(Constants.PROP_UPDATER_ALLOW_DOWNGRADING, false) && update.getTimestamp() <= SystemProperties.getLong(Constants.PROP_BUILD_DATE, 0)) { Log.d(TAG, update.getName() + " is older than/equal to the current build"); Loading @@ -122,6 +135,8 @@ public class Utils { Log.d(TAG, update.getName() + " has type " + update.getType()); return false; } } return true; } Loading Loading @@ -185,10 +200,14 @@ public class Utils { } public static String getChangelogURL(Context context) { String device = SystemProperties.get(Constants.PROP_NEXT_DEVICE, SystemProperties.get(Constants.PROP_DEVICE)); String version = SystemProperties.get(Constants.PROP_VERSION); String buildVersion = SystemProperties.get(Constants.PROP_BUILD_VERSION); String releaseType = SystemProperties.get(Constants.PROP_RELEASE_TYPE); return context.getString(R.string.menu_changelog_url, buildVersion); return context.getString(R.string.menu_changelog_url, device, version, releaseType); } public static void triggerUpdate(Context context, String downloadId) { Loading