updater_sample: add streaming support

- UpdateConfigs: add helper methods for streaming
- add PrepareStreamingService intent service

Test: manually and junit4
Bug: 77148143
Change-Id: I61711eb9abe051987e725fbd94f8cd029ff21dd3
diff --git a/updater_sample/src/com/example/android/systemupdatersample/util/FileDownloader.java b/updater_sample/src/com/example/android/systemupdatersample/util/FileDownloader.java
index 5c1d711..ddd0919 100644
--- a/updater_sample/src/com/example/android/systemupdatersample/util/FileDownloader.java
+++ b/updater_sample/src/com/example/android/systemupdatersample/util/FileDownloader.java
@@ -38,22 +38,23 @@
     private String mUrl;
     private long mOffset;
     private long mSize;
-    private File mOut;
+    private File mDestination;
 
-    public FileDownloader(String url, long offset, long size, File out) {
+    public FileDownloader(String url, long offset, long size, File destination) {
         this.mUrl = url;
         this.mOffset = offset;
         this.mSize = size;
-        this.mOut = out;
+        this.mDestination = destination;
     }
 
     /**
      * Downloads the file with given offset and size.
+     * @throws IOException when can't download the file
      */
     public void download() throws IOException {
-        Log.d("FileDownloader", "downloading " + mOut.getName()
+        Log.d("FileDownloader", "downloading " + mDestination.getName()
                 + " from " + mUrl
-                + " to " + mOut.getAbsolutePath());
+                + " to " + mDestination.getAbsolutePath());
 
         URL url = new URL(mUrl);
         URLConnection connection = url.openConnection();
@@ -61,7 +62,7 @@
 
         // download the file
         try (InputStream input = connection.getInputStream()) {
-            try (OutputStream output = new FileOutputStream(mOut)) {
+            try (OutputStream output = new FileOutputStream(mDestination)) {
                 long skipped = input.skip(mOffset);
                 if (skipped != mOffset) {
                     throw new IOException("Can't download file "