Define the entire server URL as resource

Currently the URL is only partially customizable, part of
it is hard-coded and there's no clear indication of it.
Define the entire URL as resource string and use placeholders
for runtime variables.

Also, invalidate old overrides by changing the name of the
resource.

Warning: lineage.updater.uri must be updated accordingly

Change-Id: Iecfdaf9d422d08a707c7319bafea5befc6b757d2
This commit is contained in:
Gabriele M
2018-03-29 19:28:22 +02:00
parent 4fa7ba910a
commit 5252d60671
2 changed files with 16 additions and 6 deletions

View File

@@ -144,15 +144,19 @@ public class Utils {
}
public static String getServerURL(Context context) {
String serverUrl = SystemProperties.get(Constants.PROP_UPDATER_URI);
if (serverUrl.trim().isEmpty()) {
serverUrl = context.getString(R.string.conf_update_server_url_def);
}
String incrementalVersion = SystemProperties.get(Constants.PROP_BUILD_VERSION_INCREMENTAL);
String device = SystemProperties.get(Constants.PROP_NEXT_DEVICE,
SystemProperties.get(Constants.PROP_DEVICE));
String type = SystemProperties.get(Constants.PROP_RELEASE_TYPE).toLowerCase(Locale.ROOT);
return serverUrl + "/v1/" + device + "/" + type + "/" + incrementalVersion;
String serverUrl = SystemProperties.get(Constants.PROP_UPDATER_URI);
if (serverUrl.trim().isEmpty()) {
serverUrl = context.getString(R.string.updater_server_url);
}
return serverUrl.replace("{device}", device)
.replace("{type}", type)
.replace("{incr}", incrementalVersion);
}
public static String getChangelogURL(Context context) {