diff --git a/res/menu/menu_toolbar.xml b/res/menu/menu_toolbar.xml index 8b9117ce197f1a1c95bdb823a76a6f7948ac3160..b26cf66f8a66961a95c556294f1fb5d93f61caf2 100644 --- a/res/menu/menu_toolbar.xml +++ b/res/menu/menu_toolbar.xml @@ -11,7 +11,7 @@ android:title="@string/menu_preferences" app:showAsAction="never" /> diff --git a/res/values/strings.xml b/res/values/strings.xml index 6bcba24dc511c4fced16c7082b9b5652a5dae1c4..c4ce561c9102a49098a6e5287a56caaf525017cf 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -74,7 +74,7 @@ Delete Copy URL Export update - Show changelog + Show release notes https://gitlab.e.foundation/e/os/releases/-/releases/v%1$s-pie Prioritize update process diff --git a/src/org/lineageos/updater/UpdatesActivity.java b/src/org/lineageos/updater/UpdatesActivity.java index b9161d090ebc10ad4d43b64b909f722d0ef5e9bb..e56d02af876189c1895be654841109417f251c6a 100644 --- a/src/org/lineageos/updater/UpdatesActivity.java +++ b/src/org/lineageos/updater/UpdatesActivity.java @@ -200,7 +200,7 @@ public class UpdatesActivity extends UpdatesListActivity { showPreferencesDialog(); return true; } - case R.id.menu_show_changelog: { + case R.id.menu_show_release_notes: { Intent openUrl = new Intent(Intent.ACTION_VIEW, Uri.parse(Utils.getChangelogURL(this))); startActivity(openUrl); @@ -294,7 +294,7 @@ public class UpdatesActivity extends UpdatesListActivity { preferences.edit().putLong(Constants.PREF_LAST_UPDATE_CHECK, millis).apply(); updateLastCheckedString(); if (json.exists() && Utils.isUpdateCheckEnabled(this) && - Utils.checkForNewUpdates(json, jsonNew)) { + Utils.checkForNewUpdates(jsonNew)) { UpdatesCheckReceiver.updateRepeatingUpdatesCheck(this); } // In case we set a one-shot check because of a previous failure @@ -419,7 +419,7 @@ public class UpdatesActivity extends UpdatesListActivity { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); autoCheckInterval.setSelection(Utils.getUpdateCheckSetting(this)); - autoDelete.setChecked(prefs.getBoolean(Constants.PREF_AUTO_DELETE_UPDATES, false)); + autoDelete.setChecked(prefs.getBoolean(Constants.PREF_AUTO_DELETE_UPDATES, true)); dataWarning.setChecked(prefs.getBoolean(Constants.PREF_MOBILE_DATA_WARNING, true)); abPerfMode.setChecked(prefs.getBoolean(Constants.PREF_AB_PERF_MODE, false)); diff --git a/src/org/lineageos/updater/UpdatesCheckReceiver.java b/src/org/lineageos/updater/UpdatesCheckReceiver.java index d0769cf768fa6fadfd992dfd55be474ba9ce0bfd..7626f8d360e239091d297bb6d4c48cddea5389d0 100644 --- a/src/org/lineageos/updater/UpdatesCheckReceiver.java +++ b/src/org/lineageos/updater/UpdatesCheckReceiver.java @@ -93,7 +93,7 @@ public class UpdatesCheckReceiver extends BroadcastReceiver { @Override public void onSuccess(File destination) { try { - if (json.exists() && Utils.checkForNewUpdates(json, jsonNew)) { + if (json.exists() && Utils.checkForNewUpdates(jsonNew)) { showNotification(context); updateRepeatingUpdatesCheck(context); } diff --git a/src/org/lineageos/updater/UpdatesListAdapter.java b/src/org/lineageos/updater/UpdatesListAdapter.java index 0df51d989701d0dd7b402293499764eb90bd90fb..87f90d83a3c7e327f888a09e43991a5692920851 100644 --- a/src/org/lineageos/updater/UpdatesListAdapter.java +++ b/src/org/lineageos/updater/UpdatesListAdapter.java @@ -249,12 +249,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter oldList = parseJson(oldJson, true); List newList = parseJson(newJson, true); - Set oldIds = new HashSet<>(); - for (UpdateInfo update : oldList) { - oldIds.add(update.getDownloadId()); - } - // In case of no new updates, the old list should - // have all (if not more) the updates + float currentVersion = Float.parseFloat(BuildInfoUtils.getBuildVersion()); + for (UpdateInfo update : newList) { - if (!oldIds.contains(update.getDownloadId())) { + if (Float.parseFloat(update.getVersion()) > currentVersion) { + Log.d(TAG, "New compatiable update available"); return true; } } @@ -309,11 +304,20 @@ public class Utils { removeUncryptFiles(downloadPath); + // TODO: Remove after a considerable numbers of OTA + boolean forcedDeleteUpdates = preferences.getBoolean(Constants.PREF_FORCED_AUTO_DELETE_UPDATES, true); + if (forcedDeleteUpdates == true) { + preferences.edit() + .putBoolean(Constants.PREF_AUTO_DELETE_UPDATES, true) + .putBoolean(Constants.PREF_FORCED_AUTO_DELETE_UPDATES, false) + .apply(); + } + long buildTimestamp = SystemProperties.getLong(Constants.PROP_BUILD_DATE, 0); long prevTimestamp = preferences.getLong(Constants.PREF_INSTALL_OLD_TIMESTAMP, 0); String lastUpdatePath = preferences.getString(Constants.PREF_INSTALL_PACKAGE_PATH, null); boolean reinstalling = preferences.getBoolean(Constants.PREF_INSTALL_AGAIN, false); - boolean deleteUpdates = preferences.getBoolean(Constants.PREF_AUTO_DELETE_UPDATES, false); + boolean deleteUpdates = preferences.getBoolean(Constants.PREF_AUTO_DELETE_UPDATES, true); if ((buildTimestamp != prevTimestamp || reinstalling) && deleteUpdates && lastUpdatePath != null) { File lastUpdate = new File(lastUpdatePath);