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

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

Merge "Remove apex.use_vndk_as_stable" into main

parents 2c9b9500 b19a0dd9
Loading
Loading
Loading
Loading
+1 −27
Original line number Diff line number Diff line
@@ -157,8 +157,7 @@ type apexBundleProperties struct {
	// Default: true.
	Installable *bool

	// If set true, VNDK libs are considered as stable libs and are not included in this APEX.
	// Should be only used in non-system apexes (e.g. vendor: true). Default is false.
	// Deprecated. Do not use. TODO(b/350644693) remove this after removing all usage
	Use_vndk_as_stable *bool

	// The type of filesystem to use. Either 'ext4', 'f2fs' or 'erofs'. Default 'ext4'.
@@ -950,24 +949,6 @@ func (a *apexBundle) ApexInfoMutator(mctx android.TopDownMutatorContext) {
		return
	}

	// Special casing for APEXes on non-system (e.g., vendor, odm, etc.) partitions. They are
	// provided with a property named use_vndk_as_stable, which when set to true doesn't collect
	// VNDK libraries as transitive dependencies. This option is useful for reducing the size of
	// the non-system APEXes because the VNDK libraries won't be included (and duped) in the
	// APEX, but shared across APEXes via the VNDK APEX.
	useVndk := a.SocSpecific() || a.DeviceSpecific() || (a.ProductSpecific() && mctx.Config().EnforceProductPartitionInterface())
	if proptools.Bool(a.properties.Use_vndk_as_stable) {
		if !useVndk {
			mctx.PropertyErrorf("use_vndk_as_stable", "not supported for system/system_ext APEXes")
		}
		if a.minSdkVersionValue(mctx) != "" {
			mctx.PropertyErrorf("use_vndk_as_stable", "not supported when min_sdk_version is set")
		}
		if mctx.Failed() {
			return
		}
	}

	continueApexDepsWalk := func(child, parent android.Module) bool {
		am, ok := child.(android.ApexModule)
		if !ok || !am.CanHaveApexVariants() {
@@ -985,10 +966,6 @@ func (a *apexBundle) ApexInfoMutator(mctx android.TopDownMutatorContext) {
			return false
		}

		if useVndk && child.Name() == "libbinder" {
			mctx.ModuleErrorf("Module %s in the vendor APEX %s should not use libbinder. Use libbinder_ndk instead.", parent.Name(), a.Name())
		}

		// By default, all the transitive dependencies are collected, unless filtered out
		// above.
		return true
@@ -2718,9 +2695,6 @@ func (a *apexBundle) checkUpdatable(ctx android.ModuleContext) {
		if a.UsePlatformApis() {
			ctx.PropertyErrorf("updatable", "updatable APEXes can't use platform APIs")
		}
		if proptools.Bool(a.properties.Use_vndk_as_stable) {
			ctx.PropertyErrorf("use_vndk_as_stable", "updatable APEXes can't use external VNDK libs")
		}
		if a.FutureUpdatable() {
			ctx.PropertyErrorf("future_updatable", "Already updatable. Remove `future_updatable: true:`")
		}
+0 −54
Original line number Diff line number Diff line
@@ -8278,60 +8278,6 @@ func TestUpdatableDefault_should_set_min_sdk_version(t *testing.T) {
	`)
}

func Test_use_vndk_as_stable_shouldnt_be_used_for_updatable_vendor_apexes(t *testing.T) {
	testApexError(t, `"myapex" .*: use_vndk_as_stable: updatable APEXes can't use external VNDK libs`, `
		apex {
			name: "myapex",
			key: "myapex.key",
			updatable: true,
			use_vndk_as_stable: true,
			soc_specific: true,
		}

		apex_key {
			name: "myapex.key",
			public_key: "testkey.avbpubkey",
			private_key: "testkey.pem",
		}
	`)
}

func Test_use_vndk_as_stable_shouldnt_be_used_with_min_sdk_version(t *testing.T) {
	testApexError(t, `"myapex" .*: use_vndk_as_stable: not supported when min_sdk_version is set`, `
		apex {
			name: "myapex",
			key: "myapex.key",
			updatable: false,
			min_sdk_version: "29",
			use_vndk_as_stable: true,
			vendor: true,
		}

		apex_key {
			name: "myapex.key",
			public_key: "testkey.avbpubkey",
			private_key: "testkey.pem",
		}
	`)
}

func Test_use_vndk_as_stable_shouldnt_be_used_for_non_vendor_apexes(t *testing.T) {
	testApexError(t, `"myapex" .*: use_vndk_as_stable: not supported for system/system_ext APEXes`, `
		apex {
			name: "myapex",
			key: "myapex.key",
			updatable: false,
			use_vndk_as_stable: true,
		}

		apex_key {
			name: "myapex.key",
			public_key: "testkey.avbpubkey",
			private_key: "testkey.pem",
		}
	`)
}

func TestUpdatable_should_not_set_generate_classpaths_proto(t *testing.T) {
	testApexError(t, `"mysystemserverclasspathfragment" .* it must not set generate_classpaths_proto to false`, `
		apex {