OpenDelta: always check for version on all file checks

to prevent old version images to have any impact

Change-Id: Idc768bbe32d625a2006aa5b8648edf9ede877b73
This commit is contained in:
maxwen 2016-01-19 02:16:45 +01:00 committed by maxwen
parent 2e2411f792
commit 999962565c
3 changed files with 10 additions and 4 deletions

View File

@ -55,4 +55,6 @@
</string-array> </string-array>
<string name="official_version_tag">NIGHTLY</string> <string name="official_version_tag">NIGHTLY</string>
<string name="android_version">ro.build.version.release</string>
</resources> </resources>

View File

@ -67,6 +67,7 @@ public class Config {
private final String filename_base_prefix; private final String filename_base_prefix;
private final String url_base_json; private final String url_base_json;
private final String official_version_tag; private final String official_version_tag;
private final String android_version;
/* /*
* Using reflection voodoo instead calling the hidden class directly, to * 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_enable = res.getBoolean(R.bool.secure_mode_enable);
secure_mode_default = res.getBoolean(R.bool.secure_mode_default); secure_mode_default = res.getBoolean(R.bool.secure_mode_default);
url_base_json = res.getString(R.string.url_base_json); 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); 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; boolean keep_screen_on = false;
try { try {
String[] devices = res String[] devices = res

View File

@ -848,7 +848,7 @@ OnWantUpdateCheckListener, OnSharedPreferenceChangeListener {
for (int i = 0; i < builds.length(); i++) { for (int i = 0; i < builds.length(); i++) {
JSONObject build = builds.getJSONObject(i); JSONObject build = builds.getJSONObject(i);
String file = build.getString("filename"); String file = build.getString("filename");
if (file.endsWith(".zip")) { if (file.endsWith(".zip") && file.startsWith(config.getFileBaseNamePrefix())) {
buildNames.add(new File(file).getName()); buildNames.add(new File(file).getName());
} }
} }
@ -1818,7 +1818,8 @@ OnWantUpdateCheckListener, OnSharedPreferenceChangeListener {
String latestFullBuild = getNewestFullBuild(); String latestFullBuild = getNewestFullBuild();
// if we dont even find a build on dl no sense to continue // if we dont even find a build on dl no sense to continue
if (latestFullBuild == null) { 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; return;
} }