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

Commit 627ce867 authored by Jooyung Han's avatar Jooyung Han Committed by Gerrit Code Review
Browse files

Merge "Do not install vndk lib"

parents 0aedb1ef 261e158c
Loading
Loading
Loading
Loading
+0 −6
Original line number Original line Diff line number Diff line
@@ -482,12 +482,6 @@ func (c *vndkPrebuiltLibraryDecorator) AndroidMkEntries(ctx AndroidMkContext, en
	entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
	entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
		c.libraryDecorator.androidMkWriteExportedFlags(entries)
		c.libraryDecorator.androidMkWriteExportedFlags(entries)


		path, file := filepath.Split(c.path.ToMakePath().String())
		stem, suffix, ext := android.SplitFileExt(file)
		entries.SetString("LOCAL_BUILT_MODULE_STEM", "$(LOCAL_MODULE)"+ext)
		entries.SetString("LOCAL_MODULE_SUFFIX", suffix)
		entries.SetString("LOCAL_MODULE_PATH", path)
		entries.SetString("LOCAL_MODULE_STEM", stem)
		if c.tocFile.Valid() {
		if c.tocFile.Valid() {
			entries.SetString("LOCAL_SOONG_TOC", c.tocFile.String())
			entries.SetString("LOCAL_SOONG_TOC", c.tocFile.String())
		}
		}
+9 −6
Original line number Original line Diff line number Diff line
@@ -111,6 +111,7 @@ func testCcError(t *testing.T, pattern string, bp string) {
}
}


