Merge "updater_sample: fix UpdateConfig"
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"__name": "name will be visible on UI",
|
"__name": "name will be visible on UI",
|
||||||
"__url": "https:// or file:// uri to update package (zip, xz, ...)",
|
"__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",
|
"name": "SAMPLE-cake-release BUILD-12345",
|
||||||
"url": "http://foo.bar/builds/ota-001.zip",
|
"url": "http://foo.bar/builds/ota-001.zip",
|
||||||
"ab_install_type": "NON_STREAMING",
|
"ab_install_type": "NON_STREAMING",
|
||||||
|
|||||||
@@ -79,9 +79,13 @@ public class UpdateConfig implements Parcelable {
|
|||||||
p.getLong("offset"),
|
p.getLong("offset"),
|
||||||
p.getLong("size"));
|
p.getLong("size"));
|
||||||
}
|
}
|
||||||
|
String authorization = null;
|
||||||
|
if (meta.has("authorization")) {
|
||||||
|
authorization = meta.getString("authorization");
|
||||||
|
}
|
||||||
c.mAbStreamingMetadata = new StreamingMetadata(
|
c.mAbStreamingMetadata = new StreamingMetadata(
|
||||||
propertyFiles,
|
propertyFiles,
|
||||||
meta.getString("authorization_token"));
|
authorization);
|
||||||
}
|
}
|
||||||
c.mRawJson = json;
|
c.mRawJson = json;
|
||||||
return c;
|
return c;
|
||||||
@@ -196,7 +200,7 @@ public class UpdateConfig implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Optional<String> getAuthorization() {
|
public Optional<String> getAuthorization() {
|
||||||
return Optional.of(mAuthorization);
|
return mAuthorization == null ? Optional.empty() : Optional.of(mAuthorization);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.example.android.systemupdatersample.util;
|
package com.example.android.systemupdatersample.util;
|
||||||
|
|
||||||
import static junit.framework.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.test.InstrumentationRegistry;
|
import android.support.test.InstrumentationRegistry;
|
||||||
|
|||||||
Reference in New Issue
Block a user