Stop all these merge conflicts.

Test: mma -j64
Change-Id: I319198af32adf1fef180c5c2c22ba4b360fa7609
diff --git a/update-makefiles.sh b/update-makefiles.sh
index 939a9c7..8b82013 100755
--- a/update-makefiles.sh
+++ b/update-makefiles.sh
@@ -18,17 +18,28 @@
   hidl-gen -Landroidbp -r android.hardware:hardware/interfaces $p;
 done
 
-bp="hardware/interfaces/Android.bp"
-androidbps=$(find hardware/interfaces/*/      \
-             -name "Android.bp"               \
-             -exec dirname {} \;              \
-             | sort)
+# subdirectories of hardware/interfaces which contain an Android.bp file
+android_dirs=$(find hardware/interfaces/*/     \
+              -name "Android.bp"               \
+              -printf "%h\n"                   \
+              | cut -d "/" -f1-3               \
+              | sort | uniq)
 
-echo "Updating $bp"
+echo "Updating Android.bp files."
 
-echo "// This is an autogenerated file, do not edit." > $bp;
-echo "subdirs = [" >> $bp;
-for a in $androidbps; do
-  echo "    \"${a#*hardware/interfaces/}\"," >> $bp;
+for bp_dir in $android_dirs; do
+  bp="$bp_dir/Android.bp"
+  # locations of Android.bp files in specific subdirectory of hardware/interfaces
+  android_bps=$(find $bp_dir                   \
+                -name "Android.bp"             \
+                ! -path $bp_dir/Android.bp     \
+                -printf "%h\n"                 \
+                | sort)
+
+  echo "// This is an autogenerated file, do not edit." > "$bp";
+  echo "subdirs = [" >> "$bp";
+  for a in $android_bps; do
+    echo "    \"${a#$bp_dir/}\"," >> "$bp";
+  done
+  echo "]" >> "$bp";
 done
-echo "]" >> $bp;
\ No newline at end of file