Revert "Add sdk mutator for native modules"

Revert submission 1242911-sdk_version_variant

Reason for revert: b/153394225
Reverted Changes:
Ife99745fb:Use libnativewindow for platform variant of libagq...
I1bae84c43:Use libnativewindow for platform variant of androi...
I6e6021ed3:Use stl to depend on libc++
Ife99745fb:Use libnativewindow for platform variant of libRSS...
I2c9f439b9:Fix static dependency on libprotobuf-cpp-lite-ndk
Iff2aff9cf:Set sdk_version for cc_genrules used by modules wi...
I7d72934aa:Add sdk mutator for native modules
Ief378a007:Use sdk variant of Soong modules when LOCAL_SDK_VE...

Bug: 149591340
Change-Id: I798fa902c779469c6382b6699351e5d12bf14785
Fixes: 153394225
This commit is contained in:
Colin Cross
2020-04-07 04:21:21 +00:00
parent 82e192c3ae
commit f8e80229fe
21 changed files with 18 additions and 401 deletions

View File

@@ -53,7 +53,6 @@ func init() {
AddNeverAllowRules(createLibcoreRules()...)
AddNeverAllowRules(createMediaRules()...)
AddNeverAllowRules(createJavaDeviceForHostRules()...)
AddNeverAllowRules(createCcSdkVariantRules()...)
}
// Add a NeverAllow rule to the set of rules to apply.
@@ -176,37 +175,6 @@ func createJavaDeviceForHostRules() []Rule {
}
}
func createCcSdkVariantRules() []Rule {
sdkVersionOnlyWhitelist := []string{
// derive_sdk_prefer32 has stem: "derive_sdk" which conflicts with the derive_sdk.
// This sometimes works because the APEX modules that contain derive_sdk and
// derive_sdk_prefer32 suppress the platform installation rules, but fails when
// the APEX modules contain the SDK variant and the platform variant still exists.
"frameworks/base/apex/sdkextensions/derive_sdk",
}
platformVariantPropertiesWhitelist := []string{
// android_native_app_glue and libRSSupport use native_window.h but target old
// sdk versions (minimum and 9 respectively) where libnativewindow didn't exist,
// so they can't add libnativewindow to shared_libs to get the header directory
// for the platform variant. Allow them to use the platform variant
// property to set shared_libs.
"prebuilts/ndk",
"frameworks/rs",
}
return []Rule{
NeverAllow().
NotIn(sdkVersionOnlyWhitelist...).
WithMatcher("sdk_variant_only", isSetMatcherInstance).
Because("sdk_variant_only can only be used in whitelisted projects"),
NeverAllow().
NotIn(platformVariantPropertiesWhitelist...).
WithMatcher("platform.shared_libs", isSetMatcherInstance).
Because("platform variant properties can only be used in whitelisted projects"),
}
}
func neverallowMutator(ctx BottomUpMutatorContext) {
m, ok := ctx.Module().(Module)
if !ok {
@@ -286,18 +254,6 @@ func (m *startsWithMatcher) String() string {
return ".starts-with(" + m.prefix + ")"
}
type isSetMatcher struct{}
func (m *isSetMatcher) test(value string) bool {
return value != ""
}
func (m *isSetMatcher) String() string {
return ".is-set"
}
var isSetMatcherInstance = &isSetMatcher{}
type ruleProperty struct {
fields []string // e.x.: Vndk.Enabled
matcher ValueMatcher