Turn installation on in mega device build

Turn on installation in the mega device build, it is necessary for the ndk
sysroot installation.  Partially fixes mega device builds, they also need
to run without -w dupbuild=err on the ninja command line because multiple
variants of the same architecture try to install to the same ndk sysroot.

Test: mega device build
Change-Id: I982d77f9ff19f5bc29fc9fe54a0df8db3579c3e3
diff --git a/android/config.go b/android/config.go
index 8efa642..8be16cf 100644
--- a/android/config.go
+++ b/android/config.go
@@ -390,7 +390,12 @@
 }
 
 func (c *config) SkipDeviceInstall() bool {
-	return c.EmbeddedInMake() || Bool(c.Mega_device)
+	return c.EmbeddedInMake()
+}
+
+func (c *config) SkipMegaDeviceInstall(path string) bool {
+	return Bool(c.Mega_device) &&
+		strings.HasPrefix(path, filepath.Join(c.buildDir, "target", "product"))
 }
 
 func (c *config) SanitizeHost() []string {
diff --git a/android/module.go b/android/module.go
index d485fbc..a38c617 100644
--- a/android/module.go
+++ b/android/module.go
@@ -647,14 +647,31 @@
 	return a.module.InstallInSanitizerDir()
 }
 
+func (a *androidModuleContext) skipInstall(fullInstallPath OutputPath) bool {
+	if a.module.base().commonProperties.SkipInstall {
+		return true
+	}
+
+	if a.Device() {
+		if a.AConfig().SkipDeviceInstall() {
+			return true
+		}
+
+		if a.AConfig().SkipMegaDeviceInstall(fullInstallPath.String()) {
+			return true
+		}
+	}
+
+	return false
+}
+
 func (a *androidModuleContext) InstallFileName(installPath OutputPath, name string, srcPath Path,
 	deps ...Path) OutputPath {
 
 	fullInstallPath := installPath.Join(a, name)
 	a.module.base().hooks.runInstallHooks(a, fullInstallPath, false)
 
-	if !a.module.base().commonProperties.SkipInstall &&
-		(!a.Device() || !a.AConfig().SkipDeviceInstall()) {
+	if !a.skipInstall(fullInstallPath) {
 
 		deps = append(deps, a.installDeps...)
 
@@ -691,8 +708,7 @@
 	fullInstallPath := installPath.Join(a, name)
 	a.module.base().hooks.runInstallHooks(a, fullInstallPath, true)
 
-	if !a.module.base().commonProperties.SkipInstall &&
-		(!a.Device() || !a.AConfig().SkipDeviceInstall()) {
+	if !a.skipInstall(fullInstallPath) {
 
 		a.ModuleBuild(pctx, ModuleBuildParams{
 			Rule:      Symlink,