Merge changes If15abf79,Iaae177ef

* changes:
  Add manifest_check tool
  Move manifest_fixer to a python_binary_host module
diff --git a/cc/androidmk.go b/cc/androidmk.go
index ae34e3d..32ccf4c 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -90,6 +90,9 @@
 				fmt.Fprintln(w, "LOCAL_SOONG_LINK_TYPE :=", c.makeLinkType)
 				if c.useVndk() {
 					fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
+					if c.isVndk() && !c.static() {
+						fmt.Fprintln(w, "LOCAL_SOONG_VNDK_VERSION := "+c.vndkVersion())
+					}
 				}
 			},
 		},
diff --git a/cc/cc.go b/cc/cc.go
index 2e551e1..4600a15 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -534,6 +534,13 @@
 	return false
 }
 
+func (c *Module) vndkVersion() string {
+	if vndkdep := c.vndkdep; vndkdep != nil {
+		return vndkdep.Properties.Vndk.Version
+	}
+	return ""
+}
+
 func (c *Module) isPgoCompile() bool {
 	if pgo := c.pgo; pgo != nil {
 		return pgo.Properties.PgoCompile
diff --git a/cc/vndk.go b/cc/vndk.go
index a1d67af..60a3d78 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -49,6 +49,10 @@
 
 		// Extending another module
 		Extends *string
+
+		// for vndk_prebuilt_shared, this is set by "version" property.
+		// Otherwise, this is set as PLATFORM_VNDK_VERSION.
+		Version string `blueprint:"mutated"`
 	}
 }
 
@@ -325,6 +329,14 @@
 		return
 	}
 
+	if m.isVndk() {
+		if lib, ok := m.linker.(*vndkPrebuiltLibraryDecorator); ok {
+			m.vndkdep.Properties.Vndk.Version = lib.version()
+		} else {
+			m.vndkdep.Properties.Vndk.Version = mctx.DeviceConfig().PlatformVndkVersion()
+		}
+	}
+
 	if _, ok := m.linker.(*llndkStubDecorator); ok {
 		processLlndkLibrary(mctx, m)
 		return
diff --git a/scripts/build_broken_logs.go b/scripts/build_broken_logs.go
index 4f3e0de..bdd4b2a 100644
--- a/scripts/build_broken_logs.go
+++ b/scripts/build_broken_logs.go
@@ -70,13 +70,6 @@
 		warnings: []string{"export_keyword"},
 	},
 	{
-		name:     "BUILD_BROKEN_ENG_DEBUG_TAGS",
-		behavior: DefaultDeprecated,
-		warnings: []string{
-			"Changes.md#LOCAL_MODULE_TAGS",
-		},
-	},
-	{
 		name:     "BUILD_BROKEN_USES_NETWORK",
 		behavior: DefaultDeprecated,
 	},
diff --git a/ui/build/dumpvars.go b/ui/build/dumpvars.go
index c6e5ddc..9fd6f67 100644
--- a/ui/build/dumpvars.go
+++ b/ui/build/dumpvars.go
@@ -206,7 +206,6 @@
 		// Not used, but useful to be in the soong.log
 		"BOARD_VNDK_VERSION",
 		"BUILD_BROKEN_ANDROIDMK_EXPORTS",
-		"BUILD_BROKEN_ENG_DEBUG_TAGS",
 
 		"DEFAULT_WARNING_BUILD_MODULE_TYPES",
 		"DEFAULT_ERROR_BUILD_MODULE_TYPES",
diff --git a/ui/build/proc_sync.go b/ui/build/proc_sync.go
index 857786d..0cfe798 100644
--- a/ui/build/proc_sync.go
+++ b/ui/build/proc_sync.go
@@ -34,6 +34,14 @@
 	if err != nil {
 		ctx.Logger.Fatal(err)
 	}
+	lockfilePollDuration := time.Second
+	lockfileTimeout := time.Second * 10
+	if envTimeout := os.Getenv("SOONG_LOCK_TIMEOUT"); envTimeout != "" {
+		lockfileTimeout, err = time.ParseDuration(envTimeout)
+		if err != nil {
+			ctx.Logger.Fatalf("failure parsing SOONG_LOCK_TIMEOUT %q: %s", envTimeout, err)
+		}
+	}
 	err = lockSynchronous(*lockingInfo, newSleepWaiter(lockfilePollDuration, lockfileTimeout), ctx.Logger)
 	if err != nil {
 		ctx.Logger.Fatal(err)
@@ -41,9 +49,6 @@
 	return lockingInfo
 }
 
-var lockfileTimeout = time.Second * 10
-var lockfilePollDuration = time.Second
-
 type lockable interface {
 	tryLock() error
 	Unlock() error
@@ -80,15 +85,18 @@
 			return nil
 		}
 
-		waited = true
-
 		done, description := waiter.checkDeadline()
 
+		if !waited {
+			logger.Printf("Waiting up to %s to lock %v to ensure no other Soong process is running in the same output directory\n", description, lock.description())
+		}
+
+		waited = true
+
 		if done {
 			return fmt.Errorf("Tried to lock %s, but timed out %s . Make sure no other Soong process is using it",
 				lock.description(), waiter.summarize())
 		} else {
-			logger.Printf("Waiting up to %s to lock %v to ensure no other Soong process is running in the same output directory\n", description, lock.description())
 			waiter.wait()
 		}
 	}