summaryrefslogtreecommitdiffstats
path: root/updater_sample/src/com/example/android/systemupdatersample/UpdateConfig.java
diff options
context:
space:
mode:
authorZhomart Mukhamejanov <zhomart@google.com>2018-05-10 20:10:09 +0200
committerandroid-build-merger <android-build-merger@google.com>2018-05-10 20:10:09 +0200
commit775cdd1c76f6f775f7598895a10c7da616fd8a61 (patch)
tree62b730a9ec2b90a543660c96d7ce6013a5307e59 /updater_sample/src/com/example/android/systemupdatersample/UpdateConfig.java
parentMerge "screen_ui: Fix an issue when displaying wrapped text." am: 1d4ef4ba4b (diff)
parentMerge "updater_sample: add http header demo" (diff)
downloadandroid_bootable_recovery-775cdd1c76f6f775f7598895a10c7da616fd8a61.tar
android_bootable_recovery-775cdd1c76f6f775f7598895a10c7da616fd8a61.tar.gz
android_bootable_recovery-775cdd1c76f6f775f7598895a10c7da616fd8a61.tar.bz2
android_bootable_recovery-775cdd1c76f6f775f7598895a10c7da616fd8a61.tar.lz
android_bootable_recovery-775cdd1c76f6f775f7598895a10c7da616fd8a61.tar.xz
android_bootable_recovery-775cdd1c76f6f775f7598895a10c7da616fd8a61.tar.zst
android_bootable_recovery-775cdd1c76f6f775f7598895a10c7da616fd8a61.zip
Diffstat (limited to 'updater_sample/src/com/example/android/systemupdatersample/UpdateConfig.java')
-rw-r--r--updater_sample/src/com/example/android/systemupdatersample/UpdateConfig.java20
1 files changed, 14 insertions, 6 deletions
diff --git a/updater_sample/src/com/example/android/systemupdatersample/UpdateConfig.java b/updater_sample/src/com/example/android/systemupdatersample/UpdateConfig.java
index 1851724ed..b08bfd0f6 100644
--- a/updater_sample/src/com/example/android/systemupdatersample/UpdateConfig.java
+++ b/updater_sample/src/com/example/android/systemupdatersample/UpdateConfig.java
@@ -25,6 +25,7 @@ import org.json.JSONObject;
import java.io.File;
import java.io.Serializable;
+import java.util.Optional;
/**
* An update description. It will be parsed from JSON, which is intended to
@@ -78,7 +79,9 @@ public class UpdateConfig implements Parcelable {
p.getLong("offset"),
p.getLong("size"));
}
- c.mAbStreamingMetadata = new StreamingMetadata(propertyFiles);
+ c.mAbStreamingMetadata = new StreamingMetadata(
+ propertyFiles,
+ meta.getString("authorization_token"));
}
c.mRawJson = json;
return c;
@@ -178,17 +181,23 @@ public class UpdateConfig implements Parcelable {
/** defines beginning of update data in archive */
private PackageFile[] mPropertyFiles;
- public StreamingMetadata() {
- mPropertyFiles = new PackageFile[0];
- }
+ /** SystemUpdaterSample receives the authorization token from the OTA server, in addition
+ * to the package URL. It passes on the info to update_engine, so that the latter can
+ * fetch the data from the package server directly with the token. */
+ private String mAuthorization;
- public StreamingMetadata(PackageFile[] propertyFiles) {
+ public StreamingMetadata(PackageFile[] propertyFiles, String authorization) {
this.mPropertyFiles = propertyFiles;
+ this.mAuthorization = authorization;
}
public PackageFile[] getPropertyFiles() {
return mPropertyFiles;
}
+
+ public Optional<String> getAuthorization() {
+ return Optional.of(mAuthorization);
+ }
}
/**
@@ -224,7 +233,6 @@ public class UpdateConfig implements Parcelable {
public long getSize() {
return mSize;
}
-
}
}