summaryrefslogtreecommitdiff
path: root/java/dexpreopt.go
diff options
context:
space:
mode:
Diffstat (limited to 'java/dexpreopt.go')
-rw-r--r--java/dexpreopt.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/java/dexpreopt.go b/java/dexpreopt.go
index 57aaa1a2d..794924401 100644
--- a/java/dexpreopt.go
+++ b/java/dexpreopt.go
@@ -96,6 +96,10 @@ func (install dexpreopterInstall) ToMakeEntries() android.AndroidMkEntries {
}
}
+func (install dexpreopterInstall) PackageFile(ctx android.ModuleContext) android.PackagingSpec {
+ return ctx.PackageFile(install.installDirOnDevice, install.installFileOnDevice, install.outputPathOnHost)
+}
+
type Dexpreopter struct {
dexpreopter
}
@@ -541,10 +545,18 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, libName string, dexJa
// Use the path of the dex file to determine the library name
isApexSystemServerJar := global.AllApexSystemServerJars(ctx).ContainsJar(dexJarStem)
- partition := d.installPath.Partition()
+ dexpreoptPartition := d.installPath.Partition()
+ // dexpreoptPartition is set to empty for dexpreopts of system APEX and system_other.
+ // In case of system APEX, however, we can set it to "system" manually.
+ // TODO(b/346662300): Let dexpreopter generate the installPath for dexpreopt files instead of
+ // using the dex location to generate the installPath.
+ if isApexSystemServerJar {
+ dexpreoptPartition = "system"
+ }
for _, install := range dexpreoptRule.Installs() {
// Remove the "/" prefix because the path should be relative to $ANDROID_PRODUCT_OUT.
installDir := strings.TrimPrefix(filepath.Dir(install.To), "/")
+ partition := dexpreoptPartition
if strings.HasPrefix(installDir, partition+"/") {
installDir = strings.TrimPrefix(installDir, partition+"/")
} else {