Merge "Make notice order more deterministic."
diff --git a/core/Makefile b/core/Makefile
index b95d2ad..a802a4c 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -5065,8 +5065,8 @@
 endif
 
 INTERNAL_OTATOOLS_RELEASETOOLS := \
-  $(sort $(shell find build/make/tools/releasetools -name "*.pyc" -prune -o \
-      \( -type f -o -type l \) -print))
+  $(shell find build/make/tools/releasetools -name "*.pyc" -prune -o \
+      \( -type f -o -type l \) -print | sort)
 
 BUILT_OTATOOLS_PACKAGE := $(PRODUCT_OUT)/otatools.zip
 $(BUILT_OTATOOLS_PACKAGE): PRIVATE_ZIP_ROOT := $(call intermediates-dir-for,PACKAGING,otatools)/otatools
diff --git a/finalize-step-1.sh b/finalize-step-1.sh
index e723402..e8afba4 100755
--- a/finalize-step-1.sh
+++ b/finalize-step-1.sh
@@ -15,6 +15,17 @@
         if [[ $previousHash ]]; then git revert --no-commit $previousHash ; fi ;'
 }
 
+function commit_changes() {
+    repo forall -c '\
+        if [[ $(git status --short) ]]; then
+            repo start fina-step1 ;
+            git add -A . ;
+            git commit -m FINALIZATION_STEP_1_SCRIPT_COMMIT -m WILL_BE_AUTOMATICALLY_REVERTED ;
+            repo upload --cbr --no-verify -t -y . ;
+            git clean -fdx ; git reset --hard ;
+        fi'
+}
+
 function finalize_step_1_main() {
     local top="$(dirname "$0")"/../..
 
@@ -26,7 +37,7 @@
     source $top/build/make/finalize-aidl-vndk-sdk-resources.sh
 
     # move all changes to fina-step1 branch and commit with a robot message
-    repo forall -c 'if [[ $(git status --short) ]]; then repo start fina-step1 ; git add -A . ; git commit -m FINALIZATION_STEP_1_SCRIPT_COMMIT -m WILL_BE_AUTOMATICALLY_REVERTED ; repo upload --cbr --no-verify -t -y . ; fi'
+    commit_changes
 }
 
 finalize_step_1_main
diff --git a/help.sh b/help.sh
index e51adc1..c405959 100755
--- a/help.sh
+++ b/help.sh
@@ -26,6 +26,8 @@
     clean                   (aka clobber) equivalent to rm -rf out/
     checkbuild              Build every module defined in the source tree
     droid                   Default target
+    sync                    Build everything in the default target except the images,
+                            for use with adb sync.
     nothing                 Do not build anything, just parse and validate the build structure
 
     java                    Build all the java code in the source tree