Call SkipInstall before InstallFile

InstallFile skips install only if SkipInstall is called before
InstallFile.

Bug: 190442286
Test: build/soong/scripts/build-ndk-prebuilts.sh
Change-Id: Ic497e34816ea5ac23be45e34c242b59bf1a01e28
diff --git a/build/soong/policy.go b/build/soong/policy.go
index 75fbdf1..604014f 100644
--- a/build/soong/policy.go
+++ b/build/soong/policy.go
@@ -175,13 +175,13 @@
 }
 
 func (c *policyConf) GenerateAndroidBuildActions(ctx android.ModuleContext) {
-	c.installSource = c.transformPolicyToConf(ctx)
-	c.installPath = android.PathForModuleInstall(ctx, "etc")
-	ctx.InstallFile(c.installPath, c.stem(), c.installSource)
-
 	if !c.installable() {
 		c.SkipInstall()
 	}
+
+	c.installSource = c.transformPolicyToConf(ctx)
+	c.installPath = android.PathForModuleInstall(ctx, "etc")
+	ctx.InstallFile(c.installPath, c.stem(), c.installSource)
 }
 
 func (c *policyConf) AndroidMkEntries() []android.AndroidMkEntries {
@@ -325,6 +325,10 @@
 	conf := android.PathForModuleSrc(ctx, *c.properties.Src)
 	cil := c.compileConfToCil(ctx, conf)
 
+	if !c.Installable() {
+		c.SkipInstall()
+	}
+
 	if c.InstallInDebugRamdisk() {
 		// for userdebug_plat_sepolicy.cil
 		c.installPath = android.PathForModuleInstall(ctx)
@@ -333,10 +337,6 @@
 	}
 	c.installSource = cil
 	ctx.InstallFile(c.installPath, c.stem(), c.installSource)
-
-	if !c.Installable() {
-		c.SkipInstall()
-	}
 }
 
 func (c *policyCil) AndroidMkEntries() []android.AndroidMkEntries {