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

Commit 265e0ff2 authored by Romain Hunault's avatar Romain Hunault 💻 Committed by Romain Hunault
Browse files

Load Android version

parent bd9b5e61
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ public class UpdatesDbHelper extends SQLiteOpenHelper {
        public static final String COLUMN_NAME_TYPE = "type";
        public static final String COLUMN_NAME_VERSION = "version";
        public static final String COLUMN_NAME_DISPLAY_VERSION = "display_version";
        public static final String COLUMN_NAME_ANDROID_VERSION = "android_version";
        public static final String COLUMN_NAME_SIZE = "size";
    }

@@ -55,6 +56,7 @@ public class UpdatesDbHelper extends SQLiteOpenHelper {
                    UpdateEntry.COLUMN_NAME_TYPE + " TEXT," +
                    UpdateEntry.COLUMN_NAME_VERSION + " TEXT," +
                    UpdateEntry.COLUMN_NAME_DISPLAY_VERSION + " TEXT," +
                    UpdateEntry.COLUMN_NAME_ANDROID_VERSION + " TEXT," +
                    UpdateEntry.COLUMN_NAME_SIZE + " INTEGER)";

    private static final String SQL_DELETE_ENTRIES =
@@ -87,6 +89,7 @@ public class UpdatesDbHelper extends SQLiteOpenHelper {
        values.put(UpdateEntry.COLUMN_NAME_TYPE, update.getType());
        values.put(UpdateEntry.COLUMN_NAME_VERSION, update.getVersion());
        values.put(UpdateEntry.COLUMN_NAME_DISPLAY_VERSION, update.getDisplayVersion());
        values.put(UpdateEntry.COLUMN_NAME_ANDROID_VERSION, update.getAndroidVersion());
        values.put(UpdateEntry.COLUMN_NAME_SIZE, update.getFileSize());
        return db.insert(UpdateEntry.TABLE_NAME, null, values);
    }
@@ -101,6 +104,7 @@ public class UpdatesDbHelper extends SQLiteOpenHelper {
        values.put(UpdateEntry.COLUMN_NAME_TYPE, update.getType());
        values.put(UpdateEntry.COLUMN_NAME_VERSION, update.getVersion());
        values.put(UpdateEntry.COLUMN_NAME_DISPLAY_VERSION, update.getDisplayVersion());
        values.put(UpdateEntry.COLUMN_NAME_ANDROID_VERSION, update.getAndroidVersion());
        values.put(UpdateEntry.COLUMN_NAME_SIZE, update.getFileSize());
        return db.insertWithOnConflict(UpdateEntry.TABLE_NAME, null, values, conflictAlgorithm);
    }
@@ -166,6 +170,7 @@ public class UpdatesDbHelper extends SQLiteOpenHelper {
                UpdateEntry.COLUMN_NAME_TYPE,
                UpdateEntry.COLUMN_NAME_VERSION,
                UpdateEntry.COLUMN_NAME_DISPLAY_VERSION,
                UpdateEntry.COLUMN_NAME_ANDROID_VERSION,
                UpdateEntry.COLUMN_NAME_STATUS,
                UpdateEntry.COLUMN_NAME_SIZE,
        };
@@ -189,6 +194,8 @@ public class UpdatesDbHelper extends SQLiteOpenHelper {
                update.setVersion(cursor.getString(index));
                index = cursor.getColumnIndex(UpdateEntry.COLUMN_NAME_DISPLAY_VERSION);
                update.setDisplayVersion(cursor.getString(index));
                index = cursor.getColumnIndex(UpdateEntry.COLUMN_NAME_ANDROID_VERSION);
                update.setAndroidVersion(cursor.getString(index));
                index = cursor.getColumnIndex(UpdateEntry.COLUMN_NAME_STATUS);
                update.setPersistentStatus(cursor.getInt(index));
                index = cursor.getColumnIndex(UpdateEntry.COLUMN_NAME_SIZE);
+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 getAndroidVersion() {
        return SystemProperties.get(Constants.PROP_BUILD_ANDROID_VERSION);
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ public class Utils {
        update.setDownloadUrl(object.getString("url"));
        update.setVersion(object.getString("version"));
        update.setDisplayVersion(object.getString("display_version"));
        update.setDisplayVersion(object.getString("android_version"));
        return update;
    }

+12 −1
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 mAndroidVersion;
    private long mFileSize;

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

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

    @Override
    public String getAndroidVersion() {
        return mAndroidVersion;
    }
    
    public void setAndroidVersion(String androidVersion) {
        mAndroidVersion = androidVersion;
    }

    @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 getAndroidVersion();

    String getDownloadUrl();

    long getFileSize();