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 f94f8be643a25f621854636f1ebfff1af8f328cf..28bd3ce69d2e5b872d7512da3846a2e666ca44be 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-q Prioritize update process diff --git a/src/org/lineageos/updater/UpdatesActivity.java b/src/org/lineageos/updater/UpdatesActivity.java index e1d3bd42f20dad5ba0a0f52773e90af0e2715b02..ad8bc3e6b9a70ed9b800cbf2e1341418845d2089 100644 --- a/src/org/lineageos/updater/UpdatesActivity.java +++ b/src/org/lineageos/updater/UpdatesActivity.java @@ -202,7 +202,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); @@ -296,7 +296,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 @@ -421,7 +421,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 288cd1a3b163b00fc3166719f2c22cce522ac975..57d9246816a62f7591a985ee88774d80bcb9a068 100644 --- a/src/org/lineageos/updater/UpdatesCheckReceiver.java +++ b/src/org/lineageos/updater/UpdatesCheckReceiver.java @@ -91,7 +91,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 7e886168e0dba75b94a0b099953c8959f242fec0..f3841a5c4b05a3a59e6aefaf3ba0112422899785 100644 --- a/src/org/lineageos/updater/UpdatesListAdapter.java +++ b/src/org/lineageos/updater/UpdatesListAdapter.java @@ -266,12 +266,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; } } @@ -310,11 +305,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);