diff --git a/res/layout/update_item_view.xml b/res/layout/update_item_view.xml index ade5d6db67bf07600642bbf5fbe1c447c242608e..a805a81b6a599969e17d370c334de20f35bc32f1 100644 --- a/res/layout/update_item_view.xml +++ b/res/layout/update_item_view.xml @@ -35,6 +35,18 @@ android:textSize="16sp" tools:text="LineageOS 15.1" /> + + Delete the selected update file? Apply update - You are about to upgrade to %1$s.\n\nIf you press %2$s, the device will restart itself in recovery mode to install the update.\n\nNote: This feature requires a compatible Recovery or updates will need to be installed manually. - You are about to upgrade to %1$s.\n\nIf you press %2$s, the device will begin installing in the background.\n\nOnce completed, you will be prompted to reboot. + You are about to update to %1$s.\n\nIf you press %2$s, the device will restart itself in recovery mode to install the update. + You are about to update to %1$s.\n\nIf you press %2$s, the device will begin installing in the background.\n\nOnce completed, you will be prompted to reboot. + + Version Upgrade! + You are about to upgrade to %1$s, based on Android %2$s\n\nRemember: it is always recommended to backup your data before upgrades.\n\nIf you press %3$s, the device will restart itself into recovery mode to install the update. + You are about to upgrade to %1$s, based on Android %2$s.\n\nRemember: it is always recommended to backup your data before upgrades.\n\nIf you press %3$s, the device will begin installing in the background.\n\nOnce completed, you will be prompted to reboot. Cancel the installation? 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 f3841a5c4b05a3a59e6aefaf3ba0112422899785..5f5a0aca8099672d6192fa4121e81da4befad10c 100644 --- a/src/org/lineageos/updater/UpdatesListAdapter.java +++ b/src/org/lineageos/updater/UpdatesListAdapter.java @@ -21,6 +21,7 @@ import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.res.Resources; import android.os.BatteryManager; +import android.os.Build; import android.os.PowerManager; import android.preference.PreferenceManager; import android.text.SpannableString; @@ -94,6 +95,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter Utils.triggerUpdate(mActivity, downloadId)) .setNegativeButton(android.R.string.cancel, null); diff --git a/src/org/lineageos/updater/misc/Utils.java b/src/org/lineageos/updater/misc/Utils.java index f1c3476d2635edb5ddc534b7c51b35d538f2e6b8..199d23f47db637c78252addce2dbd9fd170303e5 100644 --- a/src/org/lineageos/updater/misc/Utils.java +++ b/src/org/lineageos/updater/misc/Utils.java @@ -98,6 +98,7 @@ 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")); return update; } diff --git a/src/org/lineageos/updater/model/UpdateBase.java b/src/org/lineageos/updater/model/UpdateBase.java index cfa2027ed82bec55334483be351c1447e195a00b..8f9b5190ce9197e0a9f8c476f9f8c7a11070bb6a 100644 --- a/src/org/lineageos/updater/model/UpdateBase.java +++ b/src/org/lineageos/updater/model/UpdateBase.java @@ -23,6 +23,7 @@ public class UpdateBase implements UpdateBaseInfo { private long mTimestamp; private String mType; private String mVersion; + private String mAndroidVersion; private String mDisplayVersion; private long mFileSize; @@ -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();