Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b23d28c6 authored by Ulya Trafimovich's avatar Ulya Trafimovich
Browse files

Rename fields and methods to reflect class loader context changes.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: Iebfbf2ffdac5ee48476d2aac312b3b8f4471fc85
parent a8c28e27
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -259,16 +259,16 @@ var extractAssetsRule = pctx.AndroidStaticRule("extractAssets",
	})

func (a *aapt) buildActions(ctx android.ModuleContext, sdkContext sdkContext,
	sdkLibraries dexpreopt.ClassLoaderContextMap, extraLinkFlags ...string) {
	classLoaderContexts dexpreopt.ClassLoaderContextMap, extraLinkFlags ...string) {

	transitiveStaticLibs, transitiveStaticLibManifests, staticRRODirs, assetPackages, libDeps, libFlags :=
		aaptLibs(ctx, sdkContext, sdkLibraries)
		aaptLibs(ctx, sdkContext, classLoaderContexts)

	// App manifest file
	manifestFile := proptools.StringDefault(a.aaptProperties.Manifest, "AndroidManifest.xml")
	manifestSrcPath := android.PathForModuleSrc(ctx, manifestFile)

	manifestPath := manifestFixer(ctx, manifestSrcPath, sdkContext, sdkLibraries,
	manifestPath := manifestFixer(ctx, manifestSrcPath, sdkContext, classLoaderContexts,
		a.isLibrary, a.useEmbeddedNativeLibs, a.usesNonSdkApis, a.useEmbeddedDex, a.hasNoCode,
		a.LoggingParent)

@@ -389,15 +389,15 @@ func (a *aapt) buildActions(ctx android.ModuleContext, sdkContext sdkContext,
}

// aaptLibs collects libraries from dependencies and sdk_version and converts them into paths
func aaptLibs(ctx android.ModuleContext, sdkContext sdkContext, sdkLibraries dexpreopt.ClassLoaderContextMap) (
func aaptLibs(ctx android.ModuleContext, sdkContext sdkContext, classLoaderContexts dexpreopt.ClassLoaderContextMap) (
	transitiveStaticLibs, transitiveStaticLibManifests android.Paths, staticRRODirs []rroDir, assets, deps android.Paths, flags []string) {

	var sharedLibs android.Paths

	if sdkLibraries == nil {
	if classLoaderContexts == nil {
		// Not all callers need to compute class loader context, those who don't just pass nil.
		// Create a temporary class loader context here (it will be computed, but not used).
		sdkLibraries = make(dexpreopt.ClassLoaderContextMap)
		classLoaderContexts = make(dexpreopt.ClassLoaderContextMap)
	}

	sdkDep := decodeSdkDep(ctx, sdkContext)
@@ -426,7 +426,7 @@ func aaptLibs(ctx android.ModuleContext, sdkContext sdkContext, sdkLibraries dex
			// (including the java_sdk_library) itself then append any implicit sdk library
			// names to the list of sdk libraries to be added to the manifest.
			if component, ok := module.(SdkLibraryComponentDependency); ok {
				sdkLibraries.MaybeAddContext(ctx, component.OptionalImplicitSdkLibrary(), true,
				classLoaderContexts.MaybeAddContext(ctx, component.OptionalImplicitSdkLibrary(), true,
					component.DexJarBuildPath(), component.DexJarInstallPath())
			}

@@ -439,7 +439,7 @@ func aaptLibs(ctx android.ModuleContext, sdkContext sdkContext, sdkLibraries dex
				transitiveStaticLibs = append(transitiveStaticLibs, aarDep.ExportedStaticPackages()...)
				transitiveStaticLibs = append(transitiveStaticLibs, exportPackage)
				transitiveStaticLibManifests = append(transitiveStaticLibManifests, aarDep.ExportedManifests()...)
				sdkLibraries.AddContextMap(aarDep.ExportedSdkLibs(), depName)
				classLoaderContexts.AddContextMap(aarDep.ClassLoaderContexts(), depName)
				if aarDep.ExportedAssets().Valid() {
					assets = append(assets, aarDep.ExportedAssets().Path())
				}
@@ -461,7 +461,7 @@ func aaptLibs(ctx android.ModuleContext, sdkContext sdkContext, sdkLibraries dex
		// Add nested dependencies after processing the direct dependency: if it is a <uses-library>,
		// nested context is added as its subcontext, and should not be re-added at the top-level.
		if dep, ok := module.(Dependency); ok {
			sdkLibraries.AddContextMap(dep.ExportedSdkLibs(), depName)
			classLoaderContexts.AddContextMap(dep.ClassLoaderContexts(), depName)
		}
	})

@@ -514,8 +514,8 @@ func (a *AndroidLibrary) DepsMutator(ctx android.BottomUpMutatorContext) {

func (a *AndroidLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
	a.aapt.isLibrary = true
	a.exportedSdkLibs = make(dexpreopt.ClassLoaderContextMap)
	a.aapt.buildActions(ctx, sdkContext(a), a.exportedSdkLibs)
	a.classLoaderContexts = make(dexpreopt.ClassLoaderContextMap)
	a.aapt.buildActions(ctx, sdkContext(a), a.classLoaderContexts)

	a.hideApexVariantFromMake = !ctx.Provider(android.ApexInfoProvider).(android.ApexInfo).IsForPlatform()

@@ -832,7 +832,7 @@ func (a *AARImport) AidlIncludeDirs() android.Paths {
	return nil
}

func (a *AARImport) ExportedSdkLibs() dexpreopt.ClassLoaderContextMap {
func (a *AARImport) ClassLoaderContexts() dexpreopt.ClassLoaderContextMap {
	return nil
}

+2 −2
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ var manifestMergerRule = pctx.AndroidStaticRule("manifestMerger",

// Uses manifest_fixer.py to inject minSdkVersion, etc. into an AndroidManifest.xml
func manifestFixer(ctx android.ModuleContext, manifest android.Path, sdkContext sdkContext,
	sdkLibraries dexpreopt.ClassLoaderContextMap, isLibrary, useEmbeddedNativeLibs, usesNonSdkApis,
	classLoaderContexts dexpreopt.ClassLoaderContextMap, isLibrary, useEmbeddedNativeLibs, usesNonSdkApis,
	useEmbeddedDex, hasNoCode bool, loggingParent string) android.Path {

	var args []string
@@ -71,7 +71,7 @@ func manifestFixer(ctx android.ModuleContext, manifest android.Path, sdkContext
		args = append(args, "--use-embedded-dex")
	}

	for _, usesLib := range sdkLibraries.UsesLibs() {
	for _, usesLib := range classLoaderContexts.UsesLibs() {
		if inList(usesLib, dexpreopt.OptionalCompatUsesLibs) {
			args = append(args, "--optional-uses-library", usesLib)
		} else {
+1 −1
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ func (library *Library) AndroidMkEntries() []android.AndroidMkEntries {
						entries.SetPath("LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR", library.jacocoReportClassesFile)
					}

					entries.AddStrings("LOCAL_EXPORT_SDK_LIBRARIES", library.exportedSdkLibs.UsesLibs()...)
					entries.AddStrings("LOCAL_EXPORT_SDK_LIBRARIES", library.classLoaderContexts.UsesLibs()...)

					if len(library.additionalCheckedModules) != 0 {
						entries.AddStrings("LOCAL_ADDITIONAL_CHECKED_MODULE", library.additionalCheckedModules.Strings()...)
+5 −5
Original line number Diff line number Diff line
@@ -566,7 +566,7 @@ func (a *AndroidApp) aaptBuildActions(ctx android.ModuleContext) {

	a.aapt.splitNames = a.appProperties.Package_splits
	a.aapt.LoggingParent = String(a.overridableAppProperties.Logging_parent)
	a.aapt.buildActions(ctx, sdkContext(a), a.exportedSdkLibs, aaptLinkFlags...)
	a.aapt.buildActions(ctx, sdkContext(a), a.classLoaderContexts, aaptLinkFlags...)

	// apps manifests are handled by aapt, don't let Module see them
	a.properties.Manifest = nil
@@ -608,7 +608,7 @@ func (a *AndroidApp) dexBuildActions(ctx android.ModuleContext) android.Path {
	}
	a.dexpreopter.uncompressedDex = *a.dexProperties.Uncompress_dex
	a.dexpreopter.enforceUsesLibs = a.usesLibrary.enforceUsesLibraries()
	a.dexpreopter.classLoaderContexts = a.exportedSdkLibs
	a.dexpreopter.classLoaderContexts = a.classLoaderContexts
	a.dexpreopter.manifestFile = a.mergedManifestFile

	if ctx.ModuleName() != "framework-res" {
@@ -779,7 +779,7 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
		a.aapt.noticeFile = a.noticeOutputs.HtmlGzOutput
	}

	a.exportedSdkLibs = a.usesLibrary.classLoaderContextForUsesLibDeps(ctx)
	a.classLoaderContexts = a.usesLibrary.classLoaderContextForUsesLibDeps(ctx)

	// Process all building blocks, from AAPT to certificates.
	a.aaptBuildActions(ctx)
@@ -788,7 +788,7 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
	a.usesLibrary.freezeEnforceUsesLibraries()

	// Add implicit SDK libraries to <uses-library> list.
	for _, usesLib := range a.exportedSdkLibs.UsesLibs() {
	for _, usesLib := range a.classLoaderContexts.UsesLibs() {
		a.usesLibrary.addLib(usesLib, inList(usesLib, dexpreopt.OptionalCompatUsesLibs))
	}

@@ -1982,7 +1982,7 @@ func (u *usesLibrary) classLoaderContextForUsesLibDeps(ctx android.ModuleContext
				dep := ctx.OtherModuleName(m)
				if lib, ok := m.(Dependency); ok {
					clcMap.AddContextForSdk(ctx, tag.sdkVersion, dep, isSharedSdkLibrary(m),
						lib.DexJarBuildPath(), lib.DexJarInstallPath(), lib.ExportedSdkLibs())
						lib.DexJarBuildPath(), lib.DexJarInstallPath(), lib.ClassLoaderContexts())
				} else if ctx.Config().AllowMissingDependencies() {
					ctx.AddMissingDependencies([]string{dep})
				} else {
+1 −1
Original line number Diff line number Diff line
@@ -163,7 +163,7 @@ func (d *DeviceHostConverter) AidlIncludeDirs() android.Paths {
	return nil
}

func (d *DeviceHostConverter) ExportedSdkLibs() dexpreopt.ClassLoaderContextMap {
func (d *DeviceHostConverter) ClassLoaderContexts() dexpreopt.ClassLoaderContextMap {
	return nil
}

Loading