diff --git a/res/values/strings.xml b/res/values/strings.xml
index ec352a57d9af5f8d28238a01483e94eaf63c89a1..9546b28c4fee53a92d13277cabd45a0b8ac37425 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -144,7 +144,7 @@
Update blocked
This update cannot be installed using the updater app. Please read %1$s for more information.
- http://wiki.lineageos.org/devices/%1$s/upgrade
+ https://doc.e.foundation/devices/%1$s/upgrade
Export completion
New updates
diff --git a/src/org/lineageos/updater/UpdatesDbHelper.java b/src/org/lineageos/updater/UpdatesDbHelper.java
index 01e6fc2674b66215fb0a461ae5700b17410b59d6..cd9fda4538fdd5474e118d9cb5ff6ff46daabcc6 100644
--- a/src/org/lineageos/updater/UpdatesDbHelper.java
+++ b/src/org/lineageos/updater/UpdatesDbHelper.java
@@ -30,7 +30,7 @@ import java.util.List;
public class UpdatesDbHelper extends SQLiteOpenHelper {
- public static final int DATABASE_VERSION = 2;
+ public static final int DATABASE_VERSION = 3;
public static final String DATABASE_NAME = "updates.db";
public static class UpdateEntry implements BaseColumns {
@@ -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);
diff --git a/src/org/lineageos/updater/misc/BuildInfoUtils.java b/src/org/lineageos/updater/misc/BuildInfoUtils.java
index 6a647faf2517460c8cd0084a87e285dfddb68b1d..37718c4e1091257b252db9d9c65c2f4b919a6303 100644
--- a/src/org/lineageos/updater/misc/BuildInfoUtils.java
+++ b/src/org/lineageos/updater/misc/BuildInfoUtils.java
@@ -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);
+ }
}
diff --git a/src/org/lineageos/updater/misc/Constants.java b/src/org/lineageos/updater/misc/Constants.java
index 6ba705c7f6c691a653b55d31d1039236d1be70bc..7aa9e83ad87e29a9294260d1cdd2fdb86929f6d3 100644
--- a/src/org/lineageos/updater/misc/Constants.java
+++ b/src/org/lineageos/updater/misc/Constants.java
@@ -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_ANDROID_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";
diff --git a/src/org/lineageos/updater/misc/Utils.java b/src/org/lineageos/updater/misc/Utils.java
index eb2230c22172bd5206301f8108c0cf67e4f943b9..7ff8d29e9d74be985855d8d711761fe55a967cf8 100644
--- a/src/org/lineageos/updater/misc/Utils.java
+++ b/src/org/lineageos/updater/misc/Utils.java
@@ -92,6 +92,12 @@ public class Utils {
update.setDownloadUrl(object.getString("url"));
update.setVersion(object.getString("version"));
update.setDisplayVersion(object.getString("display_version"));
+ update.setAndroidVersion(object.getString("android_version"));
+
+ Log.d(TAG, object.toString());
+ Log.d(TAG, object.getString("android_version"));
+ Log.d(TAG, update.getAndroidVersion())
+
return update;
}
@@ -113,8 +119,15 @@ public class Utils {
}
public static boolean canInstall(UpdateBaseInfo update) {
+
+
+ Log.d(TAG, "System Android version: "+SystemProperties.get(Constants.PROP_BUILD_ANDROID_VERSION));
+ Log.d(TAG, "Update Android version: "+update.getAndroidVersion());
+
+
return (SystemProperties.getBoolean(Constants.PROP_UPDATER_ALLOW_DOWNGRADING, false) ||
- update.getTimestamp() > SystemProperties.getLong(Constants.PROP_BUILD_DATE, 0));
+ update.getTimestamp() > SystemProperties.getLong(Constants.PROP_BUILD_DATE, 0) ||
+ update.getAndroidVersion().equals(SystemProperties.get(Constants.PROP_BUILD_ANDROID_VERSION));
}
public static List parseJson(File file, boolean compatibleOnly)
diff --git a/src/org/lineageos/updater/model/UpdateBase.java b/src/org/lineageos/updater/model/UpdateBase.java
index cfa2027ed82bec55334483be351c1447e195a00b..4e2b3f56d438fbcde3c14ff4f839cc2f9a5d2df5 100644
--- a/src/org/lineageos/updater/model/UpdateBase.java
+++ b/src/org/lineageos/updater/model/UpdateBase.java
@@ -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();
}
@@ -89,11 +91,20 @@ public class UpdateBase implements UpdateBaseInfo {
public String getDisplayVersion() {
return mDisplayVersion;
}
-
+
public void setDisplayVersion(String displayVersion) {
mDisplayVersion = displayVersion;
}
+ @Override
+ public String getAndroidVersion() {
+ return mAndroidVersion;
+ }
+
+ public void setAndroidVersion(String androidVersion) {
+ mAndroidVersion = androidVersion;
+ }
+
@Override
public String getDownloadUrl() {
return mDownloadUrl;
diff --git a/src/org/lineageos/updater/model/UpdateBaseInfo.java b/src/org/lineageos/updater/model/UpdateBaseInfo.java
index 2921e96fc57c93c510348eb301abdc961ca3bae9..a1bfb022bd181756eacbf0865e1c5d525327e05e 100644
--- a/src/org/lineageos/updater/model/UpdateBaseInfo.java
+++ b/src/org/lineageos/updater/model/UpdateBaseInfo.java
@@ -28,6 +28,8 @@ public interface UpdateBaseInfo {
String getDisplayVersion();
+ String getAndroidVersion();
+
String getDownloadUrl();
long getFileSize();