otapreopt: Collect and print size of artifacts
Collect and print the size of artifacts when moving after a reboot.
This helps in diagnosing issues after the fact.
Bug: 30832951
Change-Id: Iee410adf59dcbb74fa4b49edb27d028025cd8bf9
diff --git a/cmds/installd/otapreopt_slot.sh b/cmds/installd/otapreopt_slot.sh
index d51ab70..b5786e9 100644
--- a/cmds/installd/otapreopt_slot.sh
+++ b/cmds/installd/otapreopt_slot.sh
@@ -22,10 +22,13 @@
if test -n "$SLOT_SUFFIX" ; then
if test -d /data/ota/$SLOT_SUFFIX/dalvik-cache ; then
log -p i -t otapreopt_slot "Moving A/B artifacts for slot ${SLOT_SUFFIX}."
+ OLD_SIZE=$(du -h -s /data/dalvik-cache)
rm -rf /data/dalvik-cache/*
+ NEW_SIZE=$(du -h -s /data/ota/$SLOT_SUFFIX/dalvik-cache)
mv /data/ota/$SLOT_SUFFIX/dalvik-cache/* /data/dalvik-cache/
rmdir /data/ota/$SLOT_SUFFIX/dalvik-cache
rmdir /data/ota/$SLOT_SUFFIX
+ log -p i -t otapreopt_slot "Moved ${NEW_SIZE} over ${OLD_SIZE}"
else
log -p i -t otapreopt_slot "No A/B artifacts found for slot ${SLOT_SUFFIX}."
fi