Treat major upgrades as a special case

Major upgrades are compatible, but shouldn't be allowed since they
require some manual extra steps.
This commit is contained in:
Gabriele M
2017-07-02 22:21:27 +02:00
parent 13edaf4690
commit c30940649c
2 changed files with 5 additions and 5 deletions

View File

@@ -100,7 +100,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
viewHolder.mButton2.setEnabled(false);
} else {
// Allow one active download
boolean enabled = !mDownloadController.hasActiveDownloads();
boolean enabled = !mDownloadController.hasActiveDownloads() && Utils.canInstall(update);
int persistentStatus = update.getPersistentStatus();
if (persistentStatus == UpdateStatus.Persistent.INCOMPLETE) {
setButtonAction(viewHolder.mButton1, Action.RESUME, downloadId, enabled);

View File

@@ -73,13 +73,13 @@ public class Utils {
Log.d(TAG, update.getName() + " has type " + update.getType());
return false;
}
if (!update.getVersion().equalsIgnoreCase(SystemProperties.get("ro.cm.build.version"))) {
Log.d(TAG, update.getName() + " has version " + update.getVersion());
return false;
}
return true;
}
public static boolean canInstall(Update update) {
return update.getVersion().equalsIgnoreCase(SystemProperties.get("ro.cm.build.version"));
}
public static List<UpdateDownload> parseJson(File file, boolean compatibleOnly)
throws IOException, JSONException {
List<UpdateDownload> updates = new ArrayList<>();