Reland aosp/1535007:
Enforce <uses-library> checks for android_app and android_app_import. Bug: 132357300 Test: lunch aosp_cf_x86_phone-userdebug && m Merged-In: I50911f727ba98df1035500dbbf467b849be8d6c2 Change-Id: Ief02df2afe56e58189e3165fbb6dbb75f6ff6384
This commit is contained in:
@@ -925,6 +925,8 @@ func AndroidAppFactory() android.Module {
|
||||
&module.appProperties,
|
||||
&module.overridableAppProperties)
|
||||
|
||||
module.usesLibrary.enforce = true
|
||||
|
||||
android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
||||
android.InitDefaultableModule(module)
|
||||
android.InitOverridableModule(module, &module.appProperties.Overrides)
|
||||
@@ -1195,6 +1197,9 @@ type UsesLibraryProperties struct {
|
||||
// with knowledge of their shared libraries.
|
||||
type usesLibrary struct {
|
||||
usesLibraryProperties UsesLibraryProperties
|
||||
|
||||
// Whether to enforce verify_uses_library check.
|
||||
enforce bool
|
||||
}
|
||||
|
||||
func (u *usesLibrary) addLib(lib string, optional bool) {
|
||||
@@ -1279,7 +1284,7 @@ func (u *usesLibrary) classLoaderContextForUsesLibDeps(ctx android.ModuleContext
|
||||
func (u *usesLibrary) enforceUsesLibraries() bool {
|
||||
defaultEnforceUsesLibs := len(u.usesLibraryProperties.Uses_libs) > 0 ||
|
||||
len(u.usesLibraryProperties.Optional_uses_libs) > 0
|
||||
return BoolDefault(u.usesLibraryProperties.Enforce_uses_libs, defaultEnforceUsesLibs)
|
||||
return BoolDefault(u.usesLibraryProperties.Enforce_uses_libs, u.enforce || defaultEnforceUsesLibs)
|
||||
}
|
||||
|
||||
// Freeze the value of `enforce_uses_libs` based on the current values of `uses_libs` and `optional_uses_libs`.
|
||||
|
Reference in New Issue
Block a user