From 999962565c62a7397706b4ed2eec2db115c091c8 Mon Sep 17 00:00:00 2001 From: maxwen Date: Tue, 19 Jan 2016 02:16:45 +0100 Subject: [PATCH] OpenDelta: always check for version on all file checks to prevent old version images to have any impact Change-Id: Idc768bbe32d625a2006aa5b8648edf9ede877b73 --- res/values/config.xml | 2 ++ src/eu/chainfire/opendelta/Config.java | 7 +++++-- src/eu/chainfire/opendelta/UpdateService.java | 5 +++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/res/values/config.xml b/res/values/config.xml index d12a000..56ab3c1 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -55,4 +55,6 @@ NIGHTLY + + ro.build.version.release diff --git a/src/eu/chainfire/opendelta/Config.java b/src/eu/chainfire/opendelta/Config.java index 4a312c8..d191211 100644 --- a/src/eu/chainfire/opendelta/Config.java +++ b/src/eu/chainfire/opendelta/Config.java @@ -67,6 +67,7 @@ public class Config { private final String filename_base_prefix; private final String url_base_json; private final String official_version_tag; + private final String android_version; /* * Using reflection voodoo instead calling the hidden class directly, to @@ -118,9 +119,11 @@ public class Config { secure_mode_enable = res.getBoolean(R.bool.secure_mode_enable); secure_mode_default = res.getBoolean(R.bool.secure_mode_default); url_base_json = res.getString(R.string.url_base_json); - filename_base_prefix = String.format(Locale.ENGLISH, - res.getString(R.string.filename_base), ""); official_version_tag = res.getString(R.string.official_version_tag); + android_version = getProperty(context, + res.getString(R.string.android_version), ""); + filename_base_prefix = String.format(Locale.ENGLISH, + res.getString(R.string.filename_base), android_version); boolean keep_screen_on = false; try { String[] devices = res diff --git a/src/eu/chainfire/opendelta/UpdateService.java b/src/eu/chainfire/opendelta/UpdateService.java index 5488c83..dd2d4f7 100644 --- a/src/eu/chainfire/opendelta/UpdateService.java +++ b/src/eu/chainfire/opendelta/UpdateService.java @@ -848,7 +848,7 @@ OnWantUpdateCheckListener, OnSharedPreferenceChangeListener { for (int i = 0; i < builds.length(); i++) { JSONObject build = builds.getJSONObject(i); String file = build.getString("filename"); - if (file.endsWith(".zip")) { + if (file.endsWith(".zip") && file.startsWith(config.getFileBaseNamePrefix())) { buildNames.add(new File(file).getName()); } } @@ -1818,7 +1818,8 @@ OnWantUpdateCheckListener, OnSharedPreferenceChangeListener { String latestFullBuild = getNewestFullBuild(); // if we dont even find a build on dl no sense to continue if (latestFullBuild == null) { - Logger.d("no latest build found at " + config.getUrlBaseJson() + " for " + config.getDevice()); + Logger.d("no latest build found at " + config.getUrlBaseJson() + + " for " + config.getDevice() + " prefix " + config.getFileBaseNamePrefix()); return; }