summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhomart Mukhamejanov <zhomart@google.com>2018-05-10 23:45:03 +0200
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-05-10 23:45:03 +0200
commit7217e7045de6d86fdeb0230f354a9fb7ff6884df (patch)
tree51fe2e69094925fe64814351bc654d59fb124e91
parentMerge "updater_sample: add http header demo" (diff)
parentupdater_sample: fix UpdateConfig (diff)
downloadandroid_bootable_recovery-7217e7045de6d86fdeb0230f354a9fb7ff6884df.tar
android_bootable_recovery-7217e7045de6d86fdeb0230f354a9fb7ff6884df.tar.gz
android_bootable_recovery-7217e7045de6d86fdeb0230f354a9fb7ff6884df.tar.bz2
android_bootable_recovery-7217e7045de6d86fdeb0230f354a9fb7ff6884df.tar.lz
android_bootable_recovery-7217e7045de6d86fdeb0230f354a9fb7ff6884df.tar.xz
android_bootable_recovery-7217e7045de6d86fdeb0230f354a9fb7ff6884df.tar.zst
android_bootable_recovery-7217e7045de6d86fdeb0230f354a9fb7ff6884df.zip
-rw-r--r--updater_sample/res/raw/sample.json2
-rw-r--r--updater_sample/src/com/example/android/systemupdatersample/UpdateConfig.java8
-rw-r--r--updater_sample/tests/src/com/example/android/systemupdatersample/util/FileDownloaderTest.java2
3 files changed, 8 insertions, 4 deletions
diff --git a/updater_sample/res/raw/sample.json b/updater_sample/res/raw/sample.json
index 7ac8ffab7..46fbfa33e 100644
--- a/updater_sample/res/raw/sample.json
+++ b/updater_sample/res/raw/sample.json
@@ -1,7 +1,7 @@
{
"__name": "name will be visible on UI",
"__url": "https:// or file:// uri to update package (zip, xz, ...)",
- "__type": "NON_STREAMING (from a local file) OR STREAMING (on the fly)",
+ "__ab_install_type": "NON_STREAMING (from a local file) OR STREAMING (on the fly)",
"name": "SAMPLE-cake-release BUILD-12345",
"url": "http://foo.bar/builds/ota-001.zip",
"ab_install_type": "NON_STREAMING",
diff --git a/updater_sample/src/com/example/android/systemupdatersample/UpdateConfig.java b/updater_sample/src/com/example/android/systemupdatersample/UpdateConfig.java
index b08bfd0f6..9bdd8b9e8 100644
--- a/updater_sample/src/com/example/android/systemupdatersample/UpdateConfig.java
+++ b/updater_sample/src/com/example/android/systemupdatersample/UpdateConfig.java
@@ -79,9 +79,13 @@ public class UpdateConfig implements Parcelable {
p.getLong("offset"),
p.getLong("size"));
}
+ String authorization = null;
+ if (meta.has("authorization")) {
+ authorization = meta.getString("authorization");
+ }
c.mAbStreamingMetadata = new StreamingMetadata(
propertyFiles,
- meta.getString("authorization_token"));
+ authorization);
}
c.mRawJson = json;
return c;
@@ -196,7 +200,7 @@ public class UpdateConfig implements Parcelable {
}
public Optional<String> getAuthorization() {
- return Optional.of(mAuthorization);
+ return mAuthorization == null ? Optional.empty() : Optional.of(mAuthorization);
}
}
diff --git a/updater_sample/tests/src/com/example/android/systemupdatersample/util/FileDownloaderTest.java b/updater_sample/tests/src/com/example/android/systemupdatersample/util/FileDownloaderTest.java
index 009610e86..a136ff0ed 100644
--- a/updater_sample/tests/src/com/example/android/systemupdatersample/util/FileDownloaderTest.java
+++ b/updater_sample/tests/src/com/example/android/systemupdatersample/util/FileDownloaderTest.java
@@ -16,7 +16,7 @@
package com.example.android.systemupdatersample.util;
-import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertEquals;
import android.content.Context;
import android.support.test.InstrumentationRegistry;