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/ui/MainActivity.java b/updater_sample/src/com/example/android/systemupdatersample/ui/MainActivity.java
index d6a6ce3..359e2b1 100644
--- a/updater_sample/src/com/example/android/systemupdatersample/ui/MainActivity.java
+++ b/updater_sample/src/com/example/android/systemupdatersample/ui/MainActivity.java
@@ -34,6 +34,7 @@
import com.example.android.systemupdatersample.PayloadSpec;
import com.example.android.systemupdatersample.R;
import com.example.android.systemupdatersample.UpdateConfig;
+import com.example.android.systemupdatersample.services.PrepareStreamingService;
import com.example.android.systemupdatersample.util.PayloadSpecs;
import com.example.android.systemupdatersample.util.UpdateConfigs;
import com.example.android.systemupdatersample.util.UpdateEngineErrorCodes;
@@ -297,6 +298,17 @@
updateEngineApplyPayload(payload);
} else {
Log.d(TAG, "Starting PrepareStreamingService");
+ PrepareStreamingService.startService(this, config, (code, payloadSpec) -> {
+ if (code == PrepareStreamingService.RESULT_CODE_SUCCESS) {
+ updateEngineApplyPayload(payloadSpec);
+ } else {
+ Log.e(TAG, "PrepareStreamingService failed, result code is " + code);
+ Toast.makeText(
+ MainActivity.this,
+ "PrepareStreamingService failed, result code is " + code,
+ Toast.LENGTH_LONG).show();
+ }
+ });
}
}