Fix incorrect install path for priv-app prebuilt

Dexpreopted files for privleged app prebuilt(android_app_import) are
installed wrongly to /system/app.
To fix this issue, install path is changed to /system/priv-app
in the case that "privileged" flag is true.

Bug: 144945646
Test: build and check dexpreopted files of privileged app are
      installed to /system/priv-app

Change-Id: Iec140119f58179a3eb0feeff7af2699fcc855fe7
diff --git a/java/app.go b/java/app.go
old mode 100644
new mode 100755
index c635703..c772e47
--- a/java/app.go
+++ b/java/app.go
@@ -974,7 +974,13 @@
 	jnisUncompressed := android.PathForModuleOut(ctx, "jnis-uncompressed", ctx.ModuleName()+".apk")
 	a.uncompressEmbeddedJniLibs(ctx, srcApk, jnisUncompressed.OutputPath)
 
-	installDir := android.PathForModuleInstall(ctx, "app", a.BaseModuleName())
+	var installDir android.InstallPath
+	if Bool(a.properties.Privileged) {
+		installDir = android.PathForModuleInstall(ctx, "priv-app", a.BaseModuleName())
+	} else {
+		installDir = android.PathForModuleInstall(ctx, "app", a.BaseModuleName())
+	}
+
 	a.dexpreopter.installPath = installDir.Join(ctx, a.BaseModuleName()+".apk")
 	a.dexpreopter.isInstallable = true
 	a.dexpreopter.isPresignedPrebuilt = Bool(a.properties.Presigned)