Parse postinstall program progress updates.
In Android postinstall is expected to take a long time in common cases.
This patch allows the postinstall program to report back to the updater
a progress indication, which will then be forwarded to all the clients
listening. These progress updates are part of the FINALIZING status.
Bug: 27880754
TEST=Added unittests. Deployed an update to an edison-eng and post-install reported progress back with the postinstall_example.
(cherry picked from commit 0d29854cf5bb05a22cf161b50052539aa420a36e)
Change-Id: I003e996bd5a9acccfc83012345351174d269107c
diff --git a/sample_images/generate_images.sh b/sample_images/generate_images.sh
index b461175..c098e39 100755
--- a/sample_images/generate_images.sh
+++ b/sample_images/generate_images.sh
@@ -166,6 +166,17 @@
exit 1
EOF
+ # A program that reports back progress.
+ sudo tee "${mntdir}"/bin/postinst_progress >/dev/null <<EOF
+#!/etc/../bin/sh
+# These values have exact representation in IEEE 754 so we avoid rounding
+# errors.
+echo global_progress 0.25 >&3
+echo global_progress 0.5 >&3
+echo global_progress 1.0 >&3
+exit 0
+EOF
+
# A postinstall bash program.
sudo tee "${mntdir}"/bin/self_check_context >/dev/null <<EOF
#!/etc/../bin/sh