Output dex_preopt to SDK snapshot.
This is needed to determine whether we need to deapex the profile or
not.
Bug: 241823638
Test: m nothing
Test: -
1. Patch ag/20582608 PS2.
2. TARGET_BUILD_APPS=com.android.wifi packages/modules/common/build/mainline_modules_sdks.sh
3. See the `dex_preopt` property being written.
Change-Id: I05177388c24be1ab315247ea85e7e3a8600cebd3
diff --git a/java/sdk_library.go b/java/sdk_library.go
index a2295f4..0478011 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -2201,7 +2201,7 @@
allScopeProperties, scopeToProperties := createPropertiesInstance()
module.scopeProperties = scopeToProperties
- module.AddProperties(&module.properties, allScopeProperties)
+ module.AddProperties(&module.properties, allScopeProperties, &module.importDexpreoptProperties)
// Initialize information common between source and prebuilt.
module.initCommon(module)
@@ -2994,6 +2994,8 @@
//
// This means that the device won't recognise this library as installed.
Max_device_sdk *string
+
+ DexPreoptProfileGuided *bool `supported_build_releases:"UpsideDownCake+"`
}
type scopeProperties struct {
@@ -3047,6 +3049,10 @@
s.On_bootclasspath_before = sdk.commonSdkLibraryProperties.On_bootclasspath_before
s.Min_device_sdk = sdk.commonSdkLibraryProperties.Min_device_sdk
s.Max_device_sdk = sdk.commonSdkLibraryProperties.Max_device_sdk
+
+ if sdk.dexpreopter.dexpreoptProperties.Dex_preopt_result.Profile_guided {
+ s.DexPreoptProfileGuided = proptools.BoolPtr(true)
+ }
}
func (s *sdkLibrarySdkMemberProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) {
@@ -3062,6 +3068,10 @@
if len(s.Permitted_packages) > 0 {
propertySet.AddProperty("permitted_packages", s.Permitted_packages)
}
+ dexPreoptSet := propertySet.AddPropertySet("dex_preopt")
+ if s.DexPreoptProfileGuided != nil {
+ dexPreoptSet.AddProperty("profile_guided", proptools.Bool(s.DexPreoptProfileGuided))
+ }
stem := s.Stem