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

Commit fa9bfcd0 authored by Colin Cross's avatar Colin Cross
Browse files

Honor PreventInstall for APKs and dexpreopt files

Native coverage builds create a second variant of APKs and set
PreventInstall on the non-coverage variant.  Skip calling
ctx.InstallFile for APKs and in dexpreopt when PreventInstall
is set.

Fixes: 205865567
Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true CLANG_COVERAGE=true NATIVE_COVERAGE_PATHS="*" NATIVE_COVERAGE_EXCLUDE_PATHS="art bionic/libc device external/compiler-rt external/clang external/llvm external/swiftshader/third_party/llvm-10.0"
Change-Id: I9e38ac737315db12475e8f9bfb3e0e7c0327fc06
parent 3108ce17
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -471,6 +471,7 @@ func (a *AndroidApp) dexBuildActions(ctx android.ModuleContext) android.Path {
	a.dexpreopter.enforceUsesLibs = a.usesLibrary.enforceUsesLibraries()
	a.dexpreopter.enforceUsesLibs = a.usesLibrary.enforceUsesLibraries()
	a.dexpreopter.classLoaderContexts = a.classLoaderContexts
	a.dexpreopter.classLoaderContexts = a.classLoaderContexts
	a.dexpreopter.manifestFile = a.mergedManifestFile
	a.dexpreopter.manifestFile = a.mergedManifestFile
	a.dexpreopter.preventInstall = a.appProperties.PreventInstall


	if ctx.ModuleName() != "framework-res" {
	if ctx.ModuleName() != "framework-res" {
		a.Module.compile(ctx, a.aaptSrcJar)
		a.Module.compile(ctx, a.aaptSrcJar)
@@ -720,7 +721,9 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
	apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
	apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)


	// Install the app package.
	// Install the app package.
	if (Bool(a.Module.properties.Installable) || ctx.Host()) && apexInfo.IsForPlatform() {
	if (Bool(a.Module.properties.Installable) || ctx.Host()) && apexInfo.IsForPlatform() &&
		!a.appProperties.PreventInstall {

		var extraInstalledPaths android.Paths
		var extraInstalledPaths android.Paths
		for _, extra := range a.extraOutputFiles {
		for _, extra := range a.extraOutputFiles {
			installed := ctx.InstallFile(a.installDir, extra.Base(), extra)
			installed := ctx.InstallFile(a.installDir, extra.Base(), extra)
+2 −1
Original line number Original line Diff line number Diff line
@@ -66,6 +66,7 @@ type dexpreopter struct {
	isApp               bool
	isApp               bool
	isTest              bool
	isTest              bool
	isPresignedPrebuilt bool
	isPresignedPrebuilt bool
	preventInstall      bool


	manifestFile        android.Path
	manifestFile        android.Path
	statusFile          android.WritablePath
	statusFile          android.WritablePath
@@ -356,7 +357,7 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr
				installDirOnDevice:  installPath,
				installDirOnDevice:  installPath,
				installFileOnDevice: installBase,
				installFileOnDevice: installBase,
			})
			})
		} else {
		} else if !d.preventInstall {
			ctx.InstallFile(installPath, installBase, install.From)
			ctx.InstallFile(installPath, installBase, install.From)
		}
		}
	}
	}