func testCcErrorProductVndk(t *testing.T, pattern string, bp string) {
func testCcErrorProductVndk(t *testing.T, pattern string, bp string) {
	t.Helper()
	config := TestConfig(buildDir, android.Android, nil, bp, nil)
	config := TestConfig(buildDir, android.Android, nil, bp, nil)
	config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
	config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
	config.TestProductVariables.ProductVndkVersion = StringPtr("current")
	config.TestProductVariables.ProductVndkVersion = StringPtr("current")
@@ -388,10 +389,12 @@ func TestVndk(t *testing.T) {


	ctx := testCcWithConfig(t, config)
	ctx := testCcWithConfig(t, config)


	checkVndkModule(t, ctx, "libvndk", "vndk-VER", false, "", vendorVariant)
	// subdir == "" because VNDK libs are not supposed to be installed separately.
	checkVndkModule(t, ctx, "libvndk_private", "vndk-VER", false, "", vendorVariant)
	// They are installed as part of VNDK APEX instead.
	checkVndkModule(t, ctx, "libvndk_sp", "vndk-sp-VER", true, "", vendorVariant)
	checkVndkModule(t, ctx, "libvndk", "", false, "", vendorVariant)
	checkVndkModule(t, ctx, "libvndk_sp_private", "vndk-sp-VER", true, "", vendorVariant)
	checkVndkModule(t, ctx, "libvndk_private", "", false, "", vendorVariant)
	checkVndkModule(t, ctx, "libvndk_sp", "", true, "", vendorVariant)
	checkVndkModule(t, ctx, "libvndk_sp_private", "", true, "", vendorVariant)


	// Check VNDK snapshot output.
	// Check VNDK snapshot output.


@@ -2452,8 +2455,8 @@ func TestEnforceProductVndkVersion(t *testing.T) {


	ctx := testCcWithConfig(t, config)
	ctx := testCcWithConfig(t, config)


	checkVndkModule(t, ctx, "libvndk", "vndk-VER", false, "", productVariant)
	checkVndkModule(t, ctx, "libvndk", "", false, "", productVariant)
	checkVndkModule(t, ctx, "libvndk_sp", "vndk-sp-VER", true, "", productVariant)
	checkVndkModule(t, ctx, "libvndk_sp", "", true, "", productVariant)
}
}


func TestEnforceProductVndkVersionErrors(t *testing.T) {
func TestEnforceProductVndkVersionErrors(t *testing.T) {
+14 −13
Original line number Original line Diff line number Diff line
@@ -1246,19 +1246,23 @@ func (library *libraryDecorator) installSymlinkToRuntimeApex(ctx ModuleContext,
func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
	if library.shared() {
	if library.shared() {
		if ctx.Device() && ctx.useVndk() {
		if ctx.Device() && ctx.useVndk() {
			// set subDir for VNDK extensions
			if ctx.isVndkExt() {
				if ctx.isVndkSp() {
				if ctx.isVndkSp() {
					library.baseInstaller.subDir = "vndk-sp"
					library.baseInstaller.subDir = "vndk-sp"
			} else if ctx.isVndk() {
				} else {
					library.baseInstaller.subDir = "vndk"
				}
			}

			// In some cases we want to use core variant for VNDK-Core libs
			if ctx.isVndk() && !ctx.isVndkSp() && !ctx.isVndkExt() {
				mayUseCoreVariant := true
				mayUseCoreVariant := true


				if ctx.mustUseVendorVariant() {
				if ctx.mustUseVendorVariant() {
					mayUseCoreVariant = false
					mayUseCoreVariant = false
				}
				}


				if ctx.isVndkExt() {
					mayUseCoreVariant = false
				}

				if ctx.Config().CFIEnabledForPath(ctx.ModuleDir()) && ctx.Arch().ArchType == android.Arm64 {
				if ctx.Config().CFIEnabledForPath(ctx.ModuleDir()) && ctx.Arch().ArchType == android.Arm64 {
					mayUseCoreVariant = false
					mayUseCoreVariant = false
				}
				}
@@ -1269,15 +1273,12 @@ func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
						library.useCoreVariant = true
						library.useCoreVariant = true
					}
					}
				}
				}
				library.baseInstaller.subDir = "vndk"
			}
			}


			// Append a version to vndk or vndk-sp directories on the system partition.
			// do not install vndk libs
			// vndk libs are packaged into VNDK APEX
			if ctx.isVndk() && !ctx.isVndkExt() {
			if ctx.isVndk() && !ctx.isVndkExt() {
				vndkVersion := ctx.DeviceConfig().PlatformVndkVersion()
				return
				if vndkVersion != "current" && vndkVersion != "" {
					library.baseInstaller.subDir += "-" + vndkVersion
				}
			}
			}
		} else if len(library.Properties.Stubs.Versions) > 0 && !ctx.Host() && ctx.directlyInAnyApex() {
		} else if len(library.Properties.Stubs.Versions) > 0 && !ctx.Host() && ctx.directlyInAnyApex() {
			// Bionic libraries (e.g. libc.so) is installed to the bootstrap subdirectory.
			// Bionic libraries (e.g. libc.so) is installed to the bootstrap subdirectory.
+3 −0
Original line number Original line Diff line number Diff line
@@ -540,6 +540,9 @@ func isVndkSnapshotLibrary(config android.DeviceConfig, m *Module,
	if m.Target().NativeBridge == android.NativeBridgeEnabled {
	if m.Target().NativeBridge == android.NativeBridgeEnabled {
		return nil, "", false
		return nil, "", false
	}
	}
	// !inVendor: There's product/vendor variants for VNDK libs. We only care about vendor variants.
	// !installable: Snapshot only cares about "installable" modules.
	// isSnapshotPrebuilt: Snapshotting a snapshot doesn't make sense.
	if !m.inVendor() || !m.installable(apexInfo) || m.isSnapshotPrebuilt() {
	if !m.inVendor() || !m.installable(apexInfo) || m.isSnapshotPrebuilt() {
		return nil, "", false
		return nil, "", false
	}
	}
+1 −15
Original line number Original line Diff line number Diff line
@@ -201,21 +201,7 @@ func (p *vndkPrebuiltLibraryDecorator) isSnapshotPrebuilt() bool {
}
}


func (p *vndkPrebuiltLibraryDecorator) install(ctx ModuleContext, file android.Path) {
func (p *vndkPrebuiltLibraryDecorator) install(ctx ModuleContext, file android.Path) {
	arches := ctx.DeviceConfig().Arches()
	// do not install vndk libs
	if len(arches) == 0 || arches[0].ArchType.String() != p.arch() {
		return
	}
	if ctx.DeviceConfig().BinderBitness() != p.binderBit() {
		return
	}
	if p.shared() {
		if ctx.isVndkSp() {
			p.baseInstaller.subDir = "vndk-sp-" + p.version()
		} else if ctx.isVndk() {
			p.baseInstaller.subDir = "vndk-" + p.version()
		}
		p.baseInstaller.install(ctx, file)
	}
}
}


func vndkPrebuiltSharedLibrary() *Module {
func vndkPrebuiltSharedLibrary() *Module {