diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7ec2279a1cd21bf8df575059425288951aa549d1..e9a10b5301a2ad2b39f8ee1df7e0edb0eebe46c8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,20 @@ stages: - update-from-upstream + - build + - sign include: - project: 'e/priv/os/build' ref: master file: '/templates/.gitlab-ci-update-from-upstream.yml' + - project: 'e/priv/os/build' + ref: master + file: '/templates/.gitlab-ci-build-module.yml' + +build Updater: + extends: .build-module + variables: + BRANCH_NAME: "v1-nougat" + MODULE_NAME: "Updater" + MODULE_PATH: "packages/apps/Updater" + PRIV_APP: "true" diff --git a/res/values/strings.xml b/res/values/strings.xml index 33b0a49365ed375d25d95f64dcd79e42b77ce773..0f8121d167d3173c6c93804a2c01bc352a166108 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -137,5 +137,5 @@ Update blocked This update cannot be installed using the updater app. Please read %1$s for more information. - http://wiki.lineageos.org/upgrading.html + https://doc.e.foundation/devices/%1$s/upgrade 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/UpdatesListAdapter.java b/src/org/lineageos/updater/UpdatesListAdapter.java index dc5b57edf0e897afe72207d345aa59aa3e8aaa95..a5bd463b681a30f9190b2d3efade06986393d4c1 100644 --- a/src/org/lineageos/updater/UpdatesListAdapter.java +++ b/src/org/lineageos/updater/UpdatesListAdapter.java @@ -253,7 +253,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter 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) @@ -160,6 +173,13 @@ public class Utils { .replace("{incr}", incrementalVersion); } + public static String getUpgradeBlockedURL(Context context) { + String device = SystemProperties.get(Constants.PROP_NEXT_DEVICE, + SystemProperties.get(Constants.PROP_DEVICE)); + return context.getString(R.string.blocked_update_info_url, device); + } + + public static String getChangelogURL(Context context) { String device = SystemProperties.get(Constants.PROP_NEXT_DEVICE, SystemProperties.get(Constants.PROP_DEVICE)); diff --git a/src/org/lineageos/updater/model/UpdateBase.java b/src/org/lineageos/updater/model/UpdateBase.java index cfa2027ed82bec55334483be351c1447e195a00b..f31aafe94e43274bac4ebc0cb989a041a2ce793a 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(); } @@ -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; 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();