summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2016-08-16 17:43:33 -0700
committerAndreas Gampe <agampe@google.com>2016-08-16 17:43:33 -0700
commit90ba9eb2f155a4123ec4c8b08863572360d55776 (patch)
tree2b44623d8190a66cdf4eb6ce58c37489f6afdbdd
parente7d555267725ca050ddd5e891267a61a55c9e16a (diff)
downloadnative-90ba9eb2f155a4123ec4c8b08863572360d55776.tar.gz
Otapreopt: Allow A/B dexopt only when bootcomplete
Under certain circumstances cmd may not return because it is waiting for a service manager. Avoid this situation by restricting the otapreopt script to only do work when the system has completed boot (which means that a service manager must exist). Bug: 30797145 Change-Id: Ic1445e20f1ca06fb38e7707771bde818836c3adc
-rw-r--r--cmds/installd/otapreopt_script.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/cmds/installd/otapreopt_script.sh b/cmds/installd/otapreopt_script.sh
index 8af4a901f5..f950276090 100644
--- a/cmds/installd/otapreopt_script.sh
+++ b/cmds/installd/otapreopt_script.sh
@@ -24,6 +24,19 @@ STATUS_FD="$2"
# Maximum number of packages/steps.
MAXIMUM_PACKAGES=1000
+# First ensure the system is booted. This is to work around issues when cmd would
+# infinitely loop trying to get a service manager (which will never come up in that
+# mode). b/30797145
+BOOT_PROPERTY_NAME="dev.bootcomplete"
+
+BOOT_COMPLETE=$(getprop $BOOT_PROPERTY_NAME)
+if [ "$BOOT_COMPLETE" != "1" ] ; then
+ echo "Error: boot-complete not detected."
+ # We must return 0 to not block sideload.
+ exit 0
+fi
+
+
# Compute target slot suffix.
# TODO: Once bootctl is not restricted, we should query from there. Or get this from
# update_engine as a parameter.