From 2fbc355f47e3576e3389051b21e1df2a7b868577 Mon Sep 17 00:00:00 2001 From: Jiakai Zhang Date: Mon, 28 Nov 2022 15:38:23 +0000 Subject: [PATCH] Only dexpreopt system server jars for the primary arch. This change stops the build system from dexpreopting system server jars for the secondary arch. System server jars are only loaded by the system server, so the artifacts for the the secondary arch are not used. Bug: 260577273 Test: Build a system image and no longer see artifacts for the secondary arch. Change-Id: I0b131a02e996ed50e7aec3bb0a221f8ceed9ce57 --- java/dexpreopt.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/java/dexpreopt.go b/java/dexpreopt.go index 0adaf9917..77cbe9cf4 100644 --- a/java/dexpreopt.go +++ b/java/dexpreopt.go @@ -269,8 +269,10 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr targets = append(targets, target) } } - if isSystemServerJar && !d.isSDKLibrary { - // If the module is not an SDK library and it's a system server jar, only preopt the primary arch. + if isSystemServerJar && moduleName(ctx) != "com.android.location.provider" { + // If the module is a system server jar, only preopt for the primary arch because the jar can + // only be loaded by system server. "com.android.location.provider" is a special case because + // it's also used by apps as a shared library. targets = targets[:1] } }