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

Commit 5af8fdcf authored by Sooraj S's avatar Sooraj S 👽
Browse files

Updater: Parse android_version from JSON response

We need to compare android version before adding the file to Updates
parent a32632e0
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -33,4 +33,8 @@ public final class BuildInfoUtils {
    public static String getDisplayVersion() {
        return SystemProperties.get(Constants.PROP_BUILD_DISPLAY_VERSION);
    }

    public static String getReleaseVersion() {
        return SystemProperties.get(Constants.PROP_BUILD_RELEASE_VERSION);
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ public final class Constants {
    public static final String PROP_BUILD_DATE = "ro.build.date.utc";
    public static final String PROP_BUILD_VERSION = "ro.lineage.build.version";
    public static final String PROP_BUILD_DISPLAY_VERSION = "ro.lineage.display.version";
    public static final String PROP_BUILD_RELEASE_VERSION = "ro.build.version.release";
    public static final String PROP_BUILD_VERSION_INCREMENTAL = "ro.build.version.incremental";
    public static final String PROP_DEVICE = "ro.lineage.device";
    public static final String PROP_NEXT_DEVICE = "ro.updater.next_device";
+6 −1
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ public class Utils {
        update.setDownloadUrl(object.getString("url"));
        update.setVersion(object.getString("version"));
        update.setDisplayVersion(object.getString("display_version"));
        update.setReleaseVersion(object.getString("android_version"));
        return update;
    }

@@ -120,6 +121,10 @@ public class Utils {
            Log.d(TAG, update.getName() + " has type " + update.getType());
            return false;
        }
        if (!update.getReleaseVersion().equals(SystemProperties.get(Constants.PROP_BUILD_RELEASE_VERSION))) {
            Log.d(TAG, update.getName() + " android_version :" + update.getReleaseVersion());
            return false;
        }
        if(updateMajorVersion > deviceMajorVersion){
            Log.d(TAG, update.getName() + " is Newer to current Major version");
            return true;
@@ -137,7 +142,7 @@ public class Utils {
            return false;
        }
        if(updateMaintenanceVersion < deviceMaintenanceVersion){
            Log.d(TAG, update.getName() + " is Older to current Minor version");
            Log.d(TAG, update.getName() + " is Older to current Maintenance version");
            return false;
        }

+11 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ public class UpdateBase implements UpdateBaseInfo {
    private String mType;
    private String mVersion;
    private String mDisplayVersion;
    private String mReleaseVersion;
    private long mFileSize;

    public UpdateBase() {
@@ -37,6 +38,7 @@ public class UpdateBase implements UpdateBaseInfo {
        mType = update.getType();
        mVersion = update.getVersion();
        mDisplayVersion = update.getDisplayVersion();
        mReleaseVersion = update.getReleaseVersion();
        mFileSize = update.getFileSize();
    }

@@ -94,6 +96,15 @@ public class UpdateBase implements UpdateBaseInfo {
        mDisplayVersion = displayVersion;
    }

    @Override
    public String getReleaseVersion() {
        return mReleaseVersion;
    }

    public void setReleaseVersion(String releaseVersion) {
        mReleaseVersion = releaseVersion;
    }

    @Override
    public String getDownloadUrl() {
        return mDownloadUrl;
+2 −0
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@ public interface UpdateBaseInfo {

    String getDisplayVersion();

    String getReleaseVersion();

    String getDownloadUrl();

    long getFileSize